本文整理汇总了PHP中CFileMan::SaveMenu方法的典型用法代码示例。如果您正苦于以下问题:PHP CFileMan::SaveMenu方法的具体用法?PHP CFileMan::SaveMenu怎么用?PHP CFileMan::SaveMenu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileMan
的用法示例。
在下文中一共展示了CFileMan::SaveMenu方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DEMO_Sale_AddMenuItem
function DEMO_Sale_AddMenuItem($menuFile, $menuItem)
{
if (CModule::IncludeModule('fileman')) {
$arResult = CFileMan::GetMenuArray($_SERVER["DOCUMENT_ROOT"] . $menuFile);
$arMenuItems = $arResult["aMenuLinks"];
$menuTemplate = $arResult["sMenuTemplate"];
$bFound = false;
foreach ($arMenuItems as $item) {
if ($item[1] == $menuItem[1]) {
$bFound = true;
}
}
if (!$bFound) {
$arMenuItems[] = $menuItem;
CFileMan::SaveMenu(array($arParams["site_id"], $menuFile), $arMenuItems, $menuTemplate);
}
}
}
示例2: rtrim
$relativePath = rtrim($path, "/") . "/" . $fileName . ($createNewFolder ? "/" : "");
//Save menu
if ($addToMenu && array_key_exists($menuType, $arMenu) && CModule::IncludeModule("fileman")) {
$menuFile = $arMenu[$menuType]["ACTUAL_FILE"];
$arResult = CFileMan::GetMenuArray($documentRoot . $menuFile);
$arMenuItems = $arResult["aMenuLinks"];
$menuTemplate = $arResult["sMenuTemplate"];
if ($menuItemPosition > count($arMenuItems)) {
$menuItemPosition = 0;
}
//move to the right all items greater current item
for ($i = count($arMenuItems) - 1; $i >= $menuItemPosition; $i--) {
$arMenuItems[$i + 1] = $arMenuItems[$i];
}
$arMenuItems[$menuItemPosition] = array($menuName, $relativePath, array(), array(), "");
CFileMan::SaveMenu(array($site, $menuFile), $arMenuItems, $menuTemplate);
$arUndoParams['arContent']['menu'] = array('menuFile' => $menuFile, 'menuName' => $menuName, 'menuPath' => $relativePath);
if (COption::GetOptionString($module_id, "log_page", "Y") == "Y") {
$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
$mt = unserialize(str_replace("\\", "", $mt));
$res_log['menu_name'] = $mt[$menuType];
$res_log['path'] = substr(dirname($arUndoParams['arContent']['path']), 1);
CEventLog::Log("content", "MENU_EDIT", "main", "", serialize($res_log));
}
}
$ID = CUndo::Add($arUndoParams);
CUndo::ShowUndoMessage($ID);
$pathToEdit = $relativePath . ($createNewFolder ? "index.php" : "");
if (!$USER->CanDoFileOperation("fm_edit_existent_file", array($site, $pathToEdit))) {
$canEditNewPage = false;
}
示例3: GetMessage
$aMenuSort[$j] = $tmpSort;
}
}
}
//теперь $aMenuLinksTmp прямо в таком готовом виде, что хоть меню рисуй :-)
}
if ($REQUEST_METHOD == "POST" && strlen($save) > 0 && strlen($name) <= 0 && check_bitrix_sessid()) {
$strWarning = GetMessage("FILEMAN_MENU_EDIT_ENTER_TYPE");
} elseif (strlen($new) > 0 && strlen($name) > 0 && $io->FileExists($abs_path) && check_bitrix_sessid()) {
$strWarning = GetMessage("FILEMAN_MENU_EDIT_EXISTS_ERROR");
$bEdit = false;
$abs_path = $DOC_ROOT . $path;
}
if (strlen($strWarning) <= 0) {
if ($REQUEST_METHOD == "POST" && strlen($save) > 0 && is_array($ids) && check_bitrix_sessid()) {
CFileMan::SaveMenu(array($site, $menufilename), $aMenuLinksTmp, $sMenuTemplateTmp);
$bEdit = true;
$module_id = "fileman";
if (COption::GetOptionString($module_id, "log_menu", "Y") == "Y") {
$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
$mt = unserialize(str_replace("\\", "", $mt));
$res_log['menu_name'] = $mt[$name];
$res_log['path'] = substr($path, 1);
if (strlen($new) <= 0) {
CEventLog::Log("content", "MENU_EDIT", "fileman", "", serialize($res_log));
} else {
CEventLog::Log("content", "MENU_ADD", "fileman", "", serialize($res_log));
}
}
if (strlen($apply) <= 0) {
if (strlen($back_url) > 0) {
示例4: UndoNewSection
function UndoNewSection($Params, $type)
{
$io = CBXVirtualIo::GetInstance();
if (strlen($Params['path']) > 0 && $Params['path'] != "/" && $io->DirectoryExists($Params['absPath'])) {
CFileman::DeleteEx(array($Params['site'], $Params['path']));
}
$documentRoot = CSite::GetSiteDocRoot($Params['site']);
// Find and clean file from menu
if ($Params['menu']) {
$arMenu = CFileman::GetMenuArray($documentRoot . $Params['menu']['menuFile']);
if (!empty($arMenu["aMenuLinks"])) {
$found = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem) {
if ($arItem[1] == $Params['menu']['menuPath'] && $arItem[0] == $Params['menu']['menuName']) {
unset($arMenu["aMenuLinks"][$menuIndex]);
$found = true;
break;
}
}
if ($found) {
CFileMan::SaveMenu(array($Params['site'], $Params['menu']['menuFile']), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
}
}
}
}
示例5: AddMenuItem
private function AddMenuItem()
{
//Add menu Item
$MenuFolderPath = $this->IO->CombinePath("/", '/services/');
$MenuFilePath = $this->IO->CombinePath($MenuFolderPath, ".left.menu.php");
$AbsMenuFilePath = $this->IO->CombinePath($this->DOCUMENT_ROOT, $MenuFilePath);
if ($this->IO->FileExists($AbsMenuFilePath)) {
$MenuResource = CFileMan::GetMenuArray($AbsMenuFilePath);
$arMenuItems = $MenuResource["aMenuLinks"];
$bAddMenuItem = true;
foreach ($arMenuItems as $MenuItem) {
if (in_array($MenuItem[1], array($this->PublicDir, $this->PublicDir . "index.php"))) {
$bAddMenuItem = false;
break;
}
}
if ($bAddMenuItem) {
$arMenuItems[] = array(GetMessage("IDEA_PUBLIC_FILE_MENU_TITLE"), $this->PublicDir, array(), array(), "CBXFeatures::IsFeatureEnabled('Idea')");
CFileMan::SaveMenu(array($this->SITE_ID, $MenuFilePath), $arMenuItems, "");
}
}
}
示例6: AddMenuItem
function AddMenuItem($menuFile, $menuItem, $siteID, $pos = -1)
{
if (CModule::IncludeModule('fileman')) {
$arResult = CFileMan::GetMenuArray($_SERVER["DOCUMENT_ROOT"] . $menuFile);
$arMenuItems = $arResult["aMenuLinks"];
$menuTemplate = $arResult["sMenuTemplate"];
$bFound = false;
foreach ($arMenuItems as $item) {
if ($item[1] == $menuItem[1]) {
$bFound = true;
}
}
if (!$bFound) {
if ($pos < 0 || $pos >= count($arMenuItems)) {
$arMenuItems[] = $menuItem;
} else {
for ($i = count($arMenuItems); $i > $pos; $i--) {
$arMenuItems[$i] = $arMenuItems[$i - 1];
}
$arMenuItems[$pos] = $menuItem;
}
CFileMan::SaveMenu(array($siteID, $menuFile), $arMenuItems, $menuTemplate);
}
}
}
示例7: BXDeleteFromMenuFile
function BXDeleteFromMenuFile($menuFile, $documentRoot, $site, $path)
{
$aMenuLinks = Array();
$arMenu = CFileman::GetMenuArray($documentRoot.$menuFile);
if (empty($arMenu["aMenuLinks"]))
return false;
$arFound = false;
foreach ($arMenu["aMenuLinks"] as $menuIndex => $arItem)
{
if (!isset($arItem[1]))
continue;
$menuLink = $arItem[1];
$position = strpos($menuLink, "?");
if ($position !== false)
$menuLink = substr($menuLink, 0, $position);
if ($menuLink != "/")
$menuLink = rtrim($menuLink, "/");
$filename = basename($path);
$dirName = str_replace("\\", "/", dirname($path));
if ($menuLink == $path || ($filename == "index.php" && $menuLink == $dirName))
{
$arFound = array(
'menuFile' => $menuFile,
'menuIndex' => $menuIndex,
'menuItem' => $arItem
);
unset($arMenu["aMenuLinks"][$menuIndex]);
}
}
if ($arFound)
{
CFileMan::SaveMenu(Array($site, $menuFile), $arMenu["aMenuLinks"], $arMenu["sMenuTemplate"]);
if(COption::GetOptionString("fileman", "log_page", "Y")=="Y")
{
$res_log = array();
$mt = COption::GetOptionString("fileman", "menutypes", $default_value, $site);
$mt = unserialize(str_replace("\\", "", $mt));
$res_log['menu_name'] = $mt[$menuType];
$res_log['path'] = substr($dirName, 1);
CEventLog::Log(
"content",
"MENU_EDIT",
"main",
"",
serialize($res_log)
);
}
}
return $arFound;
}