/** * Hook for children views to allow them set the menu for the list and edit requests. * Children views usually will not need to override this method. * * @param string $mode The mode of the menu. It is null for lists and has the value of 'edit' in edit requests. * * @return void */ protected function setMenu($mode = null) { // Get user $user = JFactory::getUser(); // Set primary menu only for listings if ($mode != 'edit') { K2Response::addMenuLink('items', 'K2_ITEMS', array('href' => '#items'), 'primary'); K2Response::addMenuLink('categories', 'K2_CATEGORIES', array('href' => '#categories'), 'primary'); if ($user->authorise('k2.tags.manage', 'com_k2')) { K2Response::addMenuLink('tags', 'K2_TAGS', array('href' => '#tags'), 'primary'); } if ($user->authorise('k2.comment.edit', 'com_k2')) { K2Response::addMenuLink('comments', 'K2_COMMENTS', array('href' => '#comments'), 'primary'); } if ($user->authorise('k2.extrafields.manage', 'com_k2')) { K2Response::addMenuLink('extrafields', 'K2_EXTRA_FIELDS', array('href' => '#extrafields'), 'primary'); K2Response::addMenuLink('extrafieldsgroups', 'K2_EXTRA_FIELD_GROUPS', array('href' => '#extrafieldsgroups'), 'primary'); } K2Response::addMenuLink('users', 'K2_USERS', array('href' => '#users'), 'primary'); K2Response::addMenuLink('usergroups', 'K2_USER_GROUPS', array('href' => '#usergroups'), 'primary'); K2Response::addMenuLink('media', 'K2_MEDIA_MANAGER', array('href' => '#media'), 'primary'); if ($user->authorise('core.admin', 'com_k2')) { K2Response::addMenuLink('utilities', 'K2_UTILITIES', array('href' => '#utilities'), 'primary'); } if ($user->authorise('core.login.admin', 'com_k2')) { K2Response::addMenuLink('information', 'K2_INFORMATION', array('href' => '#information'), 'primary'); } if ($user->authorise('core.admin', 'com_k2')) { K2Response::addMenuLink('settings', 'K2_SETTINGS', array('href' => '#settings'), 'primary'); } K2Response::addMenuLink('help', 'K2_HELP', array('href' => 'http://www.joomlaworks.net/forum/k2', 'target' => '_blank'), 'primary'); } // Set secondary menu if ($user->authorise('core.login.admin', 'com_k2')) { K2Response::addMenuLink('information', 'K2_INFORMATION', array('href' => '#information'), 'secondary'); } if ($user->authorise('core.admin', 'com_k2')) { K2Response::addMenuLink('settings', 'K2_SETTINGS', array('href' => '#settings'), 'secondary'); } K2Response::addMenuLink('help', 'K2_HELP', array('href' => 'http://getk2.org/community', 'target' => '_blank'), 'secondary'); }