/** * 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'); }
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 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 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); } }