code/template/helper/listbox.php
public function timezones($config = array())
    {
        $config = new ObjectConfig($config);
        $config->append(array(
            'name'      => 'timezone',
            'attribs'   => array(),
            'deselect'  => true,
            'prompt'    => '- '.$this->getObject('translator')->translate('Select Time Zone').' -',
        ));

        if ($config->deselect) {
            $options[] = $this->option(array('label' => $config->prompt, 'value' => ''));
        }

        foreach (\DateTimeZone::listIdentifiers() as $identifier)
        {
            if (strpos($identifier, '/'))
            {
                list($group, $locale) = explode('/', $identifier, 2);
                $groups[$group][] = str_replace('_', ' ', $locale);
            }
        }

        $options[] = $this->option(array('label' => 'Coordinated Universal Time', 'value' => 'UTC'));
        foreach ($groups as $group => $locales)
        {
            foreach ($locales as $locale) {
                $options[$group][] = $this->option(array('label' => $locale, 'value' => str_replace(' ', '_', $group.'/'.$locale)));
            }
        }

        $list = $this->optionlist(array(
            'options'   => $options,
            'name'      => $config->name,
            'selected'  => $config->selected,
            'attribs'   => $config->attribs
        ));

        return $list;
    }
public function timezones($config = array())
    {
        $config = new ObjectConfig($config);
        $config->append(array(
            'name'      => 'timezone',
            'attribs'   => array(),
            'deselect'  => true,
            'prompt'    => '- '.$this->getObject('translator')->translate('Select Time Zone').' -',
        ));

        if ($config->deselect) {
            $options[] = $this->option(array('label' => $config->prompt, 'value' => ''));
        }

        foreach (\DateTimeZone::listIdentifiers() as $identifier)
        {
            if (strpos($identifier, '/'))
            {
                list($group, $locale) = explode('/', $identifier, 2);
                $groups[$group][] = str_replace('_', ' ', $locale);
            }
        }

        $options[] = $this->option(array('label' => 'Coordinated Universal Time', 'value' => 'UTC'));
        foreach ($groups as $group => $locales)
        {
            foreach ($locales as $locale) {
                $options[$group][] = $this->option(array('label' => $locale, 'value' => str_replace(' ', '_', $group.'/'.$locale)));
            }
        }

        $list = $this->optionlist(array(
            'options'   => $options,
            'name'      => $config->name,
            'selected'  => $config->selected,
            'attribs'   => $config->attribs
        ));

        return $list;
    }
public function timezones ( $ config = array ( ) ) { $ config = new ObjectConfig ( $ config ) ; $ config -> append ( array ( 'name' => 'timezone' , 'attribs' => array ( ) , 'deselect' => true , 'prompt' => '- ' . $ this -> getObject ( 'translator' ) -> translate ( 'Select Time Zone' ) . ' -' , ) ) ; if ( $ config -> deselect ) { $ options [ ] = $ this -> option ( array ( 'label' => $ config -> prompt , 'value' => '' ) ) ; } foreach ( \ DateTimeZone :: listIdentifiers ( ) as $ identifier ) { if ( strpos ( $ identifier , '/' ) ) { list ( $ group , $ locale ) = explode ( '/' , $ identifier , 2 ) ; $ groups [ $ group ] [ ] = str_replace ( '_' , ' ' , $ locale ) ; } } $ options [ ] = $ this -> option ( array ( 'label' => 'Coordinated Universal Time' , 'value' => 'UTC' ) ) ; foreach ( $ groups as $ group => $ locales ) { foreach ( $ locales as $ locale ) { $ options [ $ group ] [ ] = $ this -> option ( array ( 'label' => $ locale , 'value' => str_replace ( ' ' , '_' , $ group . '/' . $ locale ) ) ) ; } } $ list = $ this -> optionlist ( array ( 'options' => $ options , 'name' => $ config -> name , 'selected' => $ config -> selected , 'attribs' => $ config -> attribs ) ) ; return $ list ; }
Generates an HTML timezones listbox

@param   array   $config An optional array with configuration options
@return  string  Html
Generates an HTML timezones listbox