Пример #1
0
 public function init($options = null)
 {
     parent::init();
     if ($this->_getParam('catID')) {
         $this->_categoryID = $this->_getParam('catID');
     }
 }
Пример #2
0
 public function setOnlineBlockAction()
 {
     parent::setOnlineBlockAction();
     $blockID = $this->getRequest()->getParam('blockID');
     // index the new text if block online
     $textSelect = new Text();
     $select = $textSelect->select()->setIntegrityCheck(false)->from('TextData')->where('TD_BlockID = ?', $blockID)->join('Blocks', 'B_ID = TD_BlockID')->join('PagesIndex', 'PI_PageID = B_PageID')->where('PI_LanguageID = TD_LanguageID');
     $textData = $textSelect->fetchAll($select);
     foreach ($textData as $text) {
         $indexData['pageID'] = $text['B_PageID'];
         $indexData['moduleID'] = $text['B_ModuleID'];
         $indexData['contentID'] = $text['TD_ID'];
         $indexData['languageID'] = $text['TD_LanguageID'];
         $indexData['title'] = $text['PI_PageTitle'];
         $indexData['text'] = '';
         $indexData['link'] = '';
         $indexData['contents'] = $text['PI_PageTitle'] . " " . $text['TD_OnlineText'];
         if ($text['PI_Status'] == 1) {
             if ($text['B_Online'] == 1) {
                 $indexData['action'] = 'add';
             } else {
                 $indexData['action'] = 'delete';
             }
         } else {
             $indexData['action'] = 'delete';
         }
         Cible_FunctionsIndexation::indexation($indexData);
     }
 }
Пример #3
0
 public function init()
 {
     parent::init();
     $dataImagePath = "../../" . $this->_config->document_root . "/data/images/";
     //        $this->_catalogImageFolder = $dataImagePath
     //                                        . $this->_moduleTitle . "/";
     $this->_imageFolder = $dataImagePath . $this->_moduleTitle . "/" . $this->_name . "/";
     $this->_rootImgPath = Zend_Registry::get("www_root") . "/data/images/" . $this->_moduleTitle . "/" . $this->_name . "/";
 }
Пример #4
0
 public function init()
 {
     parent::init();
     $dataImagePath = "../../" . $this->_config->document_root . "/data/images/";
     //        $this->_catalogImageFolder = $dataImagePath
     //                                        . $this->_moduleTitle . "/";
     $this->_imagesFolder = $dataImagePath . $this->_moduleTitle . "/" . $this->_name . "/";
     $this->_rootImgPath = Zend_Registry::get("www_root") . "/data/images/" . $this->_moduleTitle . "/" . $this->_name . "/";
     $this->_rootFilePath = "../../" . "data/files/" . $this->_moduleTitle . "/" . $this->_name . "/";
     $this->view->cleaction = $this->_name;
     $this->_imgIndex = 'imagefeat';
     $config = Zend_Registry::get('config')->toArray();
     //banners.imagefeat.number
     $this->_imgFeatureNumber = $config[$this->_moduleTitle][$this->_imgIndex]['number'];
     //echo $this->_imgFeatureNumber;
 }
Пример #5
0
 /**
  * Export data according to given parameters.
  *
  * @return void
  */
 public function toExcelAction()
 {
     $this->type = 'CSV';
     $this->filename = $this->_actionKey . '.csv';
     $params = array();
     $actionName = $this->_actionKey . 'Action';
     $params = $this->{$actionName}(true);
     $oDataName = $this->_objectList[$this->_actionKey];
     $lines = new $oDataName();
     $constraint = $lines->getConstraint();
     $params['constraint'] = $constraint;
     $this->tables = array($lines->getDataTableName() => $lines->getDataColumns());
     $this->view->params = $this->_getAllParams();
     $columns = array_keys($params['columns']);
     $this->fields = array_combine($columns, $columns);
     $this->filters = array();
     $pageID = $this->_getParam('pageID');
     $langId = $this->_defaultEditLanguage;
     $select = $lines->getAll($langId, false);
     $select = $this->_addJoinQuery($select, $params);
     $this->select = $select;
     parent::toExcelAction();
 }
Пример #6
0
 /**
  * Manage table list for csv export.
  *
  * @return void
  */
 public function toCsvAction()
 {
     // variables
     $pageID = $this->_getParam('pageID');
     $returnAction = $this->_getParam('return');
     $returnUrl = '/';
     $blockID = $this->_getParam('blockID');
     $baseDir = $this->view->baseUrl();
     if ($this->view->aclIsAllowed($this->_moduleTitle, 'edit', true)) {
         $returnUrl .= $this->_moduleTitle . "/" . $this->_name . "/" . $this->_firstAction . "/";
         if ($pageID > 0) {
             $returnUrl .= "page/" . $pageID . "/";
         }
         // get the list of tables that may be exported
         $tablesList = $this->_tablesList;
         // generate the form to select tables to export
         $form = new FormExportCatalog(array('baseDir' => $baseDir, 'cancelUrl' => "{$baseDir}{$returnUrl}", 'selectedTables' => $tablesList));
         $this->view->form = $form;
         // action
         if (!$this->_request->isPost()) {
             $form->populate($tablesList);
         } else {
             $formData = $this->_request->getPost();
             $selectedTables = $formData['tablesList'];
             if ($selectedTables[0] == 'checkAll') {
                 unset($selectedTables[0]);
             }
             if ($form->isValid($formData)) {
                 if ($this->_ftpTransfer && $this->_exportFilesFolder) {
                     $config = Zend_Registry::get('config');
                     $properties = $config->toArray();
                     $ftp = new Cible_Ftp($properties['ftpTransfer']);
                 }
                 // Process export
                 foreach ($selectedTables as $name) {
                     //                        if (isset($this->relatedId[$name]))
                     //                        {
                     $this->type = 'CSV';
                     $options['dataClass'] = $this->_formatName($name);
                     $lines = new ExportObject($options);
                     $dataColumns = $lines->getDataColumnsForExport();
                     $this->tables = array($name => $dataColumns);
                     $this->fields = $dataColumns;
                     $this->filters = array();
                     $this->select = $lines->getAll(null, false);
                     if (is_array($this->relatedId) && count($this->relatedId) > 0) {
                         $object = new $options['dataClass']();
                         //Get the constraint to find related data/table
                         $field = $object->getConstraint();
                         //If no constraint it's the first table. We take the key.
                         if (empty($field)) {
                             $field = $object->getDataId();
                         }
                         // Add where clause to the query
                         if (isset($this->relatedId[$name]) && is_array($this->relatedId[$name]) && count($this->relatedId[$name]) > 0) {
                             $this->select->where($field . " = ?", current($this->relatedId[$name]));
                             for ($i = 1; $i < count($this->relatedId[$name]); $i++) {
                                 $this->select->orWhere($field . " = ?", $this->relatedId[$name][$i]);
                             }
                         } elseif (isset($this->relatedId[$name])) {
                             $this->select->where($field . " = ?", $this->relatedId[$name]);
                         }
                         $name .= "_" . $this->_getParam('ID');
                     }
                     $this->filename = $name . ".csv";
                     parent::toCsvAction();
                     if ($this->_ftpTransfer && $this->_exportFilesFolder) {
                         $ftp->setFileName($this->filename);
                         $ftp->setLocalFile($this->_exportFilesFolder . $this->filename);
                         $ftp->transfer();
                     }
                     //                        }
                 }
                 // return to list
                 $this->_redirect($returnUrl);
             }
         }
     }
 }
Пример #7
0
 /**
  * Export data according to given parameters.
  *
  * @return void
  */
 public function toExcelAction()
 {
     $this->type = 'XLS';
     $this->filename = 'Produit.xls';
     $lines = new ProductsObject();
     $this->tables = array('Catalog_ProductsData' => $lines->getDataColumns(), 'Catalog_ProductsIndex' => $lines->getIndexColumns());
     $this->view->params = $this->_getAllParams();
     $this->fields = array_merge($lines->getIndexColumns(), $lines->getDataColumns());
     $this->filters = array();
     $pageID = $this->_getParam('pageID');
     $langId = $this->_registry->languageID;
     $this->select = $lines->getAll($langId, false);
     parent::toExcelAction();
 }
Пример #8
0
 public function categoriesToExcelAction()
 {
     if ($this->view->aclIsAllowed($this->view->current_module, 'edit')) {
         $this->filename = 'Categories.xlsx';
         $this->tables = array('Categories' => array('C_ID'), 'CategoriesIndex' => array('CI_Title', 'CI_WordingShowAllRecords'));
         $this->fields = array('CI_Title' => array('label' => $this->view->getCibleText("list_column_{$this->_moduleID}_CI_Title")), 'CI_WordingShowAllRecords' => array());
         $this->filters = array();
         $this->select = $this->_db->select()->from('Categories', $this->tables['Categories'])->joinInner('CategoriesIndex', 'Categories.C_ID = CategoriesIndex.CI_CategoryID', $this->tables['CategoriesIndex'])->where('Categories.C_ModuleID = ?', Cible_FunctionsModules::getModuleIDByName($this->view->current_module))->where('CategoriesIndex.CI_LanguageID = ?', $this->_currentInterfaceLanguage);
         parent::toExcelAction();
     }
 }