Beispiel #1
0
 /**
  * Fecth data to set banner values and render it.
  *
  * @return string
  */
 public function bannerRenderer($groupId = null, $autoPlay = null, $delais = null, $transition = null, $navi = null, $effect = null)
 {
     $imageGroupIndex = 0;
     $currentLang = Zend_Registry::get('languageID');
     $cat_image = "";
     $sousCat_image = "";
     $page_image = "";
     $imageToShow = "";
     $textToShow = "";
     if (Zend_Registry::isRegistered('subCatId_')) {
         $sousCat_ID = Zend_Registry::get('subCatId_');
         $object = new SubCategoriesObject();
         $details = $object->populate($sousCat_ID, $currentLang);
         if (isset($details['SC_BannerGroupID'])) {
             $sousCat_image = $details['SC_BannerGroupID'];
         }
     }
     if (Zend_Registry::isRegistered('catId_') && Zend_Registry::get('catId_') > 0) {
         $cat_ID = Zend_Registry::get('catId_');
         $object = new CatalogCategoriesObject();
         $details = $object->populate($cat_ID, $currentLang);
         if (isset($details['C_BannerGroupID'])) {
             $cat_image = $details['C_BannerGroupID'];
         }
     }
     if (Zend_Registry::isRegistered('bannerGroupImage')) {
         $page_image = Zend_Registry::get('bannerGroupImage');
     }
     if ($sousCat_image != "") {
         $imageGroupIndex = $sousCat_image;
     } else {
         if ($cat_image != "") {
             $imageGroupIndex = $cat_image;
         } else {
             if ($page_image) {
                 $imageGroupIndex = $page_image;
             } elseif ($groupId) {
                 $imageGroupIndex = $groupId;
             }
         }
     }
     $images = array();
     if ($imageGroupIndex != 0) {
         $obj = new BannerImageObject();
         $images = $obj->getImageToShow($imageGroupIndex);
     }
     if (count($images)) {
         $imageToShow = $images;
     } else {
         $imageToShow[0]['text'] = $this->view->getClientText('banner_default_text');
         $imageToShow[0]['img'] = Zend_Registry::get("web_root") . "/themes/default/images/common/bg_home_header.jpg";
     }
     $this->view->assign('imageToShow', $imageToShow);
     $this->view->assign('textToShow', $textToShow);
     $this->view->assign('autoPlay', $autoPlay);
     $this->view->assign('delais', $delais);
     $this->view->assign('transition', $transition);
     $this->view->assign('navi', $navi);
     $this->view->assign('effect', $effect);
 }
