Example #1
0
 $article = null;
 $view->setTitle("Viewing Article");
 try {
     $article = new Article($id);
 } catch (Exception $e) {
     if ($e->getCode() == ARTICLE_NOT_EXIST) {
         header("Location: " . orongoURL("orongo-admin/manage.php?msg=0&obj=articles"));
         exit;
     } else {
         header("Location: " . orongoURL("orongo-admin/index.php?msg=2"));
         exit;
     }
 }
 $form = new AdminFrontendForm(100, l("Article") . ": " . $article->getTitle(), "GET", "", false);
 $form->addInput("ID", "id", "text", $article->getID(), false, true);
 $form->addInput("Date", "date", "text", $article->getDate(), false, true);
 $form->addInput("Author", "author", "text", $article->getAuthorName(), false, true);
 $form->addInput("Article Title", "title", "text", $article->getTitle(), false, true);
 $form->addInput("Article Content", "content", "ckeditor", $article->getContent(), false, true);
 $form->addInput("Keywords", "keywords", "text", $article->getTagsString(), false, true);
 $form->addButton("Delete", false, orongoURL("orongo-admin/delete.php?article." . $id));
 $form->addButton("Edit", false, orongoURL("orongo-admin/edit.php?article." . $id));
 $view->addObject($form);
 if ($article->getCommentCount() > 0) {
     $comments = new AdminFrontendContentManager(100, "Comments");
     $comments->createTab("Comments", array("ID", "Comment", "Commenter", "Date"));
     $comments->hideEditButton();
     foreach ($article->getComments() as $comment) {
         $commentText = strlen($comment->getContent()) > 20 ? substr($comment->getContent(), 0, 20) . "..." : $comment->getContent();
         $comments->addItem("Comments", array($comment->getID(), '<a href="' . orongoURL('orongo-admin/view.php?comment.' . $comment->getID()) . '">' . $commentText . '</a>', '<a href="' . orongoURL("orongo-admin/view.php?user." . $comment->getAuthorID()) . '">' . $comment->getAuthorName() . '</a>', date("Y-m-d H:i:s", $comment->getTimestamp())), orongoURL("orongo-admin/delete.php?comment." . $comment->getID()), "");
     }
 public function getDate()
 {
     $this->__load();
     return parent::getDate();
 }