本文整理汇总了PHP中GetMenuTypes函数的典型用法代码示例。如果您正苦于以下问题:PHP GetMenuTypes函数的具体用法?PHP GetMenuTypes怎么用?PHP GetMenuTypes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetMenuTypes函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: BXDeleteFromMenu
function BXDeleteFromMenu($documentRoot, $path, $site)
{
if (!CModule::IncludeModule("fileman"))
return false;
if (!$GLOBALS["USER"]->CanDoOperation("fileman_edit_menu_elements") || !$GLOBALS["USER"]->CanDoOperation("fileman_edit_existent_files"))
return false;
$arMenuTypes = GetMenuTypes($site);
if (empty($arMenuTypes))
return false;
$currentPath = $path;
$result = array();
$io = CBXVirtualIo::GetInstance();
while (true)
{
$currentPath = rtrim($currentPath, "/");
if (strlen($currentPath) <= 0)
{
$currentPath = "/";
$slash = "";
}
else
{
//Find parent folder
$position = strrpos($currentPath, "/");
if ($position === false)
break;
$currentPath = substr($currentPath, 0, $position);
$slash = "/";
}
foreach ($arMenuTypes as $menuType => $menuDesc)
{
$menuFile = $currentPath.$slash.".".$menuType.".menu.php";
if ($io->FileExists($documentRoot.$menuFile) && $GLOBALS["USER"]->CanDoFileOperation("fm_edit_existent_file", Array($site, $menuFile)))
{
$arFound = BXDeleteFromMenuFile($menuFile, $documentRoot, $site, $path);
if ($arFound)
$result[] = $arFound;
}
}
if (strlen($currentPath)<=0)
break;
}
return $result;
}
示例2: GetMessage
if ($createNewFolder && !$io->DirectoryExists($currentFileDir . $fileName) || !$createNewFolder && !$io->FileExists($currentFileDir . $fileName)) {
break;
}
}
$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";
示例3: while
} else {
while ($arSite = $dbSitesList->GetNext()) {
$dir = rtrim($arSite["DIR"], "/");
if (substr($path, 0, strlen($dir)) == $dir) {
$site = $arSite["ID"];
break;
}
}
}
$site = CFileMan::__CheckSite($site);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$arParsedPath = CFileMan::ParsePath(array($site, $path), true, false, "", $logical == "Y");
$menufilename = $path;
$bExists = false;
$arTypes = array();
$armt = GetMenuTypes($site, "left=" . GetMessage("FILEMAN_MENU_EDIT_LEFT_MENU") . ",top=" . GetMessage("FILEMAN_MENU_EDIT_TOP_MENU"));
foreach ($armt as $key => $title) {
if (!$USER->CanDoFileOperation('fm_edit_existent_file', array($site, $path . "/." . $key . ".menu.php"))) {
continue;
}
$arTypes[] = array($key, $title);
if ($key == $name) {
$bExists = true;
}
}
if (!$bExists) {
$name = $arTypes[0][0];
}
if (strlen($name) > 0) {
$menufilename = $path . "/." . $name . ".menu.php";
}
示例4: OnPostForm
function OnPostForm()
{
$wizard =& $this->GetWizard();
$serviceID = $wizard->GetVar("nextStep");
$serviceStage = $wizard->GetVar("nextStepStage");
if ($serviceID == "finish") {
$wizard->SetCurrentStep("finish");
return;
}
$defSiteName = GetMessage("wiz_site_default_name");
if (GetMessage("wiz_site_name") != "") {
$defSiteName = GetMessage("wiz_site_name");
} elseif ($wizard->wizardName != "") {
$defSiteName = $wizard->wizardName;
}
$res = false;
$site_id = $wizard->GetVar("siteID");
if ($site_id != "") {
$db_res = CSite::GetList($by = "sort", $order = "desc", array("LID" => $site_id));
if ($db_res) {
$res = $db_res->Fetch();
}
}
if ($wizard->GetVar("siteCreate") == "Y") {
if (!$res) {
$arFields = array("LID" => $site_id, "ACTIVE" => "Y", "SORT" => 100, "DEF" => "N", "NAME" => $defSiteName, "DIR" => $wizard->GetVar("siteFolder"), "FORMAT_DATE" => LANGUAGE_ID == "en" ? "MM/DD/YYYY" : "DD.MM.YYYY", "FORMAT_DATETIME" => LANGUAGE_ID == "en" ? "MM/DD/YYYY H:MI T" : "DD.MM.YYYY HH:MI:SS", "FORMAT_NAME" => CSite::GetDefaultNameFormat(), "CHARSET" => defined("BX_UTF") ? "UTF-8" : (LANGUAGE_ID == "ru" ? "windows-1251" : "ISO-8859-1"), "SITE_NAME" => $defSiteName, "SERVER_NAME" => $_SERVER["SERVER_NAME"], "EMAIL" => COption::GetOptionString("main", "email_from"), "LANGUAGE_ID" => LANGUAGE_ID, "DOC_ROOT" => "");
$obSite = new CSite();
$result = $obSite->Add($arFields);
if ($result) {
} else {
echo $obSite->LAST_ERROR;
die;
}
}
$wizard->SetVar("siteCreate", "N");
}
$pattern = '/^(.*):(.*)\\((.*)\\)/';
preg_match($pattern, $res["NAME"], $matches);
if ($res && (count($matches) > 0 || $res["NAME"] == $site_id) && $site_id != "s1") {
$templateID = $wizard->GetVar("templateID");
$themeVarName = $templateID . "_themeID";
$themeID = $wizard->GetVar($themeVarName);
$templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
$arTemplates = WizardServices::GetTemplates($templatesPath);
$templatesPath = WizardServices::GetTemplatesPath($wizard->GetPath() . "/site");
$arThemes = WizardServices::GetThemes($templatesPath . "/" . $templateID . "/themes", $templatesPath . "/" . $templateID);
$siteNemNew = $defSiteName . ": " . $arTemplates[$templateID]["NAME"] . ' (' . $arThemes[$themeID]["NAME"] . ')';
$obSite = new CSite();
$result = $obSite->Update($site_id, array("NAME" => $siteNemNew, "SITE_NAME" => $siteNemNew));
} elseif ($res["NAME"] == GetMessage("MAIN_DEFAULT_SITE_NAME")) {
$SiteNAME = $defSiteName . " (" . GetMessage("MAIN_DEFAULT_SITE_NAME") . ")";
$obSite = new CSite();
$result = $obSite->Update($site_id, array("NAME" => $SiteNAME, "SITE_NAME" => $defSiteName));
}
CModule::IncludeModule('fileman');
COption::SetOptionString("fileman", "different_set", "Y");
$arMenuTypes = GetMenuTypes($site_id);
if (count($arMenuTypes) == 0) {
$arMenuTypes = array('left' => GetMessage("WIZ_MENU_LEFT"), 'top' => GetMessage("WIZ_MENU_TOP"), 'bottom' => GetMessage("WIZ_MENU_BOTTOM"));
} else {
if (!$arMenuTypes['left'] || $arMenuTypes['left'] == GetMessage("WIZ_MENU_LEFT_DEFAULT")) {
$arMenuTypes['left'] = GetMessage("WIZ_MENU_LEFT");
}
if (!$arMenuTypes['top'] || $arMenuTypes['top'] == GetMessage("WIZ_MENU_TOP_DEFAULT")) {
$arMenuTypes['top'] = GetMessage("WIZ_MENU_TOP");
}
if (!$arMenuTypes['bottom']) {
$arMenuTypes['bottom'] = GetMessage("WIZ_MENU_BOTTOM");
}
}
SetMenuTypes($arMenuTypes, $site_id);
$arServices = WizardServices::GetServices($_SERVER["DOCUMENT_ROOT"] . $wizard->GetPath(), "/site/services/");
$this->CorrectServices($arServices);
if ($serviceStage == "skip") {
$success = true;
} else {
$success = $this->InstallService($serviceID, $serviceStage);
}
if (!$this->repeatCurrentService) {
list($nextService, $nextServiceStage, $stepsComplete, $status) = $this->GetNextStep($arServices, $serviceID, $serviceStage);
}
if ($nextService == "finish") {
$formName = $wizard->GetFormName();
$response = "window.ajaxForm.StopAjax(); window.ajaxForm.SetStatus('100'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');";
COption::SetOptionString("main", "wizard_first" . substr($wizard->GetID(), 7) . "_" . $wizard->GetVar("siteID"), "Y", false, $siteID);
} else {
$arServiceID = array_keys($arServices);
$lastService = array_pop($arServiceID);
$stepsCount = $arServices[$lastService]["POSITION"];
if (array_key_exists("STAGES", $arServices[$lastService]) && is_array($arServices[$lastService])) {
$stepsCount += count($arServices[$lastService]["STAGES"]) - 1;
}
$percent = round($stepsComplete / $stepsCount * 100);
$response = "window.ajaxForm.SetStatus('" . $percent . "'); window.ajaxForm.Post('" . $nextService . "', '" . $nextServiceStage . "','" . $status . "');";
}
die("[response]" . $response . "[/response]");
}
示例5: GetMenuTypes
function GetMenuTypes($site, $path, $bEchoResult = false)
{
global $USER, $APPLICATION;
if (!CModule::IncludeModule("fileman")) {
return $APPLICATION->ThrowException(GetMessage("BX_FD_NO_FILEMAN"));
}
$path = Rel2Abs("/", $APPLICATION->UnJSEscape($path));
$path = CFileMan::SecurePathVar($path);
$path = rtrim($path, " /\\");
$armt = GetMenuTypes($site);
$arAllItems = array();
$arMenuTypes = array();
$strSelected = "";
$DOC_ROOT = CSite::GetSiteDocRoot($site);
foreach ($armt as $key => $title) {
$menuname = $path . "/." . $key . ".menu.php";
if (!$USER->CanDoFileOperation('fm_view_file', array($site, $menuname))) {
continue;
}
$arItems = array();
$res = CFileMan::GetMenuArray($DOC_ROOT . $menuname);
$aMenuLinksTmp = $res["aMenuLinks"];
$itemcnt = 0;
for ($j = 0; $j < count($aMenuLinksTmp); $j++) {
$aMenuLinksItem = $aMenuLinksTmp[$j];
$arItems[] = htmlspecialcharsbx($aMenuLinksItem[0]);
}
$arAllItems[$key] = $arItems;
if ($strSelected == "") {
$strSelected = $key;
}
$arMenuTypes[] = array('key' => $key, 'title' => $title . " [" . $key . "]");
}
$arTypes = array_keys($arAllItems);
$strTypes = "";
$strItems = "";
for ($i = 0; $i < count($arTypes); $i++) {
if ($i > 0) {
$strTypes .= ",";
$strItems .= ",";
}
$strTypes .= "'" . CUtil::JSEscape($arTypes[$i]) . "'";
$arItems = $arAllItems[$arTypes[$i]];
$strItems .= "[";
for ($j = 0; $j < count($arItems); $j++) {
if ($j > 0) {
$strItems .= ",";
}
$strItems .= "'" . CUtil::JSEscape($arItems[$j]) . "'";
}
$strItems .= "]";
}
$scriptRes = "\n" . 'arFDMenuTypes["' . CUtil::JSEscape($path) . '"] = {types: [' . $strTypes . '], items: [' . $strItems . ']};' . "\n";
if ($bEchoResult) {
echo $scriptRes;
} else {
return array($arMenuTypes, $scriptRes, $arAllItems[$strSelected]);
}
}
示例6: GetMessage
?>
</td>
<td valign="top" width="60%" class="adm-detail-content-cell-r">
<table cellPadding="2" cellSpacing="2" border="0" width="100%">
<tr class="heading">
<td align="center" width="40%"><b><?php
echo GetMessage('FILEMAN_OPTION_MENU_TYPE');
?>
</b></td>
<td align="center" width="60%"><b><?php
echo GetMessage('FILEMAN_OPTION_MENU_NAME');
?>
</b></td>
</tr>
<?php
$armt = GetMenuTypes($siteList[$j]["ID"], "left=" . GetMessage("FILEMAN_OPTION_LEFT_MENU_NAME") . ",top=" . GetMessage("FILEMAN_OPTION_TOP_MENU_NAME"));
$i = 0;
foreach ($armt as $key => $title) {
if ($USER->CanDoOperation('fileman_edit_menu_types')) {
?>
<tr>
<td><input type="text" name="menutypes_<?php
echo htmlspecialcharsbx($siteList[$j]["ID"]);
?>
_<?php
echo $i;
?>
_type" value="<?php
echo htmlspecialcharsbx($key);
?>
" style="width:100%; -moz-box-sizing: border-box; box-sizing: border-box;"></td>
示例7: GetMenuTypes
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (!empty($arResult)) {
?>
<div class="b-menu-category"><?php
if (!empty($arParams['ROOT_MENU_TYPE'])) {
$types = GetMenuTypes();
if (!empty($types[$arParams['ROOT_MENU_TYPE']])) {
?>
<div class="b-menu-category__title"><?php
if (!empty($arParams['TITLE_CLASS'])) {
echo '<i class="ico ' . $arParams['TITLE_CLASS'] . '"></i>';
}
echo $types[$arParams['ROOT_MENU_TYPE']];
?>
</div><?php
}
}
?>
<ul class="b-menu-category__holder"><?php
$previousLevel = 0;
foreach ($arResult as $arItem) {
if ($previousLevel && $arItem['DEPTH_LEVEL'] == 1 && $previousLevel > 1) {
echo '</li>';
}
if ($arItem['IS_PARENT']) {
if ($arItem['DEPTH_LEVEL'] == 1) {
?>
示例8: array
//we have no selected items therefore we should find selection now
if ($arParams["CACHE_SELECTED_ITEMS"] == false) {
$this->setSelectedItems($arParams["ALLOW_MULTI_SELECT"]);
}
//****************
//Icons
//***************
if ($USER->IsAuthorized()) {
$menuExists = $menuDir != '';
$bFileman = $USER->CanDoOperation('fileman_add_element_to_menu') && $USER->CanDoOperation('fileman_edit_menu_elements');
$bMenuAdd = $bFileman && ($curDir != $menuDir || !$menuExists);
// fm_create_new_file is checked later
$bMenuEdit = $bFileman && $menuExists && $USER->CanDoFileOperation('fm_edit_existent_file', array(SITE_ID, $menuDir . "." . $menuType . ".menu.php"));
$bMenuDelete = $bFileman && $curDir == $menuDir && $USER->CanDoFileOperation('fm_delete_file', array(SITE_ID, $menuDir . "." . $menuType . ".menu.php"));
if ($bMenuAdd || $bMenuEdit || $bMenuDelete) {
$arMenuTypes = GetMenuTypes(SITE_ID);
$bDefaultItem = $curDir == "/" && $menuType == "top" || $curDir != "/" && $menuType == "left";
$buttonID = "menus";
}
if ($bMenuAdd) {
$bMenuAdd = false;
$currentAddDir = $curDir;
while ($currentAddDir != '') {
$currentAddDir = rtrim($currentAddDir, "/");
if (is_dir($_SERVER["DOCUMENT_ROOT"] . $currentAddDir) && $USER->CanDoFileOperation('fm_create_new_file', array(SITE_ID, $currentAddDir . "/." . $menuType . ".menu.php"))) {
$bMenuAdd = true;
$menuDirAdd = $currentAddDir;
break;
}
$position = strrpos($currentAddDir, "/");
if ($position === false) {
示例9: GetMenuTypes
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
if (WIZARD_INSTALL_DEMO_DATA) {
$arMenuTypes = GetMenuTypes();
$arMenuTypes["bottom1"] = GetMessage("MAIN_OPT_MENU_BOTTOM_R");
$arMenuTypes["bottom2"] = GetMessage("MAIN_OPT_MENU_BOTTOM_I");
SetMenuTypes($arMenuTypes, WIZARD_SITE_ID);
}
示例10: GetMenuTypes
<?php
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
die;
}
CModule::IncludeModule('fileman');
$arMenuTypes = GetMenuTypes(WIZARD_SITE_ID);
if ($arMenuTypes['left'] && $arMenuTypes['left'] == GetMessage("WIZ_MENU_LEFT_DEFAULT")) {
$arMenuTypes['left'] = GetMessage("WIZ_MENU_LEFT");
}
SetMenuTypes($arMenuTypes, WIZARD_SITE_ID);