/** * Adds an 'primary' flag to the language objects */ public function getList() { $languages = parent::getList(); $primary = KFactory::get('admin::com.nooku.model.nooku')->getPrimaryLanguage()->iso_code; foreach ($languages as $lang) { $lang->primary = $lang->iso_code == $primary; } return $languages; }
public function getList() { $list = parent::getList(); // Add table comment information $tables = $this->getTableList(); foreach ($list as $item) { $item->comment = $tables[$item->table_name]->comment; } return $list; }
public function getList() { if (!isset($this->_list)) { $list = parent::getList(); //Get the menu item data from all the languages $menu = KFactory::get('lib.joomla.application')->getMenu(); $user = KFactory::get('lib.joomla.user'); $nooku = KFactory::get('admin::com.nooku.model.nooku'); $primary = $nooku->getPrimaryLanguage()->iso_code; //If an active menu item can be found use it to get all relevant menu item data on all languages if ($item = $menu->getActive()) { $query = $this->_db->getQuery()->select($primary . '.published AS ' . $primary . '_published')->select($primary . '.access AS ' . $primary . '_access')->from('menu AS ' . $primary)->where($primary . '.id', '=', $item->id); foreach ($list as $lang) { if ($lang->iso_code != $primary) { $query->join('LEFT', strtolower($lang->iso_code) . '_menu AS ' . $lang->iso_code, $primary . '.id = ' . $lang->iso_code . '.id')->select($lang->iso_code . '.published AS ' . $lang->iso_code . '_published')->select($lang->iso_code . '.access AS ' . $lang->iso_code . '_access'); } } //Turn query translations off $active = $this->_db->setActiveLanguage(); $this->_db->select($query); $result = $this->_db->loadAssoc(); //Turn query translations on $this->_db->setActiveLanguage($active); //Decide based on publish and access information which items to return foreach ($list as $item) { if ($result[$item->iso_code . '_published'] == 0 || $result[$item->iso_code . '_access'] > $user->aid) { $list->offsetUnset($list->key()); } } } foreach ($list as $item) { $item->fullname = $item->name . ' (' . $item->native_name . ')'; } } return $this->_list; }