本文整理汇总了PHP中FlexicontentHelperRoute::_setMenuitems方法的典型用法代码示例。如果您正苦于以下问题:PHP FlexicontentHelperRoute::_setMenuitems方法的具体用法?PHP FlexicontentHelperRoute::_setMenuitems怎么用?PHP FlexicontentHelperRoute::_setMenuitems使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FlexicontentHelperRoute
的用法示例。
在下文中一共展示了FlexicontentHelperRoute::_setMenuitems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: populateLookupTable
static function populateLookupTable($language)
{
// Set language menu items if not already done
if ( !isset(self::$menuitems[$language]) ) {
FlexicontentHelperRoute::_setMenuitems($language);
}
$component_menuitems = & self::$menuitems[$language];
// Every VIEW may have a different variable for the lookup table in which we will add the menu items
static $view_varnames = array(FLEXI_ITEMVIEW=>'id', 'category'=>'cid', 'tags'=>'id', 'flexicontent'=>'rootcatid');
self::$lookup[$language] = array();
$user = JFactory::getUser();
foreach($component_menuitems as $menuitem)
{
if ( !isset($menuitem->query) || !isset($menuitem->query['view']) ) continue; // view not set
if ( FLEXI_J16GE && $menuitem->language != $language && $menuitem->language!='*') continue; // wrong menu item language, neither item's language, nor '*' = ALL
if ( @$menuitem->query['view'] == 'category' ) { // CHECK if category menu items ... need to be skipped
if (@$menuitem->query['layout']=='author' && $menuitem->query['authorid']!=$user->id)
// Do not match "author" if specific author is not current user
continue;
else if (@$menuitem->query['layout']=='myitems' && !$user->id)
// Do not match "myitems" if current user is unlogged
continue;
else if (@$menuitem->query['layout'])
// Do not match custom layouts, limited to a category id
continue;
// Do not match menu items that override category configuration parameters, these items will be selectable only
// (a) via direct click on the menu item or
// (b) if their specific Itemid is passed to getCategoryRoute(), getItemRoute()
// (c) they are currently active ...
//if (!isset($menuitem->jparams)) $menuitem->jparams = FLEXI_J16GE ? $menuitem->params : new JParameter($menuitem->params);
//if ( $menuitem->jparams->get('override_defaultconf',0) ) continue;
}
// Create lookup table for view if it does not exist already
$view = $menuitem->query['view'];
if (!isset(self::$lookup[$language][$view])) self::$lookup[$language][$view] = array();
// Check if view 's variable (used in lookup table) exists in the menu item
if ( !isset($view_varnames[$view]) ) continue;
$_index_name = $view_varnames[$view];
if ( empty($menuitem->query[$_index_name]) ) continue;
$_index_val = $menuitem->query[$_index_name];
// Only a specific language menu item can override an existing lookup entry
if ( isset(self::$lookup[$language][$view][$_index_val]) && FLEXI_J16GE && $menuitem->language == '*' ) continue;
// Finally set new lookup entry or override existing lookup entry with language specific menu item
self::$lookup[$language][$view][$_index_val] = (int) $menuitem->id;
}
}
示例2: populateLookupTable
static function populateLookupTable($language)
{
// Set language menu items if not already done
if (!isset(self::$menuitems[$language])) {
FlexicontentHelperRoute::_setMenuitems($language);
}
$component_menuitems =& self::$menuitems[$language];
// Every VIEW may have a different variable for the lookup table in which we will add the menu items
static $view_varnames = array(FLEXI_ITEMVIEW => 'id', 'category' => 'cid', 'tags' => 'id', 'flexicontent' => 'rootcatid');
static $layout_idvars = array('tags' => 'tagid', 'author' => 'authorid');
self::$lookup[$language] = array();
$user = JFactory::getUser();
foreach ($component_menuitems as $menuitem) {
if (!isset($menuitem->query) || !isset($menuitem->query['view'])) {
continue;
}
// view not set
if ($menuitem->language != $language && $menuitem->language != '*') {
continue;
}
// wrong menu item language, neither item's language, nor '*' = ALL
$view = $menuitem->query['view'];
$layout = $view == 'category' && !empty($menuitem->query['layout']) ? $menuitem->query['layout'] : false;
// Create lookup table for view if it does not exist already
$i_view = $view . ($layout && $view == 'category' ? '_' . $layout : '');
if (!isset(self::$lookup[$language][$i_view])) {
self::$lookup[$language][$i_view] = array();
}
// Check if view 's variable (used in lookup table) exists in the menu item
if (!isset($view_varnames[$view])) {
continue;
}
$i_name = $view_varnames[$view];
if (empty($menuitem->query[$i_name]) && !$layout) {
continue;
}
$i_val = !empty($menuitem->query[$i_name]) ? (int) $menuitem->query[$i_name] : 0;
if ($layout) {
$i_name = @$layout_idvars[$layout];
$i_val = (int) ($i_name ? @$menuitem->query[$i_name] : '0') . '_' . $i_val;
}
// Only a specific language menu item can override an existing lookup entry
if (isset(self::$lookup[$language][$i_view][$i_val]) && $menuitem->language == '*') {
continue;
}
// Finally set new lookup entry or override existing lookup entry with language specific menu item
self::$lookup[$language][$i_view][$i_val] = (int) $menuitem->id;
}
//echo "<pre>"; print_r(self::$lookup); echo "</pre>"; exit;
}