Пример #1
0
 /**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendGalleryModel::existsCategory($this->id)) {
         parent::execute();
         // is this category allowed to be deleted?
         if (!BackendGalleryModel::deleteCategoryAllowed($this->id)) {
             $this->redirect(BackendModel::createURLForAction('categories') . '&error=category-not-deletable');
         } else {
             // get category
             $this->record = BackendGalleryModel::getCategoryFromId($this->id);
             // delete category
             BackendGalleryModel::deleteCategoryById($this->id);
             BackendModel::triggerEvent($this->getModule(), 'after_delete_category', array('id' => $this->id));
             $this->redirect(BackendModel::createURLForAction('categories') . '&report=category-deleted&var=' . urlencode($this->record['title']));
         }
     } else {
         $this->redirect(BackendModel::createURLForAction('categories') . '&error=non-existing');
     }
 }
Пример #2
0
 /**
  * Get the data
  *
  * @return void
  */
 private function getData()
 {
     $this->record = BackendGalleryModel::getCategoryFromId($this->id);
 }