本文整理汇总了PHP中menu::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP menu::getInstance方法的具体用法?PHP menu::getInstance怎么用?PHP menu::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类menu
的用法示例。
在下文中一共展示了menu::getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: MB_editMenu
function MB_editMenu($mid)
{
global $_CONF, $_TABLES, $_ST_CONF, $stMenu, $LANG_MB00, $LANG_MB01, $LANG_MB_ADMIN, $LANG_MB_TYPES, $LANG_MB_GLTYPES, $LANG_MB_GLFUNCTION, $LANG_MB_MENU_TYPES;
$retval = '';
$menu_id = $mid;
$menu = menu::getInstance($menu_id);
$menu_arr = array(array('url' => $_CONF['site_admin_url'] . '/menu.php?mode=menu&menu=' . $menu_id, 'text' => $LANG_MB01['return_to'] . $menu->name), array('url' => $_CONF['site_admin_url'] . '/menu.php', 'text' => $LANG_MB01['menu_list']));
$retval .= COM_startBlock($LANG_MB01['menu_builder'] . ' :: ' . $LANG_MB01['edit_element'] . ' for ' . $menu->name, '', COM_getBlockTemplate('_admin_block', 'header'));
$retval .= ADMIN_createMenu($menu_arr, $LANG_MB_ADMIN[5], $_CONF['layout_url'] . '/images/icons/menubuilder.png');
// build menu type select
$menuTypeSelect = '<select id="menutype" name="menutype">' . LB;
while ($types = current($LANG_MB_MENU_TYPES)) {
$menuTypeSelect .= '<option value="' . key($LANG_MB_MENU_TYPES) . '"';
if (key($LANG_MB_MENU_TYPES) == $menu->type) {
$menuTypeSelect .= ' selected="selected"';
}
$menuTypeSelect .= '>' . $types . '</option>' . LB;
next($LANG_MB_MENU_TYPES);
}
$menuTypeSelect .= '</select>' . LB;
// build group select
$rootUser = DB_getItem($_TABLES['group_assignments'], 'ug_uid', 'ug_main_grp_id=1');
$usergroups = SEC_getUserGroups($rootUser);
$usergroups[$LANG_MB01['non-logged-in']] = 998;
uksort($usergroups, "strnatcasecmp");
$group_select = '<select id="group" name="group">' . LB;
for ($i = 0; $i < count($usergroups); $i++) {
$group_select .= '<option value="' . $usergroups[key($usergroups)] . '"';
if ($usergroups[key($usergroups)] == $menu->group_id) {
$group_select .= ' selected="selected"';
}
$group_select .= '>' . ucfirst(key($usergroups)) . '</option>' . LB;
next($usergroups);
}
$group_select .= '</select>' . LB;
$T = new Template($_CONF['path_layout'] . 'admin/menu');
$T->set_file(array('admin' => 'editmenu.thtml'));
if ($mid == 1 || $mid == 2 || $mid == 3) {
$disabled = ' readonly ';
} else {
$disabled = '';
}
$menu_active_check = $menu->active == 1 ? ' checked="checked"' : '';
$T->set_var(array('group_select' => $group_select, 'menutype' => $menu->type, 'menutype_select' => $menuTypeSelect, 'menuactive' => $menu->active == 1 ? ' checked="checked"' : ' ', 'form_action' => $_CONF['site_admin_url'] . '/menu.php', 'menu_id' => $mid, 'menuname' => $menu->name, 'enabled' => $menu_active_check, 'disabled' => $disabled));
$T->parse('output', 'admin');
$retval .= $T->finish($T->get_var('output'));
$retval .= COM_endBlock(COM_getBlockTemplate('_admin_block', 'footer'));
return $retval;
}
示例2: isLastChild
function isLastChild()
{
$menu = menu::getInstance($this->pid);
$pid = $this->pid;
$children = $menu->menu_elements[$pid]->getChildren();
$arrayIndex = count($children) - 1;
if ($this->id == $children[$arrayIndex]) {
return true;
}
return false;
}