function edit($CommentId = NULL) { $redirect_to = implode('/', array_slice($this->uri->rsegment_array(), 3)); $property_arguments = array('verb' => 'edit', 'verbed' => 'edited'); if (!$this->_DecideEditPrivilages($CommentId, $redirect_to, $comment, $thread, $property_arguments)) { return; } $this->load->library('comment_views'); $main_view = new CommentViewAdd($comment['thread_id']); $main_view->SetThread($thread); // Do the main processing if any post data $main_view->SetExistingComment($comment); if ($main_view->CheckPost()) { redirect($redirect_to); } // Display the page. $this->pages_model->SetPageCode('comment_edit'); $this->main_frame->SetContent($main_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); }