Beispiel #2
0
 private function retrieveChildItems($parentId, $extranet = false)
 {
     $tmp_menu = array();
     $menuItemObject = new MenuItem();
     $select = $menuItemObject->select()->setIntegrityCheck(false)->from('MenuItemData')->joinInner('MenuItemIndex', 'MID_ID = MII_MenuItemDataID')->where('MID_MenuID = ?', $this->_id)->where('MID_ParentID = ?', $parentId)->order('MID_Position');
     if ($extranet) {
         $select->where('MII_LanguageID = ?', Cible_Controller_Action::getDefaultEditLanguage());
     } else {
         $select->where('MII_LanguageID = ?', Zend_Registry::get('languageID'));
     }
     if (Zend_Registry::isRegistered('user')) {
         $user = Zend_Registry::get('user');
         if (!$user) {
             $select->where('MID_Secured = ?', 0);
         }
     }
     $menuItems = $menuItemObject->fetchAll($select)->toArray();
     foreach ($menuItems as $item) {
         $menu_item = array('ID' => $item['MID_ID'], 'MID_Show' => $item['MID_Show'], 'Title' => $item['MII_Title'], 'Link' => $item['MII_Link'], 'PageID' => $item['MII_PageID'], 'Style' => $item['MID_Style'], 'menuImage' => $item['MID_Image'], 'loadImage' => $item['MID_loadImage'], 'menuImgAndTitle' => $item['MID_ImgAndTitle'], 'Placeholder' => $item['MII_Placeholder']);
         if (preg_match('/useCatalog/', $item['MID_Style'])) {
             $menu_item['Placeholder'] = 2;
             $collections = new SubCategoriesObject();
             //                 $menuCatalog = $this->getMenuItemByPageId( null, 'collections');
             $catalogMenu = $collections->buildCatalogMenu($menu_item, array('nesting' => 1));
             $submenu = $catalogMenu['child'];
             //                $first = $this->populate($menuCatalog['MID_ID']);
             //                $childCombined = array();
             //                    $childCombined = array_merge($catalogMenu['child'], $first);
             //                    $catalog['child'] = $childCombined;
         } else {
             $submenu = $this->retrieveChildItems($item['MID_ID'], $extranet);
         }
         if ($submenu) {
             $menu_item['child'] = $submenu;
         }
         array_push($tmp_menu, $menu_item);
     }
     return $tmp_menu;
 }
 public function listSubCatAction()
 {
     // web page title
     $this->view->title = "Sous-catégories";
     if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) {
         $tables = array('Catalog_CategoriesData' => array('CC_ID'), 'Catalog_CategoriesIndex' => array('CCI_CategoryID', 'CCI_Name'), 'Catalog_SousCategoriesData' => array('SC_ID', 'SC_CategoryID'), 'Catalog_SousCategoriesIndex' => array('SCI_SousCategoryID', 'SCI_LanguageID', 'SCI_Name'));
         $field_list = array('SC_ID' => array('width' => '50px'), 'SCI_Name' => array('width' => '150px'), 'CCI_Name' => array('width' => '150px'));
         $this->view->params = $this->_getAllParams();
         $pageID = $this->_getParam('pageID');
         $lang = $this->_getParam('lang');
         if (!$lang) {
             $this->_registry->currentEditLanguage = $this->_defaultEditLanguage;
             $langId = $this->_defaultEditLanguage;
         } else {
             $langId = Cible_FunctionsGeneral::getLanguageID($lang);
             $this->_registry->currentEditLanguage = $langId;
         }
         $oSubCategories = new SubCategoriesObject();
         $select = $oSubCategories->getAll($langId, false);
         $select->joinLeft('Catalog_CategoriesData', 'CC_ID = SC_CategoryID');
         $select->joinLeft('BannerGroup', 'BG_ID = SC_BannerGroupID');
         $select->joinLeft('Catalog_CategoriesIndex', 'CC_ID = CCI_CategoryID AND CCI_LanguageID = "' . $langId . '"');
         $commands = array();
         if ($langId == $this->_defaultEditLanguage) {
             $commands = array($this->view->link($this->view->url(array('controller' => $this->_name, 'action' => 'add')), $this->view->getCibleText('button_add_news'), array('class' => 'action_submit add')));
         }
         $options = array('commands' => $commands, 'disable-export-to-excel' => 'true', 'action_panel' => array('width' => '50', 'actions' => array('edit' => array('label' => $this->view->getCibleText('button_edit'), 'url' => $this->view->baseUrl() . "/" . $this->_moduleTitle . "/" . $this->_name . "/edit/" . $this->_paramId . "/%ID%", 'findReplace' => array('search' => '%ID%', 'replace' => 'SC_ID')), 'delete' => array('label' => $this->view->getCibleText('button_delete'), 'url' => $this->view->baseUrl() . "/" . $this->_moduleTitle . "/" . $this->_name . "/delete/" . $this->_paramId . "/%ID%/" . $pageID, 'findReplace' => array('search' => '%ID%', 'replace' => 'SC_ID')))));
         $mylist = new Cible_Paginator($select, $tables, $field_list, $options);
         $this->view->assign('mylist', $mylist);
     }
 }
