Exemplo n.º 1
0
 public function deleteAction()
 {
     $this->setInvokeArg('noViewRenderer', true);
     $id = $this->getRequest()->getPost('id');
     if (is_numeric($id)) {
         Model_Forum::delete($id);
     } elseif (strpos($id, 'comment_') !== false) {
         $id = str_replace('comment_', '', $id);
         Model_Forum::deleteComment($id);
     }
 }
Exemplo n.º 2
0
 /**
  * CRUD controller: DELETE
  */
 public function action_delete()
 {
     $this->auto_render = FALSE;
     $forum = new Model_Forum($this->request->param('id'));
     //update the elements related to that ad
     if ($forum->loaded()) {
         try {
             $forum->delete();
             $this->template->content = 'OK';
             Core::delete_cache();
             Alert::set(Alert::SUCCESS, __('Forum deleted'));
         } catch (Exception $e) {
             Alert::set(Alert::ERROR, $e->getMessage());
         }
     } else {
         Alert::set(Alert::ERROR, __('Forum not deleted'));
     }
     HTTP::redirect(Route::url('oc-panel', array('controller' => 'forum', 'action' => 'index')));
 }