<?php
//
// Формирование меню "Еще..."
//
// Дата модификации: 27-мая-2019
//
// Особенности:
// - Подключен раздел "Голосовые ассистенты Алиса и Google Assistant"
use Bitrix\Main;
use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\MobileApp\Mobile;
use Bitrix\Intranet\AI;
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
{
die();
}
global $USER;
/**
* @var $USER CAllUser
* @var $this \Bitrix\MobileApp\Janative\Entity\Component
*/
// разрешенные фичи
$allowedFeatures = [];
// возвращает сообщение
$hereDocGetMessage = function ($code) {
return Loc::getMessage($code);
};
// если модуль "Соц. сеть/группы" активирован, то...
if (CModule::IncludeModule("socialnetwork"))
{
// получаем список фич юзера
$arUserActiveFeatures = CSocNetFeatures::getActiveFeatures(SONET_ENTITY_USER, $USER->getId());
// получаем список фич юзера, касающихся соц. сети/групп
$arSocNetFeaturesSettings = CSocNetAllowed::getAllowedFeatures();
// инициазирируем массив...
$allowedFeatures = [];
// пробегаем цикл по фичам....
foreach (["tasks", "files", "calendar"] as $feature)
{
//если фича -- "календарь"
if (in_array($feature, ['calendar']))
{
//
$allowedFeatures[$feature] =
array_key_exists($feature, $arSocNetFeaturesSettings) &&
array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) &&
(
(
in_array(SONET_ENTITY_USER, $arSocNetFeaturesSettings[$feature]["allowed"]) &&
is_array($arUserActiveFeatures) &&
in_array($feature, $arUserActiveFeatures)
)
|| in_array(SONET_ENTITY_GROUP, $arSocNetFeaturesSettings[$feature]["allowed"])
);
}
else
{
$allowedFeatures[$feature] =
array_key_exists($feature, $arSocNetFeaturesSettings) &&
array_key_exists("allowed", $arSocNetFeaturesSettings[$feature]) &&
in_array(SONET_ENTITY_USER, $arSocNetFeaturesSettings[$feature]["allowed"]) &&
is_array($arUserActiveFeatures) &&
in_array($feature, $arUserActiveFeatures);
}
}
}
// экстранет-юзер?
$isExtranetUser = (\CModule::includeModule("extranet") && !\CExtranet::isIntranetUser());
// доступен ли Диск?
$diskEnabled = \Bitrix\Main\Config\Option::get('disk', 'successfully_converted', false) && CModule::includeModule('disk');
// получаем ид юзера
$userId = $USER->getId();
// определяем адрес корневой папки портала
$siteDir = SITE_DIR;
//если Экстранет-юзер...
if ($isExtranetUser)
{
// получаем ид экстренет-сайта
$extranetSiteId = CExtranet::GetExtranetSiteID();
if ($extranetSiteId)
{
// получаем набор фич экстренет-сайта
$res = \CSite::getById($extranetSiteId);
// получаем поля...
if (
($extranetSiteFields = $res->fetch())
&& ($extranetSiteFields["ACTIVE"] != "N")
)
{
// заполняем адрес каталога ...
$siteDir = $extranetSiteFields["DIR"];
}
}
}
// получаем путь к картинкам...
$imageDir = $this->getPath() . "/images/";
// может ли юзер приглашать других?
$canInviteUsers = (IsModuleInstalled("bitrix24") && $USER->CanDoOperation('bitrix24_invite')) ? "1" : "0";
// путь к польз. компоненту
$userComponentPath = \Bitrix\MobileApp\Janative\Manager::getComponentPath("users");
/*
* Tasks
* */
$newTaskListIsAllowed = ((Mobile::getPlatform() == "ios" && Mobile::getSystemVersion() < 11) || Mobile::getApiVersion() < 28) ? "false" : "true";
$isOpenlinesOperator = \Bitrix\Main\Loader::includeModule('im') && \Bitrix\Im\Integration\Imopenlines\User::isOperator();
$taskComponentPath = \Bitrix\MobileApp\Janative\Manager::getComponentPath("tasks.list");
$diskComponentVersion = \Bitrix\MobileApp\Janative\Manager::getComponentVersion("user.disk");
$showTasks = $isOpenlinesOperator && \Bitrix\Main\ModuleManager::isModuleInstalled('tasks') && $allowedFeatures["tasks"];
// готовим параметры задач в формате JSON для списка задач
$taskParams = json_encode([
"COMPONENT_CODE" => "tasks.list",
"USER_ID" => $USER->GetId(),
"SITE_ID" => SITE_ID,
"LANGUAGE_ID" => LANGUAGE_ID,
"SITE_DIR" => SITE_DIR,
"PATH_TO_TASK_ADD" => "/mobile/tasks/snmrouter/?routePage=#action#&TASK_ID=#taskId#",
"MESSAGES" => [
]
]);
// Было по умолчанию название раздела "ИЗБРАННОЕ", переименовал в "ОСНОВНОЕ"
$menuStructure = [
[
"title" => 'ОСНОВНОЕ', //Loc::getMessage("MB_SEC_FAVORITE"),
"hidden" => false, // скрытый элемент или нет, да/нет
"sort" => 100, // сортировка
"items" => [
[
"title" => Loc::getMessage("MB_TASKS_MAIN_MENU_ITEM"), // ** Задачи
"imageUrl" => $imageDir . "favorite/icon-tasks.png", // урл иконки
"color" => "#fabb3f", // цвет
"actions" => [
[
"title" => Loc::getMessage("MORE_ADD"), // еще...
"identifier" => "add", // ид
"color" => "#7CB316" // цвет
]
],
"attrs" => [ // атрибуты
"actionOnclick" => <<<JS
PageManager.openPage({url:"/mobile/tasks/snmrouter/?routePage=edit&USER_ID="+$userId+"&TASK_ID=0", cache:false, modal:true, data:{ modal:"Y"}});
JS
, "onclick" => <<<JS
let newTaskAllowed = $newTaskListIsAllowed;
if(newTaskAllowed)
{
TaskView.open({
params:$taskParams,
path:"$taskComponentPath"
});
}
else
{
PageManager.openPage({url:"mobile/tasks/snmrouter/?routePage=roles"})
}
JS
, "id" => "tasks_list",
"counter" => "tasks_total",
],
"counter" => [
"id" => "menu-counter-tasks_total", // ид счетчика
],
"hidden" => !$showTasks, // скрытый или нет
],
[
"title" => Loc::getMessage("MB_BP_MAIN_MENU_ITEM"), // ** Бизнес-процессы
"imageUrl" => $imageDir . "favorite/icon-bp.png",
"color" => "#33c3bd",
"attrs" => [
"url" => $siteDir . "mobile/bp/?USER_STATUS=0", // урл к мобильным бп...
"id" => "bp_list", // ид
"counter" => "bp_tasks", // счетчик
],
"hidden" => ($isExtranetUser || !\Bitrix\Main\ModuleManager::isModuleInstalled("bizproc")), // скрытый или нет
],
[
"title" => Loc::getMessage("MB_CALENDAR_LIST"), // ** Календари
"imageUrl" => $imageDir . "favorite/icon-calendar.png",
"color" => "#F5A200",
"actions" => [
[
"title" => Loc::getMessage("MORE_ADD"),
"identifier" => "add",
"color" => "#7CB316"
]
],
"attrs" => [
"actionOnclick" => <<<JS
PageManager.openPage({url:"/mobile/calendar/edit_event.php", modal:true, data:{ modal:"Y"}});
JS
, "onclick" => <<<JS
PageManager.openList(
{
url:"/mobile/?mobile_action=calendar&user_id="+$userId,
table_id:"calendar_list",
table_settings:
{
showTitle:"YES",
name:"{$hereDocGetMessage("MB_CALENDAR_LIST")}",
useTagsInSearch:"NO",
button:{
type: 'plus',
eventName:"onCalendarEventAddButtonPushed"
}
}
});
if(typeof calendarEventAttached == "undefined")
{
calendarEventAttached = true;
BX.addCustomEvent("onCalendarEventAddButtonPushed", ()=>{
PageManager.openPage({url:"/mobile/calendar/edit_event.php", modal:true, data:{ modal:"Y"}});
});
}
JS
],
"hidden" => !(\Bitrix\Main\ModuleManager::isModuleInstalled('calendar') && !$isExtranetUser && $allowedFeatures["calendar"]), // скрытый или нет
],
[
"title" => Loc::getMessage("MB_CURRENT_USER_FILES_MAIN_MENU_ITEM_NEW"), // ** Файлы (Диск)
"imageUrl" => $imageDir . "favorite/icon-mydisk.png",
"color" => "#20A1E7",
"attrs" => [ // кейс 1
"onclick" => <<<JS
if(Application.getApiVersion() >= 28)
{
ComponentHelper.openList({
name:"user.disk",
object:"list",
version:"{$diskComponentVersion}",
componentParams:{userId: env.userId},
widgetParams:{title:"{$hereDocGetMessage("MB_CURRENT_USER_FILES_MAIN_MENU_ITEM_NEW")}"}
});
}
else
{
PageManager.openList(
{
url:"/mobile/?mobile_action=disk_folder_list&type=user&path=/&entityId="+$userId,
table_settings:
{
showTitle:"YES",
name: "{$hereDocGetMessage("MB_CURRENT_USER_FILES_MAIN_MENU_ITEM_NEW")}",
useTagsInSearch:"NO",
type:"files",
}
});
}
JS
, "id" => "doc_user"
],
"hidden" => !$diskEnabled || !$allowedFeatures["files"], // скрытый или нет
"id" => "doc_user",
],
[
"title" => Loc::getMessage("MB_CURRENT_USER_FILES_MAIN_MENU_ITEM_NEW"), // ** Файлы (Диск)
"imageUrl" => $imageDir . "favorite/icon-mydisk.png",
"color" => "#20A1E7",
"attrs" => [ // кейс 2
"url" => '/mobile/?mobile_action=disk_folder_list&type=user&path=/&entityId=' . $USER->GetID(),
"table_settings" => [
"useTagsInSearch" => "NO",
"type" => "files"
],
"_type" => "list",
"id" => "doc_user",
],
"hidden" => $diskEnabled || !$allowedFeatures["files"], // скрытый или нет
],
[
"imageUrl" => $imageDir . "favorite/icon-users.png",
"color" => "#AF9245",
"title" => Loc::getMessage($isExtranetUser ? "MB_CONTACTS" : "MB_COMPANY"), // Пользователи (Контакты, для экстранет-юзера)
"attrs" => [ // проверка версии API и формирование списка в зависимости от немера версии...
"onclick" => <<<JS
if(Application.getApiVersion() >= 22)
{
PageManager.openComponent(
"JSComponentList",
{
title:"{$hereDocGetMessage($isExtranetUser ? "MB_CONTACTS" : "MB_COMPANY")}",
settings:{useSearch:true},
scriptPath:"$userComponentPath",
params:{
canInvite: {$canInviteUsers},
userId:{$userId}
}
});
}
else
{
PageManager.openList({
url:"/mobile/?mobile_action=get_user_list&tags=Y&detail_url=/mobile/users/?user_id=",
table_settings: {
showTitle:"YES",
name:"{$hereDocGetMessage($isExtranetUser ? "MB_CONTACTS" : "MB_COMPANY")}",
type:"users",
alphabet_index: "YES",
outsection: "NO"
}
});
}
JS
],
],
[
"imageUrl" => $imageDir . "favorite/icon-disk.png",
"color" => "#3CD162",
"title" => Loc::getMessage("MB_SHARED_FILES_MAIN_MENU_ITEM_NEW"), // ** Общие файлы
"attrs" => [ // case 1
"onclick" => <<<JS
if(Application.getApiVersion() >= 28)
{
ComponentHelper.openList({
name:"user.disk",
object:"list",
version:"{$diskComponentVersion}",
componentParams:{userId: env.userId, ownerId: "shared_files_s1", entityType:"common"},
widgetParams:{title:"{$hereDocGetMessage("MB_SHARED_FILES_MAIN_MENU_ITEM_NEW")}"}
});
}
else
{
PageManager.openList(
{
url:"/mobile/?mobile_action=disk_folder_list&type=common&path=/&entityId=shared_files_s1",
table_settings:
{
name:"{$hereDocGetMessage("MB_SHARED_FILES_MAIN_MENU_ITEM_NEW")}",
showTitle:"YES",
useTagsInSearch:"NO",
type:"files",
}
});
}
JS
, "id" => "doc_shared"
],
"hidden" => !$diskEnabled || $isExtranetUser || !$allowedFeatures["files"],
],
[
"title" => Loc::getMessage("MB_SHARED_FILES_MAIN_MENU_ITEM_NEW"),
"imageUrl" => $imageDir . "favorite/icon-disk.png",
"color" => "#b9bdc3",
"attrs" => [ // case 2
"onclick" => <<<JS
PageManager.openList(
{
url:"/mobile/?mobile_action=disk_folder_list&type=common&path=/&entityId=shared_files_s1",
table_settings:
{
useTagsInSearch:"NO",
type:"files",
}
});
JS
, "id" => "doc_shared"
],
"hidden" => $diskEnabled || $isExtranetUser || !$allowedFeatures["files"],
],
]
]
];
/**
* Marketplace apps
*/
if (CModule::IncludeModule("rest"))
{
$arMenuApps = [];
$arUserGroupCode = $USER->GetAccessCodes();
$numLocalApps = 0;
$dbApps = \Bitrix\Rest\AppTable::getList([
'order' => ["ID" => "ASC"],
'filter' => [
"=ACTIVE" => \Bitrix\Rest\AppTable::ACTIVE,
"=MOBILE" => \Bitrix\Rest\AppTable::ACTIVE
],
'select' => [
'ID', 'STATUS', 'ACCESS', 'MENU_NAME' => 'LANG.MENU_NAME', 'MENU_NAME_DEFAULT' => 'LANG_DEFAULT.MENU_NAME', 'MENU_NAME_LICENSE' => 'LANG_LICENSE.MENU_NAME'
]
]);
while ($apps = $dbApps->fetch())
{
if ($apps["STATUS"] == \Bitrix\Rest\AppTable::STATUS_LOCAL)
{
$numLocalApps++;
}
$lang = in_array(LANGUAGE_ID, ["ru", "en", "de"]) ? LANGUAGE_ID : LangSubst(LANGUAGE_ID);
if (strlen($apps["MENU_NAME"]) > 0 || strlen($apps['MENU_NAME_DEFAULT']) > 0 || strlen($apps['MENU_NAME_LICENSE']) > 0)
{
$appRightAvailable = false;
if (\CRestUtil::isAdmin())
{
$appRightAvailable = true;
}
elseif (!empty($apps["ACCESS"]))
{
$rights = explode(",", $apps["ACCESS"]);
foreach ($rights as $rightID)
{
if (in_array($rightID, $arUserGroupCode))
{
$appRightAvailable = true;
break;
}
}
}
else
{
$appRightAvailable = true;
}
if ($appRightAvailable)
{
$appName = $apps["MENU_NAME"];
if (strlen($appName) <= 0)
{
$appName = $apps['MENU_NAME_DEFAULT'];
}
if (strlen($appName) <= 0)
{
$appName = $apps['MENU_NAME_LICENSE'];
}
$arMenuApps[] = [
"title" => $appName,
"attrs" => [
"cache" => false,
"id" => $apps["ID"],
"url" => "/mobile/marketplace/?id=" . $apps["ID"],
]
];
}
}
}
if (count($arMenuApps) > 0)
{
$menuStructure[] = [
"title" => Loc::getMessage("MB_MARKETPLACE_GROUP_TITLE"), // Приложения из Marketplace Mobile
"sort" => 110,
"hidden" => CMobile::getInstance()->getApiVersion() <= 15,
"items" => $arMenuApps
];
}
}
/**
* CRM menu
*/
/*
if (
!$isExtranetUser
&& IsModuleInstalled('crm')
&& CModule::IncludeModule('crm')
&& CCrmPerms::IsAccessEnabled() //(1==0)
)
{
// получаем набор прав...
$userPerms = CCrmPerms::GetCurrentUserPermissions();
$crmImageBackgroundColor = "#8590a2"; // фоновый цвет...
// структура меню
$menuStructure[] = [
"title" => "CRM", // название
"sort" => 120,
"hidden" => false,
"items" => [
[ // 1
"title" => Loc::getMessage("MB_CRM_ACTIVITY"), // Мои дела
"imageUrl" => $imageDir . "crm/icon-crm-mydeals.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => "/mobile/crm/activity/list.php",
"id" => "crm_activity_list",
],
],
[ // 2
"title" => Loc::getMessage("MB_CRM_CONTACT"), // Контакты
"imageUrl" => $imageDir . "crm/icon-crm-contact.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/contact/",
"id" => "crm_contact_list",
],
],
[ // 3
"title" => Loc::getMessage("MB_CRM_COMPANY"), // Компании
"imageUrl" => $imageDir . "crm/icon-crm-company.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/company/",
"id" => "crm_company_list",
],
],
[ // 4
"title" => Loc::getMessage("MB_CRM_DEAL"), // Сделки
"imageUrl" => $imageDir . "crm/icon-crm-deal.png",
"color" => $crmImageBackgroundColor,
"hidden" => !\CAllCrmDeal::IsAccessEnabled(),
"attrs" => [
"url" => "/mobile/crm/deal/",
"id" => "crm_deal_list",
],
],
[ // 5
"title" => Loc::getMessage("MB_CRM_INVOICE"), // Счета
"imageUrl" => $imageDir . "crm/icon-crm-invoice.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/invoice/",
"id" => "crm_invoice_list",
],
],
[ // 6
"title" => Loc::getMessage("MB_CRM_QUOTE"), // Предложения
"imageUrl" => $imageDir . "crm/icon-crm-quote.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/quote/",
"id" => "crm_quote_list",
],
],
[ // 7
"title" => Loc::getMessage("MB_CRM_LEAD"), // Лиды
"imageUrl" => $imageDir . "crm/icon-crm-lead.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('LEAD', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/lead/",
"id" => "crm_lead_list",
],
],
[ // 8
"title" => Loc::getMessage("MB_CRM_PRODUCT"), // Товары...
"imageUrl" => $imageDir . "crm/icon-crm-catalog.png",
"color" => $crmImageBackgroundColor,
"hidden" => !$userPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'),
"attrs" => [
"url" => "/mobile/crm/product/",
"id" => "crm_product_list",
],
],
]
];
}
*/
/**
* Groups
*/
$groups = [];
$extranetGroups = [];
if (CModule::IncludeModule("socialnetwork"))
{
$strGroupSubjectLinkTemplate = $siteDir . "mobile/log/?group_id=#group_id#";
$extGroupID = [];
$arGroupFilterMy = [
"USER_ID" => $USER->GetID(),
"<=ROLE" => SONET_ROLES_USER,
"GROUP_ACTIVE" => "Y",
"!GROUP_CLOSED" => "Y",
];
// Extranet group
if (CModule::IncludeModule("extranet") && !CExtranet::IsExtranetSite())
{
$arGroupFilterMy["GROUP_SITE_ID"] = CExtranet::GetExtranetSiteID();
$dbGroups = CSocNetUserToGroup::GetList(
["GROUP_NAME" => "ASC"],
$arGroupFilterMy,
false,
false,
['ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID', 'GROUP_IMAGE_ID']
);
$arExtSGGroupTmp = [];
while ($arGroups = $dbGroups->GetNext())
{
if ($arGroups["GROUP_IMAGE_ID"])
{
$imageFile = CFile::GetFileArray($arGroups["GROUP_IMAGE_ID"]);
if ($imageFile !== false)
{
$arFileTmp = CFile::ResizeImageGet(
$imageFile,
[
"width" => 64,
"height" => 64
],
BX_RESIZE_IMAGE_PROPORTIONAL,
false
);
$arGroups["IMAGE"] = $arFileTmp["src"];
}
}
$arExtSGGroupTmp[$arGroups["GROUP_ID"]] = [
"title" => $arGroups["GROUP_NAME"],
"imageUrl" => $arGroups["IMAGE"],
"useLetterImage" => true,
"color" => "#40465A",
"params" => [
"url" => str_replace("#group_id#", $arGroups["GROUP_ID"], $strGroupSubjectLinkTemplate),
"data-modern-style" => "Y"
],
"counter" => [
"id" => "SG" . $arGroups["GROUP_ID"]
]
];
$extGroupID[] = $arGroups["GROUP_ID"];
}
}
$arGroupIDCurrentSite = [];
// Socialnetwork
$arGroupFilterMy["GROUP_SITE_ID"] = SITE_ID;
$dbGroups = CSocNetUserToGroup::GetList(
["GROUP_NAME" => "ASC"],
$arGroupFilterMy,
false,
false,
['ID', 'GROUP_ID', 'GROUP_NAME', 'GROUP_SITE_ID', 'GROUP_IMAGE_ID']
);
while ($arGroups = $dbGroups->GetNext())
{
$arGroupIDCurrentSite[] = $arGroups['GROUP_ID'];
if (in_array($arGroups['GROUP_ID'], $extGroupID))
{
continue;
}
if ($arGroups["GROUP_IMAGE_ID"])
{
$imageFile = CFile::GetFileArray($arGroups["GROUP_IMAGE_ID"]);
if ($imageFile !== false)
{
$arFileTmp = CFile::ResizeImageGet(
$imageFile,
["width" => 64, "height" => 64],
BX_RESIZE_IMAGE_PROPORTIONAL,
false
);
$arGroups["IMAGE"] = $arFileTmp["src"];
}
}
$groups[] = [
"title" => $arGroups["GROUP_NAME"],
"imageUrl" => $arGroups["IMAGE"],
"useLetterImage" => true,
"color" => "#40465A",
"params" => [
"url" => str_replace("#group_id#", $arGroups["GROUP_ID"], $strGroupSubjectLinkTemplate),
"data-modern-style" => "Y"
],
"counter" => [
"id" => "SG" . $arGroups["GROUP_ID"]
]
];
}
foreach ($arExtSGGroupTmp as $groupID => $arGroupItem)
{
if (in_array($groupID, $arGroupIDCurrentSite))
{
$extranetGroups[] = $arGroupItem;
}
}
}
if (!empty($groups) || !empty($extranetGroups))
{
$groupSection = [
"title" => Loc::getMessage("MB_SEC_GROUPS"),
"sort" => 130,
"hidden" => false,
"items" => [],
];
if (!empty($groups))
{
$groupSection["items"][] = [
"title" => Loc::getMessage("MENU_INTRANET"),
"type" => "group",
"params" => ["items" => $groups]
];
}
if (!empty($extranetGroups))
{
$groupSection["items"][] = [
"title" => Loc::getMessage("MENU_EXTRANET"),
"type" => "group",
"params" => ["items" => $extranetGroups]
];
}
$menuStructure[] = $groupSection;
}
$menuStructure[] = [
"title" => GetMessage("MENU_WORK_DAY"),
"sort" => 2,
"hidden" => ($isExtranetUser || !IsModuleInstalled("timeman")),
"items" => [
[
"title" => Loc::getMessage("MENU_WORK_DAY_MANAGE"),
"imageUrl" => $imageDir . "favorite/icon-timeman.png",
"color" => "#2FC6F6",
"params" => [
"url" => $siteDir . "mobile/timeman/"
],
]
]
];
/**
* SERVICES HUB
*/
// $groups = [];
// $extranetGroups = [];
// символическая проверка, подключен ли модуль "Соцсеть" (можно задействовать и БП, к примеру)
if (CModule::IncludeModule("socialnetwork"))
{
// получаем набор прав...
$userPerms = CCrmPerms::GetCurrentUserPermissions();
$crmImageBackgroundColor = "#8590a2"; // фоновый цвет...
if ($USER->IsAdmin())
{
// структура меню
$menuStructure[] = [
"title" => "СЕРВИСЫ", // название
"sort" => 125, // 120
"hidden" => false,
"items" => [
[ // 0
"title" => "Каталог (dev)", //Loc::getMessage("MB_CRM_ACTIVITY"), // Мои дела
"imageUrl" => $imageDir . "crm/icon-crm-mydeals.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => "/mobile/services/", // урл к мобильным бп... // "url" => "/mobile/crm/activity/list.php",
"id" => "exp_serv_catalog", //"id" => "bp_list", // ид
//"counter" => "bp_tasks", // счетчик
],
],
[ // 1
"title" => "Заявки", //Loc::getMessage("MB_CRM_ACTIVITY"), // Мои дела
"imageUrl" => $imageDir . "crm/icon-crm-mydeals.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => "/mobile/services/processes/", // урл к мобильным бп... // "url" => "/mobile/crm/activity/list.php",
"id" => "exp_activity_list", //"id" => "bp_list", // ид
//"counter" => "bp_tasks", // счетчик
],
],
[ // 2
"title" => "Тех. данные пользователей (номера комп., телеф.)", // Loc::getMessage("MB_CRM_CONTACT"), // Контакты
"imageUrl" => $imageDir . "crm/icon-crm-contact.png",
"color" => $crmImageBackgroundColor,
"hidden" => false, //$userPerms->HavePerm('CONTACT', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => $siteDir . "/mobile/exp/userlist/", //"/mobile/crm/contact/",
"id" => "exp_bp_list",
],
],
[ // 3
"title" => "TimeCircle", // Loc::getMessage("MB_CRM_COMPANY"), // Компании
"imageUrl" => $imageDir . "crm/icon-crm-company.png",
"color" => $crmImageBackgroundColor,
"hidden" => false, //$userPerms->HavePerm('COMPANY', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/forms/",
"id" => "exp_timecircle",
],
],
/*[ // 4
"title" => "FEATURE 4", // Loc::getMessage("MB_CRM_DEAL"), // Сделки
"imageUrl" => $imageDir . "crm/icon-crm-deal.png",
"color" => $crmImageBackgroundColor,
"hidden" => !\CAllCrmDeal::IsAccessEnabled(),
"attrs" => [
"url" => "/mobile/crm/deal/",
"id" => "exp_deal_list",
],
],
[ // 5
"title" => "FEATURE 5", // Loc::getMessage("MB_CRM_INVOICE"), // Счета
"imageUrl" => $imageDir . "crm/icon-crm-invoice.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('INVOICE', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/invoice/",
"id" => "exp_invoice_list",
],
],
[ // 6
"title" => "FEATURE 6", // Loc::getMessage("MB_CRM_QUOTE"), // Предложения
"imageUrl" => $imageDir . "crm/icon-crm-quote.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('QUOTE', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/quote/",
"id" => "exp_quote_list",
],
],
[ // 7
"title" => "FEATURE 7", // Loc::getMessage("MB_CRM_LEAD"), // Лиды
"imageUrl" => $imageDir . "crm/icon-crm-lead.png",
"color" => $crmImageBackgroundColor,
"hidden" => $userPerms->HavePerm('LEAD', BX_CRM_PERM_NONE, 'READ'),
"attrs" => [
"url" => "/mobile/crm/lead/",
"id" => "exp_lead_list",
],
],
[ // 8
"title" => "FEATURE 8", // Loc::getMessage("MB_CRM_PRODUCT"), // Товары...
"imageUrl" => $imageDir . "crm/icon-crm-catalog.png",
"color" => $crmImageBackgroundColor,
"hidden" => !$userPerms->HavePerm('CONFIG', BX_CRM_PERM_CONFIG, 'READ'),
"attrs" => [
"url" => "/mobile/crm/product/",
"id" => "exp_product_list",
],
],*/
]
];
} //if(is_admin)...
}
// ** ТЕЛЕФОНИЯ **
$voximplantInstalled = false;
if ($voximplantInstalled = Main\Loader::includeModule('voximplant'))
{
$menuStructure[] = [
"title" => GetMessage("MENU_TELEPHONY"),
"min_api_version" => 22,
"hidden" => !\Bitrix\Voximplant\Security\Helper::canCurrentUserPerformCalls(),
"sort" => 3,
"items" => [
[
"title" => Loc::getMessage("MENU_TELEPHONY_CALL"),
"color" => "#9ACB00",
"unselectable" => true,
"imageUrl" => $imageDir . "telephony/icon-call.png",
"params" => [
"onclick" => <<<JS
BX.postComponentEvent("onNumpadRequestShow");
JS
],
]
]
];
}
$settingsComponentPath = \Bitrix\MobileApp\Janative\Manager::getComponentPath("settings");
$settingsUserId = $USER->GetID();
$settingsSiteId = SITE_ID;
$settingsLanguageId = LANGUAGE_ID;
$menuStructure[] = []; // разделитель?
/* MENU UI */
if (Loader::includeModule("intranet"))
{
$assistantApp = AI\Center::getAssistantApp();
$assistantAppId = is_array($assistantApp) && $assistantApp["ACTIVE"] === "Y" ? intval($assistantApp["ID"]) : 0;
$assistants = AI\Center::getAssistants();
// MENU AI CONTROL
if ($assistantAppId > 0 && count($assistants) > 0)
{
$items = [];
foreach ($assistants as $assistant)
{
$items[] = [
"title" => $assistant["name"],
"hidden" => false,
"attrs" => [
"url" =>
"/mobile/marketplace/?id=$assistantAppId&" .
"lazyload=Y&mobileMode=Y&assistantId={$assistant["id"]}",
"cache" => false,
]
];
}
$menuStructure[] = [
"title" => Loc::getMessage("MENU_AI"),
"sort" => 1000, //110,
"hidden" => false,
"items" => $items,
];
}
}
/**
* COMPANY HUB (main menu item, section)
*/
/*
// символическая проверка, подключен ли модуль "Соцсеть" (можно задействовать и БП, к примеру)
if (CModule::IncludeModule("socialnetwork"))
{
// получаем набор прав...
$userPerms = CCrmPerms::GetCurrentUserPermissions();
$crmImageBackgroundColor = "#8590a2"; // фоновый цвет...
// структура меню
$menuStructure[] = [
"title" => "КОМПАНИЯ", // название
"sort" => 25, // ^
"hidden" => false,
"items" => [
[ // 1
"title" => "Наша жизнь",
"imageUrl" => $imageDir . "crm/icon-crm-mydeals.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir . "mobile/about/life.php",
"id" => "company_life", // ид
],
],
[ // 2
"title" => "Миссия компании",
"imageUrl" => $imageDir . "crm/icon-crm-contact.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir . "mobile/about/company/mission.php", //
"id" => "company_mission", //
],
],
[ // 3
"title" => "Компания сегодня",
"imageUrl" => $imageDir . "crm/icon-crm-company.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."mobile/about/company/index.php",
"id" => "company_today",
],
],
[ // 4
"title" => "Руководство",
"imageUrl" => $imageDir . "crm/icon-crm-deal.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."mobile/about/company/tops.php",
"id" => "company_tops",
],
],
[ // 5
"title" => "История компании",
"imageUrl" => $imageDir . "crm/icon-crm-invoice.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."/mobile/about/company/history.php",
"id" => "company_history",
],
],
[ // 6
"title" => "Контактная информация",
"imageUrl" => $imageDir . "crm/icon-crm-quote.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."mobile/about/company/contacts.php",
"id" => "company_contact_info",
],
],
[ // 7
"title" => "Реквизиты",
"imageUrl" => $imageDir . "crm/icon-crm-lead.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."mobile/about/company/bank_info.php",
"id" => "company_bank_info",
],
],
[ // 8
"title" => "Фотогалерея",
"imageUrl" => $imageDir . "crm/icon-crm-catalog.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir . "mobile/about/gallery/",
"id" => "company_photogallery",
],
],
[ // 9
"title" => "Календарь событий",
"imageUrl" => $imageDir . "favorite/icon-timeman.png",
"color" => $crmImageBackgroundColor,
"hidden" => false,
"attrs" => [
"url" => $siteDir ."mobile/about/calendar.php",
"id" => "company_calendar_events",
],
],
]
];
}
*/
/* Settings - Change Account */
return [
"menu" => $menuStructure,
"popupMenuItems" => [
["title" => Loc::getMessage("MENU_CHANGE_ACCOUNT"), "sectionCode" => "menu", "id" => "switch_account", "iconUrl"=>$imageDir . "settings/change_account_popup.png?5"],
["title" => Loc::getMessage("MENU_SETTINGS"), "sectionCode" => "menu", "id" => "settings",
"iconUrl"=>$imageDir . "settings/settings_popup.png?5"]
]
];
?>
|