public function ViewComments($blogID, $postID) { //Calls the CommentDataAccess class and returns a ViewCommentsView. if (!BusinessLogic_Comment_CommentSecurity::GetInstance()->ViewComments($blogID, $postID)) { throw new Exception('Authentication failed.'); } $commentCollectionView = BusinessLogic_Comment_CommentDataAccess::GetInstance()->ViewComments($blogID, $postID); BusinessLogic_Comment_CommentSecurity::GetInstance()->ActivateControls($commentCollectionView, $blogID); return $commentCollectionView; }
public function ProcessDeletePost($blogID, $postID) { //Calls PostSecurity to determine if the user can delete a post. If so, it will call PostDataAccess.ProcessDeletePost() to delete the post. Otherwise, an exception is thrown. if (!BusinessLogic_Post_PostSecurity::GetInstance()->ProcessDeletePost($blogID, $postID)) { throw new Exception('Authentication failed.'); throw new Exception("Insufficient permissions."); } BusinessLogic_Post_PostDataAccess::GetInstance()->ProcessDeletePost($postID); BusinessLogic_Comment_CommentDataAccess::GetInstance()->ProcessDeleteAllComments($postID); }
private function SetCommentCounts() { //Sets the comment counts for each post in this collection. foreach ($this->posts as $key => $value) { $postIDs[$key] = $value->GetPostID(); } $commentCounts = BusinessLogic_Comment_CommentDataAccess::GetInstance()->GetCommentCounts($postIDs); foreach ($this->posts as $key => $value) { $value->SetCommentCount($commentCounts[$key]); } }