示例#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);
 }
示例#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']));
 }
示例#3
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     $this->categoryId = \SpoonFilter::getGetValue('category', null, null, 'int');
     if ($this->categoryId == 0) {
         $this->categoryId = null;
     } else {
         // get category
         $this->category = BackendCatalogModel::getCategory($this->categoryId);
         // reset
         if (empty($this->category)) {
             // reset GET to trick Spoon
             $_GET['category'] = null;
             // reset
             $this->categoryId = null;
         }
     }
     $this->loadDataGrid();
     $this->parse();
     $this->display();
 }