public function __invoke($args)
 {
     if (count($args) < 1) {
         throw new OrongoScriptParseException("Arguments missing for Articles.GetCommentCount()");
     }
     $article = new Article($args[0]);
     $comments = $article->getComments();
     $ids = array();
     foreach ($comments as $comment) {
         if ($comment instanceof Comment == false) {
             continue;
         }
         $ids[count($ids)] = $comment->getID();
     }
     return new OrongoList($ids);
 }
Example #2
0
     }
     $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()), "");
         }
         $view->addObject($comments);
     }
     if (getUser()->getRank() < RANK_ADMIN) {
         $comments->hideTrashButton();
     }
     $view->render();
     break;
 case "comment":
     if (getUser()->getRank() < RANK_WRITER) {
         header("Location: " . orongoURL("orongo-admin/index.php?msg=0"));
         exit;
     }