1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
<?php
class My_Form_Element_Timezone extends Zend_Form_Element_Multi
{
public $timezone_identifiers = array();
public $areas = array('Africa', 'America', 'Antartica', 'Arctic', 'Asia',
'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
public $helper = 'formSelect';
public function __construct($spec, $options = null)
{
$this->timezone_identifiers = DateTimeZone::listIdentifiers();
foreach($this->timezone_identifiers as $zone) {
$zone = explode('/',$zone);
if (in_array($zone[0], $this->areas)) {
$listZone[$zone[0]]["{$zone[0]}/{$zone[1]}"] = $zone[1];
asort($listZone[$zone[0]]);
}
}
$this->setMultiOptions($listZone);
parent::__construct($spec, $options);
}
} |
Partager