當前位置: 首頁>>代碼示例>>PHP>>正文


PHP menu::getInstance方法代碼示例

本文整理匯總了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;
}
開發者ID:spacequad,項目名稱:glfusion,代碼行數:49,代碼來源:menu.php

示例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;
 }
開發者ID:spacequad,項目名稱:glfusion,代碼行數:11,代碼來源:menu.class.php


注:本文中的menu::getInstance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。