Ejemplo n.º 1
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->id = $this->getParameter('id', 'int');
     if ($this->id == null || !BackendCatalogModel::existsBrand($this->id)) {
         $this->redirect(BackendModel::createURLForAction('brands') . '&error=non-existing');
     }
     $this->record = BackendCatalogModel::getBrand($this->id);
 }
Ejemplo n.º 2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id == null || !BackendCatalogModel::existsBrand($this->id)) {
         $this->redirect(BackendModel::createURLForAction('brands') . '&error=non-existing');
     }
     // fetch the brand
     $this->record = (array) BackendCatalogModel::getBrand($this->id);
     // delete item
     BackendCatalogModel::deleteBrand($this->id);
     // trigger event
     BackendModel::triggerEvent($this->getModule(), 'after_delete_brand', array('item' => $this->record));
     // brand was deleted, so redirect
     $this->redirect(BackendModel::createURLForAction('brands') . '&report=deleted-brand&var=' . urlencode($this->record['title']));
 }
Ejemplo n.º 3
0
 public function execute()
 {
     parent::execute();
     // get parameters
     $newIdSequence = trim(\SpoonFilter::getPostValue('new_id_sequence', null, '', 'string'));
     // list id
     $ids = (array) explode(',', rtrim($newIdSequence, ','));
     // loop id's and set new sequence
     foreach ($ids as $i => $id) {
         $item['id'] = $id;
         $item['sequence'] = $i + 1;
         // update sequence
         if (BackendCatalogModel::existsBrand($id)) {
             BackendCatalogModel::updateBrand($item);
         }
     }
     // success output
     $this->output(self::OK, null, 'sequence updated');
 }