element['class'] ? ' class="'.(string) $this->element['class'].'"' : ''; $attr .= ((string) $this->element['disabled'] == 'true') ? ' disabled="disabled"' : ''; $attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : ''; $attr .= $this->multiple ? ' multiple="multiple"' : ''; // Initialize JavaScript field attributes. $attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : ''; // Get the field options. $options = $this->getOptions(); //return $this->_level( $this->name, $this->value, $attr, $options, $this->id); $data = $this->getLayoutData(); $data['options'] = (array) $this->_level( $this->name, $this->value, $attr, $options, $this->id); return $this->getRenderer($this->layout)->render($data); } public static function _level($name, $selected, $attribs = '', $params = true, $id = false) { $db = Factory::getDbo(); $query = $db->getQuery(true); $query->select('a.id AS value, a.title AS text'); $query->from('#__viewlevels AS a'); //PHOCAEDIT $query->where('a.id <> 1'); //ENDPHOCAEDIT $query->group('a.id, a.title'); $query->order('a.ordering ASC'); $query->order('`title` ASC'); // Check for a database error. /* if ($db->getErrorNum()) { throw new Exception($db->getErrorMsg(), 500); return false; }*/ try { // Get the options. $db->setQuery($query); $options = $db->loadObjectList(); } catch (RuntimeException $e) { throw new Exception($e->getMessage(), 500); return false; } // If params is an array, push these options to the array if (is_array($params)) { $options = array_merge($params,$options); } // If all levels is allowed, push it into the array. elseif ($params) { array_unshift($options, HTMLHelper::_('select.option', '', Text::_('JOPTION_ACCESS_SHOW_ALL_LEVELS'))); } return $options; /* return HTMLHelper::_('select.genericlist', $options, $name, array( 'list.attr' => $attribs, 'list.select' => $selected, 'id' => $id ) );*/ } }