/**
  * @param $Comment
  *	- ('reported') Shows only reported, non-good, non-deleted comments.
  *	- 'deleted' Shows only deleted comments.
  *	- int Comment ID.
  * @todo Use pages model.
  */
 function comment($Comment = 'reported', $CommentInclude = 1)
 {
     $valids = array('reported', 'deleted', 'good');
     if (!in_array($Comment, $valids)) {
         show_404();
     }
     if (!CheckPermissions('moderator')) {
         return;
     }
     $this->pages_model->SetPageCode('office_moderator_comments');
     $this->load->library('comment_views');
     $this->comment_views->SetUri('/office/moderator/comment/' . $Comment . '/');
     // create the views
     $comment_view_list = new CommentViewList();
     // get comments + thread
     if ('reported' === $Comment) {
         $comments = $this->comments_model->GetCommentsByThreadId(NULL, 'reported');
     } elseif ('deleted' === $Comment) {
         $comments = $this->comments_model->GetCommentsByThreadId(NULL, 'all', array('comments.comment_deleted = TRUE', '(comments.comment_deleted_entity_id IS NULL OR comments.comment_deleted_entity_id != comments.comment_author_entity_id)'));
     } elseif ('good' === $Comment) {
         $comments = $this->comments_model->GetCommentsByThreadId(NULL, 'all', array('comments.comment_good=TRUE'));
     }
     // send the data to the views
     $comment_view_list->SetComments($comments);
     // set which page of comments to show
     $comment_view_list->SetIncludedComment($CommentInclude);
     $comment_view_list->SetData('Mode', 'mod');
     $comment_view_list->SetUnthreaded();
     // Get the filter from the page properties
     $filter_name = $this->pages_model->GetPropertyText('filters[' . $Comment . '].name', FALSE, 'Comments');
     $filter_description = $this->pages_model->GetPropertyWikitext('filters[' . $Comment . '].description', FALSE, NULL);
     $this->main_frame->SetTitleParameters(array('filter' => $filter_name));
     $this->main_frame->SetContentSimple('office/moderator/comments', array('Comments' => $comment_view_list, 'Title' => $filter_name, 'Description' => $filter_description));
     // Load view
     $this->main_frame->Load();
 }
 /**
  * @param $ThreadId int,thread_array ID of thread or array information.
  * @param $CommentInclude int Number of a comment to include.
  * @return FramesView,NULL View class or NULL if unsuccessful
  */
 function CreateStandard($ThreadId, $CommentInclude = NULL)
 {
     // get comments + thread
     $CI =& get_instance();
     if (is_int($ThreadId)) {
         $thread = $CI->comments_model->GetThreadById($ThreadId);
     } else {
         $thread = $ThreadId;
     }
     if (NULL === $thread) {
         return NULL;
     }
     $thread_id = (int) $thread['thread_id'];
     // create the views
     $comment_view_thread = new CommentViewThread($thread_id);
     $comment_view_add = new CommentViewAdd($thread_id);
     $comment_view_list = new CommentViewList();
     // send the data to the views
     $comment_view_add->SetThread($thread);
     $comment_view_thread->SetThread($thread);
     // handle any form post data
     $comment_view_add->CheckPost();
     $comment_view_thread->CheckPost();
     $comments = $CI->comments_model->GetCommentsByThreadId($thread_id, 'all');
     $comment_view_list->SetComments($comments);
     // set which page of comments to show
     $comment_view_list->SetIncludedComment($CommentInclude);
     // overall layout
     $data = array('CommentThread' => &$comment_view_thread, 'CommentAdd' => &$comment_view_add, 'CommentList' => &$comment_view_list);
     return new FramesView('comments/standard', $data);
 }