Beispiel #4
0
 /**
  * Class constructor
  *
  * @return void
  */
 public function __construct($options)
 {
     $this->_addSubmitSaveClose = true;
     parent::__construct($options);
     $imageSrc = $options['imageSrc'];
     $dataId = $options['dataId'];
     $imgField = $options['imgField'];
     $isNewImage = $options['isNewImage'];
     $moduleName = $options['moduleName'];
     $productFormLeft = new Zend_Form_SubForm();
     $productFormRight = new Zend_Form_SubForm();
     $productFormBotPub = new Zend_Form_SubForm();
     $productFormBotPro = new Zend_Form_SubForm();
     if ($dataId == '') {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp";
     } else {
         $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp";
     }
     // hidden specify if new image for the news
     $newImage = new Zend_Form_Element_Hidden('isNewImage', array('value' => $isNewImage));
     $newImage->removeDecorator('Label');
     $productFormRight->addElement($newImage);
     // Name of the product line
     $name = new Zend_Form_Element_Text('PI_Name');
     $name->setLabel($productFormLeft->getView()->getCibleText('product_label_name') . "<span class='field_required'>*</span>")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $productFormLeft->getView()->getCibleText('validation_message_empty_field'))))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
     $label = $name->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $productFormLeft->addElement($name);
     // List of sub categories
     $oSubCategories = new SubCategoriesObject();
     $listSubCat = $oSubCategories->subcatCollection(Zend_Registry::get('currentEditLanguage'));
     $subCategories = new Zend_Form_Element_Select('P_SubCategoryID');
     $subCategories->setLabel($productFormLeft->getView()->getCibleText('form_products_subcat_label') . "<span class='field_required'>*</span>")->setAttrib('class', 'largeSelect')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $productFormLeft->getView()->getCibleText('validation_message_empty_field'))));
     $subCategories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label'));
     $subCategories->addMultiOptions($listSubCat);
     $productFormLeft->addElement($subCategories);
     // Checkbox for new product
     $isNewProd = new Zend_Form_Element_Checkbox('P_New');
     $isNewProd->setLabel($productFormLeft->getView()->getCibleText('form_product_isnew_label'));
     $isNewProd->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox'))));
     $productFormLeft->addElement($isNewProd);
     // id of the associated meta data
     $metaTagId = new Zend_Form_Element_Hidden('PI_MetaId');
     $metaTagId->removeDecorator('Label');
     $productFormLeft->addElement($metaTagId);
     // Image for the product line
     $imageTmp = new Zend_Form_Element_Hidden($imgField . '_tmp');
     $imageTmp->removeDecorator('Label');
     $productFormRight->addElement($imageTmp);
     $imageOrg = new Zend_Form_Element_Hidden($imgField . '_original');
     $imageOrg->removeDecorator('Label');
     $productFormRight->addElement($imageOrg);
     $imageView = new Zend_Form_Element_Image($imgField . '_preview', array('onclick' => 'return false;'));
     $imageView->setImage($imageSrc);
     $productFormRight->addElement($imageView);
     $imagePicker = new Cible_Form_Element_ImagePicker($imgField, array('onchange' => "document.getElementById('imageView').src = document.getElementById('" . $imgField . "').value", 'associatedElement' => $imgField . '_preview', 'pathTmp' => $pathTmp, 'contentID' => $dataId));
     $imagePicker->removeDecorator('Label');
     $productFormRight->addElement($imagePicker);
     //Keywords field
     $keywords = new Zend_Form_Element_Text('PI_MotsCles');
     $keywords->setLabel($productFormLeft->getView()->getCibleText('form_product_keywords_label'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline marginTop30', 'id' => 'title'))))->setAttrib('class', 'largeTextInput');
     $label = $keywords->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $productFormLeft->addElement($keywords);
     // Description of the product
     $descrPublic = new Cible_Form_Element_Editor('PI_DescriptionPublic', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'subFormID' => 'productFormBotPub'));
     $descrPublic->setLabel($this->getView()->getCibleText('product_label_descriptionPublic'))->setAttrib('class', 'largeEditor');
     $label = $descrPublic->getDecorator('label');
     $label->setOption('class', $this->_labelCSS);
     $productFormBotPub->addElement($descrPublic);
     // Technical specs of the product for public.
     $urlTechFile = new Zend_Form_Element_Hidden('PI_FicheTechniquePublicPDF');
     $urlTechFile->removeDecorator('Label');
     $productFormBotPub->addElement($urlTechFile);
     $techfile = new Zend_Form_Element_Hidden('technicalSpecsName');
     $techfile->removeDecorator('Label');
     $productFormBotPub->addElement($techfile);
     // Technical specs of the product.
     $technicalSpecs = new Cible_Form_Element_FileManager('PI_FicheTechniquePublicPDF', array('associatedElement' => 'productFormBotPub', 'displayElement' => 'technicalSpecsName', 'pathTmp' => $this->_filePath, 'contentID' => $this->_dataId, 'setInit' => true));
     $technicalSpecs->setLabel($productFormBotPub->getView()->getCibleText('product_label_technical_specs'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
     $label = $technicalSpecs->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $productFormBotPub->addElement($technicalSpecs);
     //-----------------------------------------------------
     // Description of the product for pro
     $descrPro = new Cible_Form_Element_Editor('PI_DescriptionPro', array('mode' => Cible_Form_Element_Editor::ADVANCED, 'subFormID' => 'productFormBotPro'));
     $descrPro->setLabel($this->getView()->getCibleText('product_label_descriptionPro'))->setAttrib('class', 'largeEditor');
     $label = $descrPro->getDecorator('label');
     $label->setOption('class', $this->_labelCSS);
     $productFormBotPro->addElement($descrPro);
     // Technical specs of the product for pro.
     $urlTechFile = new Zend_Form_Element_Hidden('PI_FicheTechniqueProPDF');
     $urlTechFile->removeDecorator('Label');
     $productFormLeft->addElement($urlTechFile);
     $techfile = new Zend_Form_Element_Hidden('technicalSpecsPro');
     $techfile->removeDecorator('Label');
     $productFormBotPro->addElement($techfile);
     // Technical specs of the product.
     $technicalSpecsPro = new Cible_Form_Element_FileManager('PI_FicheTechniqueProPDF', array('associatedElement' => 'productFormBotPro', 'displayElement' => 'technicalSpecsPro', 'pathTmp' => $this->_filePath, 'contentID' => $this->_dataId, 'setInit' => true));
     $technicalSpecsPro->setLabel($productFormBotPro->getView()->getCibleText('product_label_technical_specs'))->addFilter('StripTags')->addFilter('StringTrim')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'form_title_inline', 'id' => 'title'))))->setAttrib('class', 'stdTextInput');
     $label = $technicalSpecsPro->getDecorator('Label');
     $label->setOption('class', $this->_labelCSS);
     $productFormBotPro->addElement($technicalSpecsPro);
     $productFormBotPub->setLegend($this->getView()->getCibleText('subform_public_legend'));
     $productFormBotPub->setAttrib('class', 'fieldsetBorder');
     $productFormBotPro->setLegend($this->getView()->getCibleText('subform_professional_legend'));
     $productFormBotPro->setAttrib('class', 'fieldsetBorder');
     $this->addSubForm($productFormLeft, 'productFormLeft');
     $this->addSubForm($productFormRight, 'productFormRight');
     $this->addSubForm($productFormBotPub, 'productFormBotPub');
     $this->addSubForm($productFormBotPro, 'productFormBotPro');
 }
