Example #1
0
 private function getFullNoteObject($noteId)
 {
     $note = Module::queryObject("SELECT * FROM notes WHERE note_id = '{$noteId}'");
     if (!$note) {
         return null;
     }
     $player = Module::queryObject("SELECT * FROM players WHERE player_id = '{$note->owner_id}'");
     $location = Module::queryObject("SELECT * FROM locations WHERE game_id = '{$note->game_id}' AND type = 'PlayerNote' AND type_id = '{$noteId}'");
     $fullNote = new stdClass();
     $fullNote->owner = new stdClass();
     $fullNote->owner->player_id = $player->player_id;
     $fullNote->owner->user_name = $player->user_name;
     $fullNote->owner->display_name = $player->display_name != "" ? $player->display_name : $player->user_name;
     $fullNote->note_id = $note->note_id;
     $fullNote->game_id = $note->game_id;
     $fullNote->title = $note->title;
     $fullNote->description = $note->description;
     $fullNote->location = new stdClass();
     $fullNote->location->latitude = $location ? $location->latitude : 0;
     $fullNote->location->longitude = $location ? $location->longitude : 0;
     $fullNote->created = $note->created;
     $fullNote->contents = Notebook::getNoteContents($noteId);
     $fullNote->comments = Notebook::getNoteComments($noteId);
     $fullNote->tags = Notebook::getNoteTags($noteId, $note->game_id);
     $fullNote->likes = Notebook::getNoteLikes($noteId);
     $fullNote->public_to_map = $note->public_to_map;
     $fullNote->public_to_list = $note->public_to_notebook;
     return $fullNote;
 }