10 defined(
'JPATH_PLATFORM') or die;
53 protected $translate =
false;
72 public function __get($name)
83 return parent::__get($name);
96 public function __set($name, $value)
104 $this->$name = (string) $value;
108 parent::__set($name, $value);
126 public function setup(SimpleXMLElement $element, $value, $group = null)
128 $return = parent::setup($element, $value, $group);
132 $this->keyField = $this->element[
'key_field'] ? (string) $this->element[
'key_field'] :
'value';
133 $this->valueField = $this->element[
'value_field'] ? (string) $this->element[
'value_field'] : (
string) $this->element[
'name'];
134 $this->translate = $this->element[
'translate'] ? (string) $this->element[
'translate'] :
false;
135 $this->query = (string) $this->element[
'query'];
149 protected function getOptions()
154 $key = $this->keyField;
155 $value = $this->valueField;
161 $db->setQuery($this->query);
162 $items = $db->loadObjectlist();
167 foreach ($items as $item)
169 if ($this->translate ==
true)
171 $options[] = JHtml::_(
'select.option', $item->$key,
JText::_($item->$value));
175 $options[] = JHtml::_(
'select.option', $item->$key, $item->$value);
181 $options = array_merge(parent::getOptions(), $options);