Пример #1
0
 private function initMenu($params)
 {
     $language = OW::getLanguage();
     $router = OW::getRouter();
     $this->menu = new BASE_CMP_ContentMenu();
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('base', 'upload'));
     $item->setOrder(0);
     $item->setKey('upload');
     $item->setUrl($router->urlFor('BASE_CTRL_MediaPanel', 'index', $params));
     $this->menu->addElement($item);
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('base', 'tf_img_from_url'));
     $item->setOrder(1);
     $item->setKey('url');
     $item->setUrl($router->urlFor('BASE_CTRL_MediaPanel', 'fromUrl', $params));
     $this->menu->addElement($item);
     $count = BOL_MediaPanelService::getInstance()->countGalleryImages($params['pluginKey'], OW::getUser()->getId());
     $item = new BASE_MenuItem();
     $item->setLabel($language->text('base', 'tf_img_gal') . ($count == 0 ? '' : " ({$count})"));
     $item->setOrder(1);
     $item->setKey('gallery');
     $item->setUrl($router->urlFor('BASE_CTRL_MediaPanel', 'gallery', $params));
     $this->menu->addElement($item);
 }
Пример #2
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $this->name = BOL_NavigationService::MENU_TYPE_MAIN;
     $menuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_NavigationService::MENU_TYPE_MAIN);
     $this->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($menuItems));
 }
Пример #3
0
 protected function getItemViewData(BASE_MenuItem $menuItem)
 {
     $data = parent::getItemViewData($menuItem);
     if ($menuItem instanceof BASE_VerticalMenuItem) {
         $data["number"] = $menuItem->getNumber();
     }
     return $data;
 }
Пример #4
0
 /**
  * Constructor.
  */
 public function __construct()
 {
     parent::__construct();
     $menuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_NavigationService::MENU_TYPE_BOTTOM);
     $this->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($menuItems));
     $this->name = BOL_NavigationService::MENU_TYPE_BOTTOM;
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'bottom_menu.html');
 }
Пример #5
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     /* @var $menuItem BASE_MenuItem */
     foreach ($this->menuItems as $menuItem) {
         if ($menuItem->isActive()) {
             $this->active = true;
         }
     }
 }
Пример #6
0
 public function render()
 {
     $menuItems = OW::getDocument()->getMasterPage()->getMenu(BOL_NavigationService::MENU_TYPE_MAIN)->getMenuItems();
     if (!$this->responsive) {
         $this->setMenuItems($menuItems);
         return parent::render();
     }
     $responsiveMenu = new BASE_CMP_ResponsiveMenu();
     $responsiveMenu->setMenuItems($menuItems);
     return $responsiveMenu->render();
 }
Пример #7
0
 public function onBeforeRender()
 {
     parent::onBeforeRender();
     $event = new BASE_CLASS_EventCollector('base.mobile_top_menu_add_options');
     OW::getEventManager()->trigger($event);
     $data = $event->getData();
     $optionsArray = array();
     foreach ($data as $item) {
         $optionsArray[$item['prefix'] . $item['key']] = array('url' => isset($item['url']) ? trim($item['url']) : null);
     }
     foreach ($this->assignedVars['data'] as $key => $dataItem) {
         if (!empty($optionsArray[$dataItem['prefix'] . $dataItem['key']]['url'])) {
             $this->assignedVars['data'][$key]['addUrl'] = $optionsArray[$dataItem['prefix'] . $dataItem['key']]['url'];
         }
     }
 }
Пример #8
0
 public function __construct($menuItems = null)
 {
     parent::__construct();
     $this->setMenuItems($menuItems);
     $this->setTemplate(OW::getPluginManager()->getPlugin('base')->getCmpViewDir() . 'content_menu.html');
 }
Пример #9
0
 /**
  * Master page init actions. Template assigning, registering standard cmps, etc.
  * Default version works for `general` master page. 
  */
 protected function init()
 {
     // add main menu
     $mainMenu = new BASE_CMP_Menu();
     $mainMenuItems = BOL_NavigationService::getInstance()->findMenuItems(BOL_NavigationService::MENU_TYPE_MAIN);
     $mainMenu->setMenuItems(BOL_NavigationService::getInstance()->getMenuItems($mainMenuItems));
     $this->addMenu(BOL_NavigationService::MENU_TYPE_MAIN, $mainMenu);
     $this->addComponent('main_menu', new BASE_CMP_MainMenu(array("responsive" => false)));
     // add bottom menu
     $bottomMenu = new BASE_CMP_BottomMenu();
     $this->addMenu(BOL_NavigationService::MENU_TYPE_BOTTOM, $bottomMenu);
     $this->addComponent('bottom_menu', $bottomMenu);
     // assign image control values
     $currentTheme = OW::getThemeManager()->getCurrentTheme()->getDto();
     $values = json_decode(OW::getConfig()->getValue('base', 'master_page_theme_info'), true);
     if (isset($values[$currentTheme->getId()])) {
         $this->assign('imageControlValues', $values[$currentTheme->getId()]);
     }
 }
Пример #10
0
 public function onBeforeRender()
 {
     $this->initStatic();
     $this->assign("uniqId", $this->uniqId);
     parent::onBeforeRender();
 }