Beispiel #5
0
 public function listcollectionsAction()
 {
     $langId = Zend_Registry::get('languageID');
     $oSubCategories = new SubCategoriesObject();
     $subCategories = $oSubCategories->getSubCatAsCollections($langId);
     $page = Cible_FunctionsPages::getPageNameByID(14080, $langId);
     $this->view->assign('collections', $subCategories);
     $this->view->assign('page', $page);
 }
Beispiel #6
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;
 }
Beispiel #7
0
 /**
  * Get the list of the products for all categories
  *
  *
  * @return array
  */
 public function getListOfAllNewProducts()
 {
     $products = array();
     $this->getDataByName();
     $oProducts = new ProductsObject();
     $oSubCat = new SubCategoriesObject();
     $oCategory = new CatalogCategoriesObject();
     $subCategories = $oSubCat->getSubCatByCategory(0, false, $this->_currentLang);
     $oCategory->setQuery($subCategories);
     $categoryQuery = $oCategory->getDataCatagory($this->_currentLang, false);
     $oProducts->setQuery($categoryQuery);
     $select = $oProducts->getProducts($this->_currentLang, false);
     $select->where('P_New = 1');
     $select->order('PI_Name ASC');
     $products = $this->_db->fetchAll($select);
     //echo $select;
     return $products;
 }
