예제 #1
0
 public static function getMenuDetails($menuId, $langId = null, $menuTitle)
 {
     $langId = is_null($langId) ? Zend_Registry::get('currentEditLanguage') : $langId;
     $menu = new MenuObject($menuTitle);
     $menuItem = $menu->getMenuItemById($menuId);
     return $menuItem;
 }
예제 #2
0
 public function indexAction()
 {
     $tmp = array();
     $arrayData = array();
     $groupMenu = '';
     $layoutFile = Cible_FunctionsPages::getLayoutPath($this->view->currentPageID);
     foreach ($this->_menusLayout as $key => $value) {
         if (preg_match('/' . $key . '/', $layoutFile)) {
             $groupMenu = $key;
         }
     }
     $menusList = MenuObject::getAllMenuList($groupMenu, true);
     $this->_menusLayout[$groupMenu] = $menusList;
     foreach ($this->_menusLayout[$groupMenu] as $menuId) {
         $oMenu = new MenuObject($menuId);
         if (!empty($tmp)) {
             $arrayData = $this->appendIfNotFound($oMenu->populate(), $tmp, $arrayData);
         } else {
             $arrayData = $oMenu->populate();
         }
         $tmp = $this->verifyChildren($arrayData);
     }
     $this->view->assign('menus', $arrayData);
 }
예제 #3
0
 function autogenerateFromIdAction()
 {
     $this->disableView();
     $_itemId = $this->_getParam('itemID');
     $_menuId = $this->_getParam('menuID');
     if ($this->_request->isPost()) {
         if ($_itemId != null && $_itemId >= 0) {
             $menuObject = new MenuObject($_menuId);
             $recursive = false;
             if (isset($_POST['autogenerate_recursive']) && $_POST['autogenerate_recursive'] == 'true') {
                 $recursive = true;
             }
             $result = $menuObject->autogenerateFromId($_itemId, $recursive);
         }
     }
 }
예제 #4
0
 public function buildCatalogMenu($options = array())
 {
     $menuCatalogId = 0;
     $defaultCat = '';
     if (isset($options['menu'])) {
         $oMenu = new MenuObject($options['menu']);
         $menuCatalog = $oMenu->getMenuItemByPageId(null, 'catalog');
         //            if ($this->view->currentPageID)
         //            {
         //                $parentPage = Cible_FunctionsPages::findParentPageID($this->view->currentPageID);
         //                while ($parentPage['P_ParentID'] != 0 )
         //                {
         //                   $parentPage = Cible_FunctionsPages::findParentPageID($parentPage['P_ParentID']);
         //                }
         //
         //                $pageId      = $parentPage['P_ID'];
         //                $menuCatalog = $oMenu->getMenuItemByPageId($pageId);
         //            }
         //            else
         //            {
         //                $menuCatalog = $oMenu->getMenuItemByPageId();
         $parentPage = Cible_FunctionsPages::findParentPageID($menuCatalog['MII_PageID']);
         //            }
     }
     if ($this->view->controller != $parentPage['PI_PageIndex']) {
         $link = $parentPage['PI_PageIndex'] . "/";
     } else {
         $link = $this->view->selectedPage . "/";
     }
     $tree = array();
     $langId = Zend_Registry::get('languageID');
     $oCategories = new CatalogCategoriesObject();
     if (Zend_Registry::isRegistered('defaultCategory') && !is_null(Zend_Registry::get('defaultCategory'))) {
         $defaultCatId = Zend_Registry::get('defaultCategory');
         $tmpCat = $oCategories->populate($defaultCatId, $langId);
         if (empty($tmpCat['CI_ValUrl'])) {
             $tmpCat['CI_ValUrl'] = "";
         }
         $defaultCat = $tmpCat['CI_ValUrl'];
     }
     $categories = $oCategories->getAll($langId);
     $oSubCategories = new SubCategoriesObject();
     $catalog = array('ID' => $menuCatalog['MID_ID'], 'Title' => $menuCatalog['MII_Title'], 'PageID' => '', 'Link' => $link . $defaultCat, 'Placeholder' => 0, 'child' => array());
     foreach ($categories as $category) {
         $childs = array();
         $id = $category['C_ID'];
         $name = Cible_FunctionsGeneral::formatValueForUrl($category['CI_Name']);
         $linkCat = $link . $name;
         $menu['ID'] = $category['C_ID'];
         $menu['Title'] = $category['CI_Name'];
         $menu['PageID'] = '';
         $menu['Link'] = $linkCat;
         $menu['Placeholder'] = '2';
         $subCategories = $oSubCategories->getSubCatByCategory($id, true, $langId);
         if ($options['nesting'] > 1) {
             foreach ($subCategories as $subCat) {
                 $name = "/" . Cible_FunctionsGeneral::formatValueForUrl($subCat['SCI_Name']);
                 $linkSubCat = $linkCat . $name;
                 $child['ID'] = $subCat['SC_ID'];
                 $child['Title'] = $subCat['SCI_Name'];
                 $child['PageID'] = '';
                 $child['Link'] = $linkSubCat;
                 $child['Placeholder'] = '2';
                 $childs[] = $child;
                 $name = '';
             }
         }
         $menu['child'] = $childs;
         $catalog['child'][] = $menu;
     }
     $oMenu = new MenuObject($options['menu']);
     $first = $oMenu->populate($menuCatalog['MID_ID']);
     $childCombined = array();
     if (isset($options['merge']) && $options['merge']) {
         $childCombined = array_merge($catalog['child'], $first);
         $catalog['child'] = $childCombined;
     }
     $tree[] = $catalog;
     return $tree;
 }
예제 #5
0
파일: Menu.php 프로젝트: anunay/stentors
 private function _getParentsMenuId(array $itemMenu, MenuObject $oMenu = null)
 {
     if (is_null($oMenu)) {
         $page = Cible_FunctionsPages::getPageDetails($itemMenu['PageID'], Zend_Registry::get('languageID'));
         $page = $page->toArray();
         $menu = Cible_FunctionsPages::getMenuByPageId($page['P_ParentID']);
         /*var_dump($menu);*/
         $oMenu = new MenuObject($menu[0]['MID_MenuID']);
         $menuId = $menu[0]['MID_ID'];
     } else {
         $menuId = $itemMenu['MID_ParentID'];
     }
     $menuId = $itemMenu['MID_ParentID'];
     $tmpArray = array();
     while ($menuId != 0) {
         $details = $oMenu->getMenuItemById($menuId);
         array_push($tmpArray, $details['MID_ID']);
         $menuId = $details['MID_ParentID'];
     }
     $this->_parentsMenuId = $tmpArray;
 }
예제 #6
0
파일: SubMenu.php 프로젝트: anunay/stentors
 private function _getParentsMenuId(array $itemMenu, MenuObject $oMenu)
 {
     $tmpArray = array();
     $menuId = $itemMenu['MID_ParentID'];
     while ($menuId != 0) {
         $details = $oMenu->getMenuItemById($menuId);
         array_push($tmpArray, $details['MID_ID']);
         $menuId = $details['MID_ParentID'];
     }
     $tmpArray = array_reverse($tmpArray);
     array_unique($tmpArray);
     $this->_parentsMenuId = $tmpArray;
 }