本文整理汇总了PHP中CMenu::Init方法的典型用法代码示例。如果您正苦于以下问题:PHP CMenu::Init方法的具体用法?PHP CMenu::Init怎么用?PHP CMenu::Init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMenu
的用法示例。
在下文中一共展示了CMenu::Init方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChildMenuRecursive
public function getChildMenuRecursive(&$arMenu, &$arResult, $menuType, $use_ext, $menuTemplate, $currentLevel, $maxLevel, $bMultiSelect, $bCheckSelected)
{
if ($currentLevel > $maxLevel) {
return;
}
for ($menuIndex = 0, $menuCount = count($arMenu); $menuIndex < $menuCount; $menuIndex++) {
//Menu from iblock (bitrix:menu.sections)
if (is_array($arMenu[$menuIndex]["PARAMS"]) && isset($arMenu[$menuIndex]["PARAMS"]["FROM_IBLOCK"])) {
$iblockSectionLevel = intval($arMenu[$menuIndex]["PARAMS"]["DEPTH_LEVEL"]);
if ($currentLevel > 1) {
$iblockSectionLevel = $iblockSectionLevel + $currentLevel - 1;
}
$arResult[] = $arMenu[$menuIndex] + array("DEPTH_LEVEL" => $iblockSectionLevel, "IS_PARENT" => $arMenu[$menuIndex]["PARAMS"]["IS_PARENT"]);
continue;
}
//Menu from files
$subMenuExists = false;
if ($currentLevel < $maxLevel) {
//directory link only
$bDir = false;
if (!preg_match("'^(([a-z]+://)|mailto:|javascript:)'i", $arMenu[$menuIndex]["LINK"])) {
if (substr($arMenu[$menuIndex]["LINK"], -1) == "/") {
$bDir = true;
}
}
if ($bDir) {
$menu = new CMenu($menuType);
$menu->disableDebug();
$success = $menu->Init($arMenu[$menuIndex]["LINK"], $use_ext, $menuTemplate, $onlyCurrentDir = true);
$subMenuExists = $success && count($menu->arMenu) > 0;
if ($subMenuExists) {
$menu->RecalcMenu($bMultiSelect, $bCheckSelected);
$arResult[] = $arMenu[$menuIndex] + array("DEPTH_LEVEL" => $currentLevel, "IS_PARENT" => count($menu->arMenu) > 0);
if ($arMenu[$menuIndex]["SELECTED"]) {
$arResult["menuType"] = $menuType;
$arResult["menuDir"] = $arMenu[$menuIndex]["LINK"];
}
if (count($menu->arMenu) > 0) {
$this->GetChildMenuRecursive($menu->arMenu, $arResult, $menuType, $use_ext, $menuTemplate, $currentLevel + 1, $maxLevel, $bMultiSelect, $bCheckSelected);
}
}
}
}
if (!$subMenuExists) {
$arResult[] = $arMenu[$menuIndex] + array("DEPTH_LEVEL" => $currentLevel, "IS_PARENT" => false);
}
}
}
示例2: GetMessage
}
$pageTitle = GetMessage("PAGE_NEW_DEFAULT_TITLE") . ($fileNumber != "" ? " (" . $fileNumber . ")" : "");
$editAfterSave = true;
$addToMenu = true;
$menuName = "";
$menuType = false;
$menuItemPosition = -1;
$pageTags = "";
}
//Get Menu
$arMenu = array();
if (IsModuleInstalled("fileman") && $USER->CanDoOperation("fileman_add_element_to_menu")) {
$arMenuTypes = GetMenuTypes($site);
foreach ($arMenuTypes as $type => $name) {
$menu = new CMenu($type);
$menu->Init($path);
$actualDir = $menu->MenuDir;
$currentDir = rtrim($path, "/") . "/";
if (strlen($actualDir) > 0) {
$actualMenuFile = $actualDir . "." . $type . ".menu.php";
$fileOperation = $io->FileExists($documentRoot . $actualMenuFile) ? "fm_edit_existent_file" : "fm_create_new_file";
if (!$USER->CanDoFileOperation("fm_add_to_menu", array($site, $actualMenuFile)) || !$USER->CanDoFileOperation($fileOperation, array($site, $actualMenuFile))) {
$actualDir = false;
}
} else {
$actualDir = false;
}
$currentMenuFile = $currentDir . "." . $type . ".menu.php";
$fileOperation = $io->FileExists($documentRoot . $currentMenuFile) ? "fm_edit_existent_file" : "fm_create_new_file";
if (!$USER->CanDoFileOperation('fm_add_to_menu', array($site, $currentMenuFile)) || !$USER->CanDoFileOperation($fileOperation, array($site, $currentMenuFile))) {
$currentDir = false;
示例3: GetMenu
function GetMenu($type = "left", $bMenuExt = false, $template = false, $sInitDir = false)
{
$menu = new CMenu($type);
if ($sInitDir === false) {
$sInitDir = $this->GetCurDir();
}
if (!$menu->Init($sInitDir, $bMenuExt, $template)) {
$menu->MenuDir = $sInitDir;
}
return $menu;
}
示例4: isset
}
//Include menu_ext.php
$arParams["USE_EXT"] = isset($arParams["USE_EXT"]) && $arParams["USE_EXT"] == "Y" ? true : false;
$arParams["DELAY"] = isset($arParams["DELAY"]) && $arParams["DELAY"] == "Y" ? "Y" : "N";
//Allow multiple highlightning of current item in menu
$arParams["ALLOW_MULTI_SELECT"] = $arParams["ALLOW_MULTI_SELECT"] == "Y";
//Find current menu item in RecalcMenu(). Cach ID depends on this parameter too
$arParams["CACHE_SELECTED_ITEMS"] = $arParams["CACHE_SELECTED_ITEMS"] != "N" && $arParams["CACHE_SELECTED_ITEMS"] !== false;
$curDir = $APPLICATION->GetCurDir();
if ($this->startResultCache(false, false, $arParams["MENU_CACHE_USE_USERS"] === "Y" ? $this->getGenerationCachePath($USER->GetID()) : false)) {
if (defined("BX_COMP_MANAGED_CACHE")) {
$CACHE_MANAGER->registerTag("bitrix:menu");
}
//Read root menu
$menu = new CMenu($arParams["ROOT_MENU_TYPE"]);
$menu->Init($curDir, $arParams["USE_EXT"], $componentPath . "/stub.php");
$menu->RecalcMenu($arParams["ALLOW_MULTI_SELECT"], $arParams["CACHE_SELECTED_ITEMS"]);
$arResult = array();
//Read child menu recursive
if ($arParams["MAX_LEVEL"] > 1) {
$this->getChildMenuRecursive($menu->arMenu, $arResult, $arParams["CHILD_MENU_TYPE"], $arParams["USE_EXT"], $menu->template, $currentLevel = 1, $arParams["MAX_LEVEL"], $arParams["ALLOW_MULTI_SELECT"], $arParams["CACHE_SELECTED_ITEMS"]);
if ($arParams["SHOW_LAST_LEVEL_BUTTONS"] != "Y") {
$arResult["menuDir"] = $menu->MenuDir;
$arResult["menuType"] = $menu->type;
} else {
$arResult["initMenuDir"] = $menu->MenuDir;
$arResult["initMenuType"] = $menu->type;
}
} else {
$arResult = $menu->arMenu;
$arResult["menuDir"] = $menu->MenuDir;