/**
  * show the contents of the view
  */
 function render()
 {
     // load the comments and throw the correct event
     $comments = new ArticleComments();
     $postComments = $comments->getPostComments($this->_article->getId(), COMMENT_ORDER_NEWEST_FIRST, $this->_commentStatus, $this->_page, DEFAULT_ITEMS_PER_PAGE);
     $this->notifyEvent(EVENT_COMMENTS_LOADED, array("comments", &$postComments));
     // number of comments
     $numPostComments = $comments->getNumPostComments($this->_article->getId(), $this->_commentStatus);
     if ($this->_commentStatus > -1) {
         $pagerUrl = "?op=editComments&articleId=" . $this->_article->getId() . "&showStatus=" . $this->_commentStatus . "&page=";
     } else {
         $pagerUrl = "?op=editComments&articleId=" . $this->_article->getId() . "&page=";
     }
     // calculate the pager url
     $pager = new Pager($pagerUrl, $this->_page, $numPostComments, DEFAULT_ITEMS_PER_PAGE);
     // get a list with all the different comment status
     $statusList = ArticleCommentStatus::getStatusList(true);
     // and pass all the information to the templates
     $this->setValue("comments", $postComments);
     $this->setValue("commentstatus", $statusList);
     $this->setValue("currentstatus", $this->_commentStatus);
     // pass the pager to the view
     $this->setValue("pager", $pager);
     +$this->setValue("post", $this->_article);
     parent::render();
 }
コード例 #2
0
 /**
  * returns whether a status has previously been defined or not
  *
  * @param status
  * @return true if valid status or false otherwise
  */
 function isValidStatus($status)
 {
     // check if the status is valid
     if ($status == "") {
         return false;
     }
     $isValid = in_array($status, ArticleCommentStatus::getStatusList());
     return $isValid;
 }