Exemplo n.º 1
0
	static public function buildMenu($arParams)
	{
		if (!empty(self::$arItems))
			return self::$arItems;

		if (isset($arParams["MENU_FILE"]))
		{
			$arMobileMenuItems = array();

			require($_SERVER["DOCUMENT_ROOT"] . $arParams["MENU_FILE"]);

			if (!empty($arMobileMenuItems))
				foreach ($arMobileMenuItems as $arItem)
					self::addItem($arItem);
		}

		if (isset($arParams["EVENT_NAME"]))
		{
			foreach (GetModuleEvents("mobileapp", $arParams["EVENT_NAME"], true) as $arHandler)
				ExecuteModuleEventEx($arHandler);
		}

		CAdminMobilePush::OnAdminMobileGetPushSettings();

		sortByColumn(self::$arItems, "sort");

		return self::$arItems;
	}
Exemplo n.º 2
0
CComponentUtil::__IncludeLang(dirname($_SERVER["SCRIPT_NAME"]), "/ajax.php");
if (!CModule::IncludeModule('mobileapp')) {
    die(GetMessage('SMODE_MOBILEAPP_NOT_INSTALLED'));
}
$arResult = array();
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
    $action = isset($_REQUEST['action']) ? trim($_REQUEST['action']) : '';
    switch ($action) {
        case "save_options":
            $path = isset($_REQUEST['path']) ? trim($_REQUEST['path']) : '';
            $arOptions = isset($_REQUEST['options']) ? $_REQUEST['options'] : array();
            foreach (GetModuleEvents("mobileapp", "OnBeforeAdminMobilePushOptsSave", true) as $arHandler) {
                ExecuteModuleEventEx($arHandler, array($USER->GetID(), $path, &$arOptions));
            }
            if (!empty($arOptions)) {
                if (!CAdminMobilePush::saveOptions($path, $arOptions)) {
                    $arResult["ERROR"] = GetMessage("MOBILE_APP_PUSH_SAVE_OPTS_ERROR");
                }
            }
            break;
    }
} else {
    $arResult["ERROR"] = GetMessage("MOBILE_APP_PUSH_ACCESS_DENIED");
}
if (isset($arResult["ERROR"])) {
    $arResult["RESULT"] = "ERROR";
} else {
    $arResult["RESULT"] = "OK";
}
$arResult = $APPLICATION->ConvertCharsetArray($arResult, SITE_CHARSET, 'utf-8');
die(json_encode($arResult));
Exemplo n.º 3
0
<?php

if (!Defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arResult = array("CURRENT_PAGE" => $APPLICATION->GetCurPage(), "AJAX_URL" => $componentPath . "/ajax.php");
$arResult["PATH"] = isset($_REQUEST["path"]) ? $_REQUEST["path"] : '';
$arResult["DATA"] = CAdminMobilePush::getData($arResult["PATH"]);
CJSCore::Init('ajax');
$this->IncludeComponentTemplate();
Exemplo n.º 4
0
<?php

if (!Defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
$arItems = array();
$arTmp = array();
if ($arResult["DATA"]["TYPE"] == "OPTIONS_SECTION") {
    $optionsData = CAdminMobilePush::getOptions($arResult["PATH"]);
    foreach ($arResult["DATA"]["OPTIONS"] as $option) {
        if (isset($optionsData[$option["ID"]])) {
            $checked = $optionsData[$option["ID"]] == 'Y';
        } elseif (isset($option["DEFAULT"])) {
            $checked = $option["DEFAULT"];
        } else {
            $checked = false;
        }
        $arItems[] = array("TITLE" => $option["TITLE"], "VALUE" => $option["ID"], "NAME" => "OPTIONS[]", "TYPE" => "CHECKBOX", "CHECKED" => $checked);
    }
} elseif ($arResult["DATA"]["TYPE"] == "SECTIONS_SECTION") {
    foreach ($arResult["DATA"]["SECTIONS"] as $sectId => $section) {
        $path = $sectId;
        if (strlen($arResult["PATH"]) > 0) {
            $path = $arResult["PATH"] . '/' . $path;
        }
        $path = urlencode($path);
        $sectionLink = CHTTP::urlAddParams($arResult["CURRENT_PAGE"], array("path" => $path));
        $arItems[] = array("TYPE" => "CUSTOM", "HTML_DATA" => '<ul>' . '<li id="push_section_' . $sectId . '">' . '<a href="?path=' . $path . '">' . $section["TITLE"] . '</a>' . '</li>' . '</ul>' . '<script type="text/javascript">' . 'BX.ready(function(){ mappPush.makeFastButton("push_section_' . $sectId . '", "' . $sectionLink . '");});' . '</script>');
    }
}
$arData[] = array("TYPE" => "BLOCK", "TITLE" => $arResult["DATA"]["TITLE"], "DATA" => $arItems);