Example #1
0
 /**
  * Draws the Kudos users list.
  *
  * @param Controller $Sender
  * @param int $Json
  * @return void
  */
 public function _DrawVotes(&$Sender, $Json = false)
 {
     if (!C('Plugins.Kudos.Enabled')) {
         return;
     }
     if ($Sender->EventArguments['Type'] == 'Discussion') {
         $Kudos = $this->KudosModel->GetDiscussionKudos($Sender->EventArguments['Object']->DiscussionID);
     } else {
         $Kudos = $this->KudosModel->GetCommentKudos($Sender->EventArguments['Object']->CommentID);
     }
     if (!$Sender->EventArguments['Object']) {
         if ($this->CommentID) {
             $Kudos = $this->KudosModel->GetCommentKudos($this->CommentID);
         } else {
             $Kudos = $this->KudosModel->GetDiscussionKudos($this->DiscussionID);
         }
     }
     $Sender->ItemLoves = $Kudos['l'];
     $Sender->ItemHates = $Kudos['h'];
     $Display = $Sender->FetchView($this->GetView('likes.php'));
     unset($Sender->ItemLoves);
     unset($Sender->ItemHates);
     if ($Json) {
         return $Display;
     }
     echo $Display;
 }