Example #1
0
 /**
  * Get the number of items posted by this user for each catagory
  *
  * @return array with the activity for each content type.
  */
 public function getActivity()
 {
     // Get the number of questions posted
     $question = new \Bjurnemark\Question\Question();
     $question->setDI($this->di);
     $numQuestions = $question->getUserStats($this->id);
     // Get the number of answers posted
     $answer = new \Bjurnemark\Answer\Answer();
     $answer->setDI($this->di);
     $numAnswers = $answer->getUserStats($this->id);
     // Get the number of comments posted
     $comment = new \Bjurnemark\Comment\Comment();
     $comment->setDI($this->di);
     $numComments = $comment->getUserStats($this->id);
     $activity = ['numQuestions' => $numQuestions['count'], 'numAnswers' => $numAnswers['count'], 'numComments' => $numComments['count'], 'points' => $numQuestions['count'] * VAL_QUESTION + $numAnswers['count'] * VAL_ANSWER + $numComments['count'] * VAL_COMMENT + ($numQuestions['score'] + $numAnswers['score'] + $numComments['score']) * VAL_SCORE];
     return $activity;
 }