Esempio n. 1
0
 /**
  * Deletes a post and its comments
  *
  * @return void
  */
 public function deleteAction()
 {
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = $this->getRequest();
     $pid = intval($request->getParam('pid'));
     $postModel = new Blog_Model_DbTable_Post();
     $post = $postModel->find($pid)->current();
     if ($post) {
         $post->delete();
     }
     $this->_redirect($this->urlHelper->url(array(), 'posts'));
 }
Esempio n. 2
0
 /**
  * Returns a pageable list of posts
  *
  * @return void
  */
 public function indexAction()
 {
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = $this->getRequest();
     $postsModel = new Blog_Model_DbTable_Post();
     $pageablePosts = $postsModel->getPageablePosts($request->getParam('page'), 5);
     $this->view->assign('paginator', $pageablePosts);
 }