10 defined(
'JPATH_PLATFORM') or die;
29 protected $type =
'Timezone';
37 protected static $zones = array(
'Africa',
'America',
'Antarctica',
'Arctic',
'Asia',
'Atlantic',
'Australia',
'Europe',
'Indian',
'Pacific');
56 public function __get($name)
64 return parent::__get($name);
77 public function __set($name, $value)
82 $this->keyField = (string) $value;
86 parent::__set($name, $value);
104 public function setup(SimpleXMLElement $element, $value, $group = null)
106 $return = parent::setup($element, $value, $group);
110 $this->keyField = (string) $this->element[
'key_field'];
123 protected function getGroups()
127 $keyField = !empty($this->keyField) ? $this->keyField :
'id';
128 $keyValue = $this->form->getValue($keyField);
131 if (strlen($this->value) == 0 && empty($keyValue))
137 $zones = DateTimeZone::listIdentifiers();
140 foreach ($zones as $zone)
143 if (strpos($zone,
'/') ===
false)
149 list ($group, $locale) = explode(
'/', $zone, 2);
152 if (in_array($group, self::$zones))
155 if (!isset($groups[$group]))
157 $groups[$group] = array();
163 $groups[$group][$zone] = JHtml::_(
'select.option', $zone, str_replace(
'_',
' ', $locale),
'value',
'text',
false);
171 foreach ($groups as &$location)
177 $groups = array_merge(parent::getGroups(), $groups);