Exemplo n.º 1
0
 /**
  * Get the data
  */
 private function getData()
 {
     $this->id = $this->getParameter('id', 'int');
     if ($this->id == null || !BackendBlocksModel::existsCategory($this->id)) {
         $this->redirect(Model::createURLForAction('categories') . '&error=non-existing');
     }
     $this->record = BackendBlocksModel::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 || !BackendBlocksModel::existsCategory($this->id)) {
         $this->redirect(Model::createURLForAction('categories') . '&error=non-existing');
     }
     // fetch the category
     $this->record = (array) BackendBlocksModel::getCategory($this->id);
     // delete item
     BackendBlocksModel::deleteCategory($this->id);
     Model::triggerEvent($this->getModule(), 'after_delete_category', array('item' => $this->record));
     // category was deleted, so redirect
     $this->redirect(Model::createURLForAction('categories') . '&report=deleted-category&var=' . urlencode($this->record['title']));
 }