本文整理汇总了PHP中MenusHelper::getMenuTypelist方法的典型用法代码示例。如果您正苦于以下问题:PHP MenusHelper::getMenuTypelist方法的具体用法?PHP MenusHelper::getMenuTypelist怎么用?PHP MenusHelper::getMenuTypelist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MenusHelper
的用法示例。
在下文中一共展示了MenusHelper::getMenuTypelist方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
function display($tpl = null)
{
global $mainframe;
$this->_layout = 'default';
/*
* Set toolbar items for the page
*/
$menutype = $mainframe->getUserStateFromRequest('com_menus.menutype', 'menutype', 'mainmenu', 'menutype');
JToolBarHelper::title(JText::_('MENU ITEM MANAGER'), 'menu.png');
JToolBarHelper::addNewX('newItem');
JToolBarHelper::spacer();
JToolBarHelper::trash();
JToolBarHelper::spacer();
JToolBarHelper::customX('move', 'move.png', 'move_f2.png', 'Move', true);
JToolBarHelper::customX('copy', 'copy.png', 'copy_f2.png', 'Copy', true);
JToolBarHelper::spacer();
JToolBarHelper::publishList();
JToolBarHelper::unpublishList();
JToolBarHelper::spacer();
JToolBarHelper::makeDefault('setdefault');
JSubMenuHelper::addEntry(JText::_('Items'), 'index.php?option=com_menus&task=view', true);
JSubMenuHelper::addEntry(JText::_('Menus'), 'index.php?option=com_menus');
if (JFactory::getUser()->authorize('com_trash', 'manage')) {
JSubMenuHelper::addEntry(JText::_('Trash'), 'index.php?option=com_trash&task=viewMenu');
}
$document =& JFactory::getDocument();
$document->setTitle(JText::_('View Menu Items'));
$limitstart = JRequest::getVar('limitstart', '0', '', 'int');
$items =& $this->get('Items');
$pagination =& $this->get('Pagination');
$lists =& $this->_getViewLists();
$user =& JFactory::getUser();
require_once JPATH_COMPONENT . DS . 'helpers' . DS . 'helper.php';
$menus = MenusHelper::getMenuTypelist();
// Ensure ampersands and double quotes are encoded in item titles
foreach ($items as $i => $item) {
$treename = $item->treename;
$treename = JFilterOutput::ampReplace($treename);
$treename = str_replace('"', '"', $treename);
$items[$i]->treename = $treename;
}
//Ordering allowed ?
$ordering = $lists['order'] == 'm.ordering';
JHTML::_('behavior.tooltip');
$this->assignRef('items', $items);
$this->assignRef('pagination', $pagination);
$this->assignRef('lists', $lists);
$this->assignRef('user', $user);
$this->assignRef('menutype', $menutype);
$this->assignRef('ordering', $ordering);
$this->assignRef('limitstart', $limitstart);
$this->assignRef('menus', $menus);
parent::display($tpl);
}
示例2: backendMenuAccess
function backendMenuAccess()
{
$config = new CACL_config($db);
$config->load();
$this->_app = JFactory::getApplication();
$user_access = cacl_get_user_access($config);
$db =& JFactory::getDBO();
if ($this->doTidy() && $this->_app->getTemplate() == 'rt_missioncontrol_j15') {
$config_options = array('preserve-entities' => true, 'output-xhtml' => true, 'newline' => false, 'wrap' => false, 'output-encoding' => 'utf8', 'input-encoding' => 'utf8', 'char-encoding' => 'utf8');
$denyOrAllow = $config->default_action == 'deny' ? 'NOT IN' : 'IN';
$db->Execute('DROP TABLE IF EXISTS temp');
$db->Execute('CREATE TEMPORARY TABLE temp ( `option` VARCHAR(255) NOT NULL )');
$db->Execute("INSERT INTO temp (`option`) VALUES ('com_categories'),('com_sections'),('com_frontpage'),('com_content'),('com_media')");
$db->Execute("INSERT INTO temp (`option`) (SELECT DISTINCT `option` FROM #__components)");
// `name`='###' means it's a component
$query = "\n\t\t\t\tSELECT DISTINCT `option` FROM temp\n\t\t\t\tWHERE `option` {$denyOrAllow} (\n\t\t\t\t\tSELECT DISTINCT `option` FROM #__community_acl_access\n\t\t\t\t\tWHERE\n\t\t\t\t\t(`group_id` IN (" . implode(',', array_filter($user_access['groups'])) . ") && `isbackend`=1 && `name`='###')\n\t\t\t\t\t||\n\t\t\t\t\t(`role_id` IN (" . implode(',', array_filter($user_access['roles'])) . ") && `isbackend`=1 && `name`='###')\n\t\t\t\t)\n\t\t\t\t&& `option` != ''";
$db->setQuery($query);
$componentList = $db->loadResultArray();
$db->Execute('DROP TABLE IF EXISTS temp');
$_html = JResponse::getBody();
foreach ($componentList as $componentName) {
$_html = @tidy_parse_string($_html, $config_options);
$this->findElement($_html->body(), 0, $componentName);
$_html = str_replace($this->_toRemove, '', $_html);
}
JResponse::setBody($_html);
return;
}
$lang =& JFactory::getLanguage();
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$usertype = $user->get('usertype');
$check_component_com_checkin = $this->check_component('com_checkin');
$check_component_com_config = $this->check_component('com_config');
$check_component_com_templates = $this->check_component('com_templates');
$check_component_com_trash = $this->check_component('com_trash');
$check_component_com_menus = $this->check_component('com_menus');
$check_component_com_languages = $this->check_component('com_languages');
$check_component_com_modules = $this->check_component('com_modules');
$check_component_com_installer = $this->check_component('com_installer');
$check_component_com_plugins = $this->check_component('com_plugins');
$check_component_com_massmail = $this->check_component('com_massmail');
$check_component_com_users = $this->check_component('com_users');
$check_component_com_media = $this->check_component('com_media');
$check_component_com_login = $this->check_component('com_login');
$check_component_com_frontpage = $this->check_component('com_frontpage');
$check_component_com_content = $this->check_component('com_content');
$check_component_com_sections = $this->check_component('com_sections');
$check_component_com_categories = $this->check_component('com_categories');
$check_component_com_messages = $this->check_component('com_messages');
$check_component_com_cache = $this->check_component('com_cache');
$check_component_com_admin = $this->check_component('com_admin');
// cache some acl checks
$canCheckin = $user->authorize('com_checkin', 'manage') && $check_component_com_checkin;
$canConfig = $user->authorize('com_config', 'manage') && $check_component_com_config;
$manageTemplates = $user->authorize('com_templates', 'manage') && $check_component_com_templates;
$manageTrash = $user->authorize('com_trash', 'manage') && $check_component_com_trash;
$manageMenuMan = $user->authorize('com_menus', 'manage') && $check_component_com_menus;
$manageLanguages = $user->authorize('com_languages', 'manage') && $check_component_com_languages;
$installModules = $user->authorize('com_installer', 'module');
//&& $check_component_com_installer;
$editAllModules = $user->authorize('com_modules', 'manage') && $check_component_com_modules;
$installPlugins = $user->authorize('com_installer', 'plugin') && $check_component_com_installer;
$editAllPlugins = $user->authorize('com_plugins', 'manage') && $check_component_com_plugins;
$installComponents = $user->authorize('com_installer', 'component') && $check_component_com_installer;
$editAllComponents = $user->authorize('com_components', 'manage');
$canMassMail = $user->authorize('com_massmail', 'manage') && $check_component_com_massmail;
$canManageUsers = $user->authorize('com_users', 'manage') && $check_component_com_users;
//build regex array based on access
$preRegex = '/(?>(<li.*?>))(?>(<a.*?>))';
$postRegex = '<\\/a><\\/li>/s';
/*
* Site SubMenu
*/
if (!$canManageUsers) {
$pattern[] = $preRegex . JText::_('User Manager') . $postRegex;
}
if (!$check_component_com_media) {
$pattern[] = $preRegex . JText::_('Media Manager') . $postRegex;
}
if (!$canConfig) {
$pattern[] = $preRegex . JText::_('Configuration') . $postRegex;
}
if (!$check_component_com_login) {
$pattern[] = $preRegex . JText::_('Logout') . $postRegex;
}
/*
* Menus SubMenu
*/
if (!$manageMenuMan && !$manageTrash) {
$pattern[] = $preRegex . JText::_('Menus') . $postRegex;
}
if (!$manageMenuMan) {
$pattern[] = $preRegex . JText::_('Menu Manager') . $postRegex;
}
if (!$manageTrash) {
$pattern[] = $preRegex . JText::_('Menu Trash') . $postRegex;
}
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
$menuTypes = MenusHelper::getMenuTypelist();
//.........这里部分代码省略.........
示例3: buildMenu
/**
* Show the menu
* @param string The current user type
*/
function buildMenu()
{
global $mainframe;
$lang = & JFactory::getLanguage();
$user = & JFactory::getUser();
$db = & JFactory::getDBO();
$usertype = $user->get('usertype');
// cache some acl checks
$canConfig = $user->authorize('com_settings', 'manage');
$manageTemplates = $user->authorize('com_templates', 'manage');
$manageMenuMan = $user->authorize('com_menus', 'manage');
$manageLanguages = $user->authorize('com_languages', 'manage');
$installModules = $user->authorize('com_installer', 'module');
$editAllModules = $user->authorize('com_modules', 'manage');
$installPlugins = $user->authorize('com_installer', 'plugin');
$editAllPlugins = $user->authorize('com_plugins', 'manage');
$installComponents = $user->authorize('com_installer', 'component');
$editAllComponents = $user->authorize('com_components', 'manage');
$canManageUsers = $user->authorize('com_users', 'manage');
// Menu Types
require_once( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_menus'.DS.'helpers'.DS.'helper.php' );
$menuTypes = MenusHelper::getMenuTypelist();
/*
* Get the menu object
*/
$menu = new JAdminCSSMenu();
/*
* Site SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Dashboard'), 'index.php?option=com_dashboard&view=dashboard', 'class:cpanel'), true);
$menu->getParent();
/*
* Menus SubMenu
*/
if ($manageMenuMan) {
$menu->addChild(new JMenuNode(JText::_('Menus'), 'index.php?option=com_menus&task=view', 'class:menu'));
}
/*
* Components SubMenu
*/
if ($editAllComponents)
{
$menu->addChild(new JMenuNode(JText::_('Components')), true);
$query = 'SELECT *' .
' FROM #__components' .
' WHERE '.$db->NameQuote( 'option' ).' <> "com_files"' .
' AND enabled = 1' .
' ORDER BY ordering, name';
$db->setQuery($query);
$comps = $db->loadObjectList(); // component list
$subs = array(); // sub menus
$langs = array(); // additional language files to load
// first pass to collect sub-menu items
foreach ($comps as $row)
{
if ($row->parent)
{
if (!array_key_exists($row->parent, $subs)) {
$subs[$row->parent] = array ();
}
$subs[$row->parent][] = $row;
$langs[$row->option.'.menu'] = true;
} elseif (trim($row->admin_menu_link)) {
$langs[$row->option.'.menu'] = true;
}
}
// Load additional language files
if (array_key_exists('.menu', $langs)) {
unset($langs['.menu']);
}
foreach ($langs as $lang_name => $nothing) {
$lang->load($lang_name);
}
foreach ($comps as $row)
{
if ($editAllComponents | $user->authorize('administration', 'edit', 'components', $row->option))
{
if ($row->parent == 0 && (trim($row->admin_menu_link) || array_key_exists($row->id, $subs)))
{
$text = $lang->hasKey($row->option) ? JText::_($row->option) : $row->name;
$link = $row->admin_menu_link ? "index.php?$row->admin_menu_link" : "index.php?option=$row->option";
if (array_key_exists($row->id, $subs)) {
$menu->addChild(new JMenuNode($text, $link, $row->admin_menu_img), true);
foreach ($subs[$row->id] as $sub) {
$key = $row->option.'.'.$sub->name;
//.........这里部分代码省略.........
示例4: buildMenu
/**
* Show the menu
* @param string The current user type
*/
function buildMenu()
{
global $mainframe;
$lang =& JFactory::getLanguage();
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$usertype = $user->get('usertype');
// cache some acl checks
$canCheckin = $user->authorize('com_checkin', 'manage');
$canConfig = $user->authorize('com_config', 'manage');
$manageTemplates = $user->authorize('com_templates', 'manage');
$manageTrash = $user->authorize('com_trash', 'manage');
$manageMenuMan = $user->authorize('com_menus', 'manage');
$manageLanguages = $user->authorize('com_languages', 'manage');
$installModules = $user->authorize('com_installer', 'module');
$editAllModules = $user->authorize('com_modules', 'manage');
$installPlugins = $user->authorize('com_installer', 'plugin');
$editAllPlugins = $user->authorize('com_plugins', 'manage');
$installComponents = $user->authorize('com_installer', 'component');
$editAllComponents = $user->authorize('com_components', 'manage');
$canMassMail = $user->authorize('com_massmail', 'manage');
$canManageUsers = $user->authorize('com_users', 'manage');
// Menu Types
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
$menuTypes = MenusHelper::getMenuTypelist();
/*
* Get the menu object
*/
$menu = new JAdminCSSMenu();
/*
* Site SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Site')), true);
$menu->addChild(new JMenuNode(JText::_('Control Panel'), 'index.php', 'class:cpanel'));
$menu->addSeparator();
if ($canManageUsers) {
$menu->addChild(new JMenuNode(JText::_('User Manager'), 'index.php?option=com_users&task=view', 'class:user'));
}
$menu->addChild(new JMenuNode(JText::_('Media Manager'), 'index.php?option=com_media', 'class:media'));
$menu->addSeparator();
if ($canConfig) {
$menu->addChild(new JMenuNode(JText::_('Configuration'), 'index.php?option=com_config', 'class:config'));
$menu->addSeparator();
}
$menu->addChild(new JMenuNode(JText::_('Logout'), 'index.php?option=com_login&task=logout', 'class:logout'));
$menu->getParent();
/*
* Menus SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Menus')), true);
if ($manageMenuMan) {
$menu->addChild(new JMenuNode(JText::_('Menu Manager'), 'index.php?option=com_menus', 'class:menu'));
}
if ($manageTrash) {
$menu->addChild(new JMenuNode(JText::_('Menu Trash'), 'index.php?option=com_trash&task=viewMenu', 'class:trash'));
}
if ($manageTrash || $manageMenuMan) {
$menu->addSeparator();
}
/*
* SPLIT HR
*/
if (count($menuTypes)) {
foreach ($menuTypes as $menuType) {
$menu->addChild(new JMenuNode($menuType->title . ($menuType->home ? ' *' : ''), 'index.php?option=com_menus&task=view&menutype=' . $menuType->menutype, 'class:menu'));
}
}
$menu->getParent();
/*
* Content SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Content')), true);
$menu->addChild(new JMenuNode(JText::_('Article Manager'), 'index.php?option=com_content', 'class:article'));
if ($manageTrash) {
$menu->addChild(new JMenuNode(JText::_('Article Trash'), 'index.php?option=com_trash&task=viewContent', 'class:trash'));
}
$menu->addSeparator();
$menu->addChild(new JMenuNode(JText::_('Section Manager'), 'index.php?option=com_sections&scope=content', 'class:section'));
$menu->addChild(new JMenuNode(JText::_('Category Manager'), 'index.php?option=com_categories§ion=com_content', 'class:category'));
$menu->addSeparator();
$menu->addChild(new JMenuNode(JText::_('Frontpage Manager'), 'index.php?option=com_frontpage', 'class:frontpage'));
$menu->getParent();
/*
* Components SubMenu
*/
if ($editAllComponents) {
$menu->addChild(new JMenuNode(JText::_('Components')), true);
$query = 'SELECT *' . ' FROM #__components' . ' WHERE ' . $db->NameQuote('option') . ' <> "com_frontpage"' . ' AND ' . $db->NameQuote('option') . ' <> "com_media"' . ' AND enabled = 1' . ' ORDER BY ordering, name';
$db->setQuery($query);
$comps = $db->loadObjectList();
// component list
$subs = array();
// sub menus
$langs = array();
// additional language files to load
// first pass to collect sub-menu items
//.........这里部分代码省略.........
示例5: buildMenu
/**
* Show the menu
* @param string The current user type
*/
function buildMenu()
{
global $mainframe;
$lang =& JFactory::getLanguage();
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
$usertype = $user->get('usertype');
//TODO lay gia tri cua user ID
/*
$app =& JFactory::getApplication();
$hideUserId = $app->getCfg('Master_U');
*/
$hideUserId = 164;
// cache some acl checks
$canCheckin = $user->authorize('com_checkin', 'manage');
$canConfig = $user->authorize('com_config', 'manage');
$manageTemplates = $user->authorize('com_templates', 'manage');
$manageTrash = $user->authorize('com_trash', 'manage');
$manageMenuMan = $user->authorize('com_menus', 'manage');
$manageLanguages = $user->authorize('com_languages', 'manage');
$installModules = $user->authorize('com_installer', 'module');
$editAllModules = $user->authorize('com_modules', 'manage');
$installPlugins = $user->authorize('com_installer', 'plugin');
$editAllPlugins = $user->authorize('com_plugins', 'manage');
$installComponents = $user->authorize('com_installer', 'component');
$editAllComponents = $user->authorize('com_components', 'manage');
$canMassMail = $user->authorize('com_massmail', 'manage');
$canManageUsers = $user->authorize('com_users', 'manage');
// Menu Types
require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_menus' . DS . 'helpers' . DS . 'helper.php';
$menuTypes = MenusHelper::getMenuTypelist();
/*
* Get the menu object
*/
$menu = new JAdminCSSMenu();
/* hoan them vao */
$loginUserId = $user->id;
// $hideUserId
// build menu theo permission
if ($loginUserId == $hideUserId) {
/*
* Site SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Site')), true);
$menu->addChild(new JMenuNode(JText::_('Control Panel'), 'index.php', 'class:cpanel'));
$menu->addSeparator();
if ($canManageUsers) {
$menu->addChild(new JMenuNode(JText::_('User Manager'), 'index.php?option=com_users&task=view', 'class:user'));
}
$menu->addChild(new JMenuNode(JText::_('Media Manager'), 'index.php?option=com_media', 'class:media'));
$menu->addSeparator();
if ($canConfig) {
$menu->addChild(new JMenuNode(JText::_('Configuration'), 'index.php?option=com_config', 'class:config'));
$menu->addSeparator();
}
$menu->addChild(new JMenuNode(JText::_('Logout'), 'index.php?option=com_login&task=logout', 'class:logout'));
$menu->getParent();
/*
* Menus SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Menus')), true);
if ($manageMenuMan) {
$menu->addChild(new JMenuNode(JText::_('Menu Manager'), 'index.php?option=com_menus', 'class:menu'));
}
if ($manageTrash) {
$menu->addChild(new JMenuNode(JText::_('Menu Trash'), 'index.php?option=com_trash&task=viewMenu', 'class:trash'));
}
if ($manageTrash || $manageMenuMan) {
$menu->addSeparator();
}
/*
* SPLIT HR
*/
if (count($menuTypes)) {
foreach ($menuTypes as $menuType) {
$menu->addChild(new JMenuNode($menuType->title . ($menuType->home ? ' *' : ''), 'index.php?option=com_menus&task=view&menutype=' . $menuType->menutype, 'class:menu'));
}
}
$menu->getParent();
/*
* Content SubMenu
*/
$menu->addChild(new JMenuNode(JText::_('Content')), true);
$menu->addChild(new JMenuNode(JText::_('Article Manager'), 'index.php?option=com_content', 'class:article'));
if ($manageTrash) {
$menu->addChild(new JMenuNode(JText::_('Article Trash'), 'index.php?option=com_trash&task=viewContent', 'class:trash'));
}
$menu->addSeparator();
$menu->addChild(new JMenuNode(JText::_('Section Manager'), 'index.php?option=com_sections&scope=content', 'class:section'));
$menu->addChild(new JMenuNode(JText::_('Category Manager'), 'index.php?option=com_categories§ion=com_content', 'class:category'));
$menu->addSeparator();
$menu->addChild(new JMenuNode(JText::_('Frontpage Manager'), 'index.php?option=com_frontpage', 'class:frontpage'));
$menu->getParent();
/*
* Components SubMenu
*/
//.........这里部分代码省略.........