Beispiel #1
0
 public function action_edit()
 {
     $article_id = $this->request->param('article_id');
     $article = Model_Article::get($article_id);
     $this->view["article"] = $article;
     // $this->view["editor"] = View::factory('templates/articles/editor', array("storedNodes" => $article->text));
     $content = View::factory('templates/admin/articles/edit', $this->view);
     $this->template->content = View::factory("templates/admin/wrapper", array("active" => "edit", "content" => $content));
 }
Beispiel #2
0
 public function action_delete()
 {
     $user_id = $this->user->id;
     $article_id = $this->request->param('article_id');
     if (!empty($article_id) && !empty($user_id)) {
         Model_Article::get($article_id)->remove($user_id);
     }
     $this->redirect('/admin/articles');
 }
Beispiel #3
0
 public function action_showArticle()
 {
     $articleId = $this->request->param('article_id');
     $this->view["id"] = $articleId;
     $article = Model_Article::get($articleId);
     if ($article->id == 0) {
         throw new HTTP_Exception_404();
     }
     $this->stats->hit(Model_Stats::ARTICLE, $articleId);
     $this->view["article"] = $article;
     $this->title = $article->title;
     $comments = Model_Comment::getCommentsByArticle($articleId);
     $comments_table_rebuild = $this->methods->rebuildCommentsTree($comments);
     $this->view["comments"] = $comments_table_rebuild;
     $this->template->content = View::factory('templates/articles/article', $this->view);
 }