Example #1
0
 public function SettingsController_DashboardData_Handler(&$Sender)
 {
     $DiscussionModel = new Gdn_DiscussionModel();
     // Number of Discussions
     $CountDiscussions = $DiscussionModel->GetCount();
     $Sender->AddDefinition('CountDiscussions', $CountDiscussions);
     $Sender->BuzzData[Gdn::Translate('Discussions')] = number_format($CountDiscussions);
     // Number of New Discussions in the last day
     $Sender->BuzzData[Translate('New discussions in the last day')] = number_format($DiscussionModel->GetCount(array('d.DateInserted >=' => Format::ToDateTime(strtotime('-1 day')))));
     // Number of New Discussions in the last week
     $Sender->BuzzData[Translate('New discussions in the last week')] = number_format($DiscussionModel->GetCount(array('d.DateInserted >=' => Format::ToDateTime(strtotime('-1 week')))));
     $CommentModel = new Gdn_CommentModel();
     // Number of Comments
     $CountComments = $CommentModel->GetCountWhere();
     $Sender->AddDefinition('CountComments', $CountComments);
     $Sender->BuzzData[Gdn::Translate('Comments')] = number_format($CountComments);
     // Number of New Comments in the last day
     $Sender->BuzzData[Translate('New comments in the last day')] = number_format($CommentModel->GetCountWhere(array('DateInserted >=' => Format::ToDateTime(strtotime('-1 day')))));
     // Number of New Comments in the last week
     $Sender->BuzzData[Translate('New comments in the last week')] = number_format($CommentModel->GetCountWhere(array('DateInserted >=' => Format::ToDateTime(strtotime('-1 week')))));
 }
Example #2
0
 public function RecordActivity($ReplyCommentID, $ActivityUserID, $CommentID)
 {
     // Get the author of the discussion
     $CommentModel = new Gdn_CommentModel();
     $Comment = $CommentModel->GetID($ReplyCommentID);
     if ($ActivityUserID != $Comment->InsertUserID) {
         AddActivity($ActivityUserID, 'CommentReply', '', $Comment->InsertUserID, 'discussion/reply/' . $CommentID . '/#Comment_' . $ReplyCommentID);
     }
 }