/**
  * Execute the action
  */
 public function execute()
 {
     $this->id = $this->getParameter('id', 'int');
     // does the item exist
     if ($this->id !== null && BackendGalleriaModel::existsCategory($this->id)) {
         parent::execute();
         // is this category allowed to be deleted?
         if (!BackendGalleriaModel::deleteCategoryAllowed($this->id)) {
             $this->redirect(BackendModel::createURLForAction('categories') . '&error=category-not-deletable');
         } else {
             // get category
             $this->record = BackendGalleriaModel::getCategoryFromId($this->id);
             // delete category
             BackendGalleriaModel::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');
     }
 }
 /**
  * Parse the form
  *
  * @return void
  */
 protected function parse()
 {
     // call parent
     parent::parse();
     // assign the category
     $this->tpl->assign('category', $this->record);
     // can the category be deleted?
     if (BackendGalleriaModel::deleteCategoryAllowed($this->id)) {
         $this->tpl->assign('showDelete', true);
     }
 }