public function statusAction() { $id = $this->_getParam('id'); $model = new Application_Model_Articles(); $val = $model->find($id); if ($val->getStatus() == 1) { $msg = "Article has been unpublished successfully!"; $val->setStatus(0); } else { $msg = "Article has been published successfully!"; $val->setStatus(1); } $val->save(); $_SESSION['errorMsg'] = $msg; return $this->_helper->redirector('index', 'articles', "admin"); }
public function articleDetailAction() { //$this->_helper->viewRenderer->setNoRender(true); $blockM = new Base_View_Block(); $path = "/layouts/scripts/page/blocks/work-study-volunteer"; $blockM->removeBlock("work-study-volunteer-categories", 'work-study-volunteer'); $params = $this->getRequest()->getParams(); $article_id = $params['id']; $preview = false; $preview = $this->_getParam("preview"); $categoryM = new Application_Model_Category(); $articleM = new Application_Model_Articles(); $data = $articleM->find($article_id); if (false != $data) { $this->view->article = $data; $this->view->preview = $preview; $this->view->categoryId = $categoryId = $data->getCategoryId(); $this->view->categoryM = $categoryM->find($categoryId); $allarticles = $articleM->fetchAll("category_id = {$categoryId} and id != {$article_id}"); /** * @Added By: Mahipal Adhikari * @Added On: 29-Dec-2010 * @Description: get Article user information to display as Author */ $userM = new Application_Model_User(); $userRes = $userM->find($data->getUserId()); $Author = "Admin"; if (false !== $userRes) { $Author = $userRes->getFirstName() . " " . $userRes->getLastName(); $this->view->author = $Author; $this->view->author_username = $userRes->getUsername(); } if (count($allarticles) > 0) { $this->view->allarticles = $allarticles; $blocks = array("name" => "work-study-volunteer-articles", "order" => "8", "path" => $path); $blockM->addBlock($blocks, 'work-study-volunteer'); } } }