Advertisement
Trigub_Ilia

Добавление меню в мобильном приложении б24

Apr 9th, 2018
1,107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.47 KB | None | 0 0
  1. Добавление нового пункта в разделе меню
  2. код в init.php
  3. <?
  4. AddEventHandler("mobile", "onMobileMenuStructureBuilt", Array("CStudiobitEvents", "onMobileMenuStructureBuilt"));
  5.  
  6. class CStudiobitEvents
  7. {
  8.  public function onMobileMenuStructureBuilt($menu)
  9.  {
  10.   $menu[] = array(
  11.    'title' => 'Другое',
  12.    'min_api_version' => 22,
  13.    'hidden' => false,
  14.    'sort' => 22,
  15.    'items' =>
  16.     array(
  17.      array(
  18.       'title' => 'Компания',
  19.       'color' => '#8bd100',
  20.       'unselectable' => true,
  21.       'imageUrl' => '/bitrix/components/bitrix/mobile.jscomponent/jscomponents/more/images/crm/icon-crm-company.png',
  22.         'attrs' =>
  23.         array (
  24.             'url' => '/mobile/about/',
  25.             'id' => 'company_about',
  26.         ),
  27.      ),
  28.     )
  29.   );
  30.  
  31.   return $menu;
  32.  }
  33. }
  34. ?>
  35.  
  36. Добавление выпадающего меню на страницах
  37. <script>
  38.     BX.ready(function(){
  39.  
  40.         var customItems = [
  41.             /*{
  42.                 name: 'История',
  43.                 image: "/bitrix/js/mobile/images/plus.png",
  44.                 action: function()
  45.                 {
  46.                     BXMobileApp.PageManager.loadPageModal({
  47.                         url: "/mobile/about/index.php"
  48.                     });
  49.                 }
  50. },*/
  51.             {
  52.                 name: 'Миссия. Видение. Ценности.',
  53.                 image: "/bitrix/js/mobile/images/plus.png",
  54.                 action: function()
  55.                 {
  56.                     BXMobileApp.PageManager.loadPageModal({
  57.                         url: "/mobile/about/mvts.php"
  58.                     });
  59.                 }
  60.             },
  61.             {
  62.                 name: 'Новости',
  63.                 image: "/bitrix/js/mobile/images/plus.png",
  64.                 action: function()
  65.                 {
  66.                     BXMobileApp.PageManager.loadPageModal({
  67.                         url: "/mobile/about/business_news.php"
  68.                     });
  69.                 }
  70.             },
  71.             {
  72.                 name: 'Единая горячая линия',
  73.                 image: "/bitrix/js/mobile/images/plus.png",
  74.                 action: function()
  75.                 {
  76.                     BXMobileApp.PageManager.loadPageModal({
  77.                         url: "http://hotline.tui.ru/hotline/SitePages/home.aspx"
  78.                     });
  79.                 }
  80.             },
  81.         ];
  82.  
  83.         var menu = new BXMobileApp.UI.Menu({
  84.            items: customItems
  85.           }, "crmMobileMenu");
  86.           BXMobileApp.UI.Page.TopBar.title.setText('Компания');
  87.           BXMobileApp.UI.Page.TopBar.title.show();
  88.           BXMobileApp.UI.Page.TopBar.title.setCallback(function (){
  89.            menu.show();
  90.           });
  91.         var menu = new BXMobileApp.UI.Menu({ items: items }, "crmMobileMenu"); BXMobileApp.UI.Page.TopBar.title.setText('Компания'); BXMobileApp.UI.Page.TopBar.title.show(); BXMobileApp.UI.Page.TopBar.title.setCallback(function (){ menu.show(); });
  92.     });
  93. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement