/**
  * Adds no_follow toggle action to process routing
  */
 public function initProcess()
 {
     parent::initProcess();
     // @TODO Refactor 'if' statement to match other controllers, the way they add extra actions
     if (empty($this->action) && Tools::getValue($this->identifier)) {
         if (Tools::getIsset('no_follow' . $this->table) || Tools::getIsset('no_follow')) {
             if ($this->tabAccess['edit'] === '1') {
                 $this->action = 'no_follow';
             } else {
                 $this->errors[] = Tools::displayError('You do not have permission to edit this.');
             }
         }
     }
 }
 /**
  * @return mixed
  */
 public function initProcess()
 {
     if (Tools::getIsset('detailsnow_block_cms_footer_column')) {
         $this->list_id = 'details';
         if (isset($_POST['submitReset' . $this->list_id])) {
             $this->processResetFilters();
         }
     } elseif (Tools::getIsset('addnow_block_cms_footer') || Tools::getIsset('updatenow_block_cms_footer')) {
         if ($this->tabAccess['add'] === '1') {
             $this->action = 'new';
             $this->display = 'add';
         } else {
             $this->errors[] = Tools::displayError('You do not have permission to add this.');
         }
     } else {
         $this->list_id = 'column';
     }
     return parent::initProcess();
 }
 public function initProcess()
 {
     parent::initProcess();
 }
Esempio n. 4
0
 /**
  * @see ModuleAdminController::initProcess()
  */
 public function initProcess()
 {
     $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Delete selected items?')));
     parent::initProcess();
 }
 public function initProcess()
 {
     if (!$this->action) {
         parent::initProcess();
     } else {
         $this->id_object = (int) Tools::getValue($this->identifier);
     }
 }
 public function initProcess()
 {
     // Are we working on feature values?
     if (Tools::getValue('id_feature_value') || Tools::isSubmit('deletefeature_value') || Tools::isSubmit('submitAddfeature_value') || Tools::isSubmit('addfeature_value') || Tools::isSubmit('updatefeature_value') || Tools::isSubmit('submitBulkdeletefeature_value')) {
         $this->setTypeValue();
     }
     if (Tools::getIsset('viewfeature')) {
         $this->list_id = 'feature_value';
         $this->_defaultOrderBy = 'position';
         $this->_defaultOrderWay = 'ASC';
         if (isset($_POST['submitReset' . $this->list_id])) {
             $this->processResetFilters();
         }
     } else {
         $this->list_id = 'feature';
         $this->_defaultOrderBy = 'position';
         $this->_defaultOrderWay = 'ASC';
     }
     parent::initProcess();
 }
 public function initProcess()
 {
     if (Tools::isSubmit('submitAddproduct_shopAndStay') || Tools::isSubmit('submitAddproduct_shop')) {
         $id_product = (int) Tools::getValue('id_product');
         $id_shop = (int) Tools::getValue('id_shop');
         $this->object = new Product($id_product, false, (int) Context::getContext()->language->id, $id_shop);
     }
     if (!$this->action) {
         parent::initProcess();
     } else {
         list($this->id_product, $this->id_shop) = explode('-', Tools::getValue('id_ps'));
         $this->id_object = Tools::getValue('id_ps');
     }
 }
Esempio n. 8
0
 public function initProcess()
 {
     parent::initProcess();
     if (Tools::isSubmit('deleteImg') && Tools::getValue('id_img')) {
         $this->action = 'postimage';
     }
 }
 public function initProcess()
 {
     // Shop images management
     if (Tools::getValue('id_image') && Tools::getValue('ajax')) {
         if ($this->tabAccess['edit'] === '1') {
             $this->action = 'image';
         } else {
             $this->errors[] = Tools::displayError('You do not have permission to edit this.');
         }
     } elseif (Tools::isSubmit('id_shop')) {
         $post_max_size = Tools::getMaxUploadSize(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1024 * 1024);
         if ($post_max_size && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] && $_SERVER['CONTENT_LENGTH'] > $post_max_size) {
             $this->errors[] = sprintf(Tools::displayError('The uploaded file exceeds the "Maximum size for a downloadable product" set in preferences (%1$dMB) or the post_max_size/ directive in php.ini (%2$dMB).'), number_format(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE')), $post_max_size / 1024 / 1024);
         }
     }
     if (!$this->action) {
         parent::initProcess();
     } else {
         $this->id_object = (int) Tools::getValue($this->identifier);
     }
     if (isset($this->available_tabs[Tools::getValue('key_tab')])) {
         $this->tab_display = Tools::getValue('key_tab');
     }
     // Set tab to display if not decided already
     if (!$this->tab_display && $this->action) {
         if (in_array($this->action, array_keys($this->available_tabs))) {
             $this->tab_display = $this->action;
         }
     }
     // And if still not set, use default
     if (!$this->tab_display) {
         if (in_array($this->default_tab, $this->available_tabs)) {
             $this->tab_display = $this->default_tab;
         } else {
             $this->tab_display = key($this->available_tabs);
         }
     }
 }
 public function initProcess()
 {
     // Product images management
     if (Tools::getValue('id_image') && Tools::getValue('ajax')) {
         if ($this->tabAccess['edit'] === '1') {
             $this->action = 'image';
         } else {
             $this->errors[] = Tools::displayError('You do not have permission to edit this.');
         }
     } elseif (Tools::isSubmit('id_product')) {
         $post_max_size = Tools::getMaxUploadSize(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE') * 1024 * 1024);
         if ($post_max_size && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] && $_SERVER['CONTENT_LENGTH'] > $post_max_size) {
             $this->errors[] = sprintf(Tools::displayError('The uploaded file exceeds the "Maximum size for a downloadable product" set in preferences (%1$dMB) or the post_max_size/ directive in php.ini (%2$dMB).'), number_format(Configuration::get('PS_LIMIT_UPLOAD_FILE_VALUE')), $post_max_size / 1024 / 1024);
         }
     }
     if (!$this->action) {
         parent::initProcess();
     } else {
         $this->id_object = (int) Tools::getValue($this->identifier);
     }
 }