Ejemplo n.º 1
0
 public static function getDetailedFullNoteObject($noteId, $playerId = 0)
 {
     $query = "SELECT note_id, game_id, owner_id, title, public_to_map, public_to_notebook, created FROM notes WHERE note_id = '{$noteId}'";
     $result = Module::query($query);
     if (mysql_error()) {
         return new returnData(1, NULL, mysql_error());
     }
     if ($note = mysql_fetch_object($result)) {
         $query = "SELECT user_name FROM players WHERE player_id = '{$note->owner_id}'";
         $player = Module::query($query);
         $playerObj = mysql_fetch_object($player);
         $note->username = $playerObj->user_name;
         $note->displayname = $playerObj->display_name;
         $note->contents = Notes::getNoteContentsAPI($noteId);
         $note->comments = Notes::getNoteCommentsAPI($noteId, $playerId);
         $note->tags = Notes::getNoteTagsAPI($noteId, $note->game_id);
         $note->likes = Notes::getNoteLikesAPI($noteId);
         $note->player_liked = $playerId == 0 ? 0 : Notes::playerLikedAPI($playerId, $noteId);
         $note->icon_media_id = 5;
         if ($note->dropped = Notes::noteDropped($noteId, $note->game_id)) {
             $location = Notes::getNoteLocation($noteId, $note->game_id);
         } else {
             $location = new stdClass();
             $location->lat = $location->lon = 0;
         }
         $note->lat = $location->lat;
         $note->lon = $location->lon;
         return $note;
     }
     return;
 }