Exemple #1
0
 private function getNoteComments($noteId)
 {
     $commentIds = Module::queryArray("SELECT * FROM notes WHERE parent_note_id = '{$noteId}'");
     $comments = array();
     for ($i = 0; $i < count($commentIds); $i++) {
         $player = Module::queryObject("SELECT * FROM players WHERE player_id = '{$commentIds[$i]->owner_id}'");
         $comment = new stdClass();
         $comment->owner = new stdClass();
         $comment->owner->player_id = $player->player_id;
         $comment->owner->user_name = $player->user_name;
         $comment->owner->display_name = $player->display_name;
         $comment->comment_id = $commentIds[$i]->note_id;
         $comment->game_id = $commentIds[$i]->game_id;
         $comment->text = $commentIds[$i]->title . $commentIds[$i]->description;
         $comment->created = $commentIds[$i]->created;
         $comment->likes = Notebook::getNoteLikes($commentIds[$i]->note_id);
         $comments[] = $comment;
     }
     return $comments;
 }