Exemplo n.º 1
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->id = $this->getParameter('id', 'int');
     if ($this->id == null || !BackendCatalogModel::existsCategory($this->id)) {
         $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing');
     }
     $this->record = BackendCatalogModel::getCategory($this->id);
 }
Exemplo n.º 2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id == null || !BackendCatalogModel::existsCategory($this->id)) {
         $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing');
     }
     // fetch the category
     $this->record = (array) BackendCatalogModel::getCategory($this->id);
     // delete item
     BackendCatalogModel::deleteCategory($this->id);
     // trigger event
     BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('item' => $this->record));
     // category was deleted, so redirect
     $this->redirect(BackendModel::createURLForAction('categories') . '&report=deleted-category&var=' . urlencode($this->record['title']));
 }
Exemplo 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::existsCategory($id)) {
             BackendCatalogModel::updateCategory($item);
         }
     }
     // success output
     $this->output(self::OK, null, 'sequence updated');
 }