Beispiel #8
0
 /**
  * Build the breadcrumd for the catalog page.
  *
  * @param int $lang  <Optional> Id of the current language
  * 
  * @return string 
  */
 public function breadcrumbCatalog($level = 1, $showHome = true, $langId = null)
 {
     if ($langId == null) {
         $langId = Zend_Registry::get('languageID');
     }
     $_baseUrl = Zend_Registry::get('baseUrl');
     $_breadcrumb = array();
     $_first = true;
     $pathInfo = $this->view->request->getPathInfo();
     $oProducts = new ProductsCollection();
     $oProducts->setActions($pathInfo);
     $oProducts->getDataByName();
     $catId = $oProducts->getCatId();
     $subCatId = $oProducts->getSubCatId();
     $prodId = $oProducts->getProdId();
     if ($catId == null && $subCatId == null && $prodId == null) {
         $_breadcrumb = $this->view->breadcrumb(true) . "<b>" . $this->view->selectedPage . "</b>";
         return $_breadcrumb;
     } else {
         $pathElemts = $oProducts->getActions();
         if ($prodId) {
             $_class = '';
             $product = new ProductsObject();
             $details = $product->populate($prodId, $langId);
             if ($_first) {
                 $_class = 'current_page';
             }
             $link = $_first ? "<b>" . $details['PI_Name'] . "</b>" : "<a href='{$_baseUrl}/{$this->view->selectedPage}/{$pathElemts[0]}/{$pathElemts[1]}/{$pathElemts[2]}' class='{$_class}'>{$details['PI_Name']}</a>";
             array_push($_breadcrumb, $link);
             if ($_first) {
                 $_first = false;
             }
         }
         if ($subCatId) {
             $_class = '';
             $object = new SubCategoriesObject();
             $details = $object->populate($subCatId, $langId);
             if ($_first) {
                 $_class = 'current_page';
             }
             $link = $_first ? "<b>" . $details['SCI_Name'] . "</b>" : "<a href='{$_baseUrl}/{$this->view->selectedPage}/{$pathElemts[0]}/{$pathElemts[1]}' class='{$_class}'>{$details['SCI_Name']}</a>";
             array_push($_breadcrumb, $link);
             if ($_first) {
                 $_first = false;
             }
         }
         if ($catId) {
             $_class = '';
             $object = new CatalogCategoriesObject();
             $details = $object->populate($catId, $langId);
             if ($_first) {
                 $_class = 'current_page';
             }
             $link = $_first ? "<b>" . $details['CCI_Name'] . "</b>" : "<a href='{$_baseUrl}/{$this->view->selectedPage}/{$pathElemts[0]}' class='{$_class}'>{$details['CCI_Name']}</a>";
             array_push($_breadcrumb, $link);
             if ($_first) {
                 $_first = false;
             }
         }
         $details = Cible_FunctionsPages::getPageDetails($this->view->currentPageID, $langId);
         $link = $_first ? '' : "<a href='{$_baseUrl}/{$details['PI_PageIndex']}' class='{$_class}'>{$details['PI_PageTitle']}</a>";
         array_push($_breadcrumb, $link);
         if ($showHome) {
             $homeDetails = Cible_FunctionsPages::getHomePageDetails();
             $link = "<a href='{$_baseUrl}/{$homeDetails['PI_PageIndex']}' class='{$_class}'>" . $homeDetails['PI_PageTitle'] . "</a>";
             array_push($_breadcrumb, $link);
         }
         $_breadcrumb = array_reverse($_breadcrumb);
         //var_dump($_breadcrumb);
         //            for($i=0;$i<$level;$i++){
         //                array_splice($_breadcrumb,$i+1,1);
         //            }
         // add the > after the breadcrumb when only on item is found
         if (count($_breadcrumb) == 1) {
             return "{$_breadcrumb[0]} > ";
         } else {
             return implode(' > ', $_breadcrumb);
         }
     }
 }
