/** * 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); }
/** * Class constructor * * @return void */ public function __construct($options) { parent::__construct($options); $imageSrc = $options['imageSrc']; $dataId = $options['dataId']; $isNewImage = $options['isNewImage']; $moduleName = $options['moduleName']; if ($dataId == '') { $pathTmp = "../../../../../data/images/" . $moduleName . "/tmp"; } else { $pathTmp = "../../../../../data/images/" . $moduleName . "/" . $dataId . "/tmp"; } $config = Zend_Registry::get('config'); // Name of the product line $name = new Zend_Form_Element_Text('SCI_Name'); $name->setLabel($this->getView()->getCibleText('form_subcategory_name_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->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); $this->addElement($name); $oCategories = new CatalogCategoriesObject(); $listCat = $oCategories->getAll(Zend_Registry::get('currentEditLanguage')); $categories = new Zend_Form_Element_Select('SC_CategoryID'); $categories->setLabel($this->getView()->getCibleText('form_select_category_label'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->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', 'largeSelect'); $categories->addMultiOption('', $this->getView()->getCibleText('form_select_default_label')); foreach ($listCat as $data) { $categories->addMultiOption($data['CC_ID'], $data['CCI_Name']); } $this->addElement($categories); // ImageSrc $imageBanner = new Zend_Form_Element_Select('SC_BannerGroupID'); $imageBanner->setLabel($this->getView()->getCibleText('form_banner_image_group_extranet'))->setAttrib('class', 'stdSelect'); $imageBanner->addMultiOption('', 'Sans image'); $group = new GroupObject(); $groupArray = $group->groupCollection(); foreach ($groupArray as $group1) { $imageBanner->addMultiOption($group1['BG_ID'], $group1['BG_Name']); } $this->addElement($imageBanner); // id of the associated meta data $metaTagId = new Zend_Form_Element_Hidden('SCI_MetaId'); $metaTagId->removeDecorator('Label'); $this->addElement($metaTagId); }
public function __construct($options = null) { $baseDir = $options['baseDir']; $pageID = $options['pageID']; parent::__construct($options); /****************************************/ // PARAMETERS /****************************************/ // select box category (Parameter #1) $blockCategory = new Zend_Form_Element_Select('Param1'); $blockCategory->setLabel(Cible_Translation::getCibleText('catalog_category_block_page'))->setAttrib('class', 'largeSelect')->setOrder(2); $langId = $this->getView()->_defaultEditLanguage; $oCategory = new CatalogCategoriesObject(); $categories = $oCategory->getAll($langId); foreach ($categories as $category) { $blockCategory->addMultiOption($category['CC_ID'], $category['CCI_Name']); } $this->addElement($blockCategory); $this->removeDisplayGroup('parameters'); $this->addDisplayGroup(array('Param1', 'Param999'), 'parameters'); $parameters = $this->getDisplayGroup('parameters'); }
/** * List products according given parameters. * This list is only for display purpose. No actions except Excel export. * * @return void */ public function listAction() { $img = $this->_getParam('img'); if (!empty($img)) { $this->downloadAction(); exit; } $this->view->params['actions'] = $this->_request->getPathInfo(); /* List products */ $oProducts = new ProductsCollection($this->view->params); $products = $oProducts->getList(); $searchCount = count($products); /* Params */ $subCategoryId = 0; $blockParams = $oProducts->getBlockParams(); $categorieId = $oProducts->getCatId(); $productId = $oProducts->getProdId(); $url = $this->view->absolute_web_root . $this->getRequest()->getPathInfo(); Cible_View_Helper_LastVisited::saveThis($url); if (!$productId) { if (!$categorieId) { $categorieId = $blockParams[1]; } // Zend_Registry::set('bg-body-id', $categorieId); $subCategoryId = $oProducts->getSubCatId(); if ($subCategoryId) { $oSubCat = new SubCategoriesObject(); $subCat = $oSubCat->populate($subCategoryId, Zend_Registry::get('languageID')); $this->view->subCatName = $subCat['SCI_Name']; } $searchWords = isset($this->view->params['keywords']) && $this->view->params['keywords'] != $this->view->getCibleText('form_search_catalog_keywords_label') ? $this->view->params['keywords'] : ''; /* Search form */ // $searchForm = new FormSearchCatalogue( // array( // 'categorieId' => $categorieId, // 'subCategoryId' => $subCategoryId, // 'keywords' => $searchWords) // ); // // $this->view->assign('searchForm', $searchForm); $oCategory = new CatalogCategoriesObject(); $category = $oCategory->populate($categorieId, $this->_registry->languageID); $this->_registry->set('category', $category); $lastSearch = array(); if (!empty($subCategoryId)) { $lastSearch['sousCatId'] = $subCategoryId; } if (!empty($searchWords)) { $lastSearch['keywords'] = $searchWords; } $this->view->assign('searchUrl', $lastSearch); $page = 1; $paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Array($products)); $paginator->setItemCountPerPage($oProducts->getLimit()); if (isset($this->view->params['productId'])) { $productId = $this->view->params['productId']; $this->view->assign('productId', $productId); foreach ($products as $product) { if ($product['P_ID'] != $productId) { $page++; } else { break; } } } $filter = $oProducts->getFilter(); $paramPage = $this->_request->getParam('page'); $page = isset($paramPage) ? $this->_request->getParam('page') : ceil($page / $paginator->getItemCountPerPage()); $paginator->setCurrentPageNumber($page); $this->view->assign('categoryId', $categorieId); $this->view->assign('params', $oProducts->getBlockParams()); $this->view->assign('paginator', $paginator); $this->view->assign('keywords', $searchWords); $this->view->assign('searchCount', $searchCount); $this->view->assign('filter', $filter); if (isset($category['CCI_ValUrl'])) { echo $this->_registry->set('selectedCatalogPage', $category['CCI_ValUrl']); } } else { $this->_registry->set('category', $this->_registry->get('catId_')); $this->_registry->set('productCase', '1'); $url = $this->view->absolute_web_root . $this->getRequest()->getPathInfo(); Cible_View_Helper_LastVisited::saveThis($url); $this->_registry->set('selectedCatalogPage', $products['CCI_ValUrl']); $this->view->assign('productDetails', $products); $this->renderScript('index/detail-product.phtml'); } }
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; }
public function getProductsUrl() { $productsURL = array(); $productsURLValid = array(); $oCategory = new CatalogCategoriesObject(); $oCategories = $oCategory->getAll($this->_currentLang); //echo $this->_currentLang; // var_dump($oCategories); foreach ($oCategories as $oCat) { //var_dump($oCat); $this->setCatId($oCat['CC_ID']); $productsURL = $this->getList(); array_push($productsURLValid, $oCat['CCI_ValUrl']); foreach ($productsURL as $proURL) { // var_dump($proURL); $str = $proURL['CCI_ValUrl'] . "/collection/" . $proURL['SCI_ValUrl'] . "/product/" . $proURL['PI_ValUrl']; array_push($productsURLValid, $str); } // $subCategories = $oSubCategories->getSubCatByCategory($subC[0],array(),$this->_currentLang); //var_dump($productsURL); } // catalogue/my-first-category/collection/sous-categorie-1/product/produit-1-en //var_dump($productsURLValid); return $productsURLValid; }
public function listCategoriesAction() { // web page title $this->view->title = "Catégories"; if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) { $tables = array('Catalog_CategoriesData' => array('CC_ID'), 'Catalog_CategoriesIndex' => array('CCI_CategoryID', 'CCI_LanguageID', 'CCI_Name')); $field_list = array('CC_ID' => array('width' => '50px'), '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; } $lines = new CatalogCategoriesObject(); $select = $lines->getAll($langId, false); $select->joinLeft('BannerGroup', 'BG_ID = C_BannerGroupID'); $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' => 'CC_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' => 'CC_ID'))))); $mylist = new Cible_Paginator($select, $tables, $field_list, $options); $this->view->assign('mylist', $mylist); } }
/** * 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); } } }