Beispiel #9
0
 /**
  * Set default values and the first level container (ul)
  *
  * @param Mixed $menu    If String: Fecth menu data according its name.<br/>
  *                       If Array: It must contain the menu tree.
  *
  * @param array $options Options to manage menu behaviour<br />
  *                       Ex: disable_nesting => true, parentAltId => (string)
  *
  * @return string html code to display the menu and is children
  */
 public function subMenu($options = array())
 {
     if (isset($options['addEnclosure'])) {
         $this->_addEnclosure = $options['addEnclosure'];
     }
     if ($this->view->selectedPage) {
         $this->_selectedPage = $this->view->selectedPage;
     } elseif (Zend_Registry::isRegistered('selectedPage')) {
         $this->_selectedPage = Zend_Registry::get('selectedPage');
     } else {
         $params = Zend_Controller_Front::getInstance()->getRequest()->getParams();
         $this->_selectedPage = $params['controller'];
         if ($params['controller'] == 'index') {
             $this->_selectedPage = Cible_FunctionsPages::getPageNameByID(1);
         }
     }
     $oPages = new PagesObject();
     $pageData = $oPages->pageIdByController($this->_selectedPage);
     $this->_selectedPageId = $pageData['P_ID'];
     $menuData = $oPages->getRelatedMenu($this->_selectedPageId);
     $parentId = 0;
     if (!$menuData) {
         $parentId = $oPages->getParentRelatedID($this->_selectedPageId);
         $parentName = $oPages->getParentRelatedName($parentId);
         $menuData = $oPages->getRelatedMenu($parentId);
         $this->_selectedPageId = $parentId;
         $parentId = $menuData['MID_ParentID'];
         $this->view->assign('selectedPage', $parentName);
         //echo $parentName;
     }
     $_menu = new MenuObject($menuData['MID_MenuId']);
     if ($menuData['MID_ParentID'] == 0) {
         $parentId = $menuData['MID_ID'];
     } else {
         $menuItem = $_menu->getMenuItemByPageId($this->_selectedPageId);
         if ($menuItem) {
             $this->_getParentsMenuId($menuItem, $_menu);
         }
         if ($parentId == 0) {
             $parentId = $this->_parentsMenuId[0];
         }
     }
     if (!empty($options['parentId'])) {
         $parentId = $options['parentId'];
     }
     if (preg_match('/useCatalog/', $menuData['MID_Style'])) {
         $menu_item['Placeholder'] = 2;
         $collections = new SubCategoriesObject();
         //                $menuCatalog = $this->getMenuItemByPageId( null, 'collections');
         $catalogMenu = $collections->buildCatalogMenu($menu_item, array('nesting' => 1));
         $tree = $catalogMenu['child'];
         //               $first = $this->populate($menuCatalog['MID_ID']);
         //               $childCombined = array();
         //                   $childCombined = array_merge($catalogMenu['child'], $first);
         //                   $catalog['child'] = $childCombined;
     } elseif (!empty($parentId)) {
         $tree = $_menu->populate($parentId);
     }
     $tree['MID_MenuID'] = $menuData['MID_MenuId'];
     $tree['MID_ParentId'] = $parentId;
     return $tree;
 }