本文整理汇总了PHP中Media::getMediaObject方法的典型用法代码示例。如果您正苦于以下问题:PHP Media::getMediaObject方法的具体用法?PHP Media::getMediaObject怎么用?PHP Media::getMediaObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Media
的用法示例。
在下文中一共展示了Media::getMediaObject方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllImageMatchEntriesForLocation
public function getAllImageMatchEntriesForLocation($gameId, $intLocationID)
{
$query = "SELECT match_media_id FROM qrcodes WHERE game_id = {$gameId} AND link_id = {$intLocationID}";
$result = Module::query($query);
$medias = array();
while ($mid = mysql_fetch_object($result)) {
$medias[] = Media::getMediaObject($gameId, $mid->match_media_id);
}
return new returnData(0, $medias);
}
示例2: getNoteContents
private function getNoteContents($noteId)
{
$contentIds = Module::queryArray("SELECT * FROM note_content WHERE note_id = '{$noteId}'");
$contents = array();
for ($i = 0; $i < count($contentIds); $i++) {
$media = Media::getMediaObject($contentIds[$i]->game_id, $contentIds[$i]->media_id)->data;
$content = new stdClass();
$content->content_id = $contentIds[$i]->content_id;
$content->type = $contentIds[$i]->type;
$content->media_id = $contentIds[$i]->media_id;
$content->text = $contentIds[$i]->text;
//LEGACY
$content->file_path = $media->file_path;
$content->thumb_file_path = $media->thumb_file_path;
$content->url_path = $media->url_path;
$content->url = $media->url;
$content->thumb_url = $media->thumb_url;
$contents[] = $content;
}
return $contents;
}
示例3: getSinglePlayerDataBP
private static function getSinglePlayerDataBP($gameId, $playerId, $individual = false, $getItems = true, $getAttributes = true, $getNotes = true)
{
$backpack = new stdClass();
//Get owner information
$query = "SELECT user_name, display_name, group_name, media_id FROM players WHERE player_id = '{$playerId}'";
$result = Module::query($query);
$name = mysql_fetch_object($result);
if (!$name) {
return "Invalid Player Id";
}
$backpack->owner = new stdClass();
$backpack->owner->user_name = $name->user_name;
$backpack->owner->display_name = $name->display_name;
$backpack->owner->group_name = $name->group_name;
$backpack->owner->player_id = $playerId;
$playerpic = Media::getMediaObject('player', $name->media_id)->data;
if ($playerpic) {
$backpack->owner->player_pic_url = $playerpic->url_path . $playerpic->file_path;
$backpack->owner->player_pic_thumb_url = $playerpic->url_path . $playerpic->thumb_file_path;
} else {
$backpack->owner->player_pic_url = null;
$backpack->owner->player_pic_thumb_url = null;
}
/* ATTRIBUTES */
if ($getAttributes) {
$backpack->attributes = Items::getDetailedPlayerAttributes($playerId, $gameId);
}
/* OTHER ITEMS */
if ($getItems) {
$backpack->items = Items::getDetailedPlayerItems($playerId, $gameId);
}
/* NOTES */
if ($getNotes) {
$backpack->notes = Notes::getDetailedPlayerNotes($playerId, $gameId, $individual);
}
return $backpack;
}
示例4: getNoteContents
function getNoteContents($noteId, $gameId)
{
$query = "SELECT * FROM note_content WHERE note_id = '{$noteId}'";
$result = Module::query($query);
if (mysql_error()) {
return new returnData(1, NULL, mysql_error());
}
$contents = array();
while ($content = mysql_fetch_object($result)) {
$content->media = Media::getMediaObject($gameId, $content->media_id);
$contents[] = $content;
}
return $contents;
}
示例5: getFullGameObject
public function getFullGameObject($gameId, $intPlayerId, $boolGetLocationalInfo = 0, $intSkipAtDistance = 99999999, $latitude = 0, $longitude = 0)
{
$gameObj = Module::queryObject("SELECT * FROM games WHERE game_id = '{$gameId}' LIMIT 1");
//Check if Game Has Been Played
$query = "SELECT * FROM player_log WHERE game_id = '{$gameId}' AND player_id = '{$intPlayerId}' AND deleted = 0 LIMIT 1";
$result = Module::query($query);
if (mysql_num_rows($result) > 0) {
$gameObj->has_been_played = true;
} else {
$gameObj->has_been_played = false;
}
//Get Locational Stuff
if ($boolGetLocationalInfo) {
if ($gameObj->is_locational == true) {
$nearestLocation = Games::getNearestLocationOfGameToUser($latitude, $longitude, $gameId);
$gameObj->latitude = $nearestLocation->latitude;
$gameObj->longitude = $nearestLocation->longitude;
$gameObj->distance = $nearestLocation->distance;
if ($gameObj->distance == NULL || $gameObj->distance > $intSkipAtDistance) {
return NULL;
}
} else {
$gameObj->latitude = 0;
$gameObj->longitude = 0;
$gameObj->distance = 0;
}
}
//Get Quest Stuff
//$questsReturnData = Quests::getQuestsForPlayer($gameId, $intPlayerId);
//$gameObj->totalQuests = $questsReturnData->data->totalQuests;
//$gameObj->completedQuests = count($questsReturnData->data->completed);
//Get Editors
$query = "SELECT editors.* FROM editors, game_editors\n WHERE game_editors.editor_id = editors.editor_id\n AND game_editors.game_id = {$gameId}";
$editorsRs = Module::query($query);
$editor = @mysql_fetch_array($editorsRs);
$editorsString = $editor['name'];
while ($editor = @mysql_fetch_array($editorsRs)) {
$editorsString .= ', ' . $editor['name'];
}
$gameObj->editors = $editorsString;
//Get Num Players
$query = "SELECT * FROM players\n WHERE last_game_id = {$gameId}";
$playersRs = Module::query($query);
$gameObj->numPlayers = @mysql_num_rows($playersRs);
//Get the media URLs
//Icon
$icon_media_data = Media::getMediaObject($gameId, $gameObj->icon_media_id);
$icon_media = $icon_media_data->data;
$gameObj->icon_media_url = $icon_media->url_path . $icon_media->file_path;
//Media
$media_data = Media::getMediaObject($gameId, $gameObj->media_id);
$media = $media_data->data;
$gameObj->media_url = $media->url_path . $media->file_path;
//Calculate the rating
$query = "SELECT AVG(rating) AS rating FROM game_comments WHERE game_id = {$gameId}";
$avRs = Module::query($query);
$avRecord = @mysql_fetch_object($avRs);
$gameObj->rating = $avRecord->rating;
if ($gameObj->rating == NULL) {
$gameObj->rating = 0;
}
//Getting Comments
$query = "SELECT * FROM game_comments WHERE game_id = {$gameId}";
$result = Module::query($query);
$comments = array();
$x = 0;
while ($row = mysql_fetch_assoc($result)) {
$comments[$x]->playerId = $row['player_id'];
$query = "SELECT user_name FROM players WHERE player_id = '{$comments[$x]->playerId}'";
$player = Module::query($query);
$playerOb = mysql_fetch_assoc($player);
$comments[$x]->username = $playerOb['user_name'];
$comments[$x]->rating = $row['rating'];
$comments[$x]->text = $row['comment'] == 'Comment' ? "" : $row['comment'];
$x++;
}
$gameObj->comments = $comments;
//Calculate score
$gameObj->calculatedScore = ($gameObj->rating - 3) * $x;
$gameObj->numComments = $x;
return $gameObj;
}
示例6: hydrateContent
private function hydrateContent($content, $gameId)
{
if ($content->content_type == 'Node') {
$contentDetails = Nodes::getNode($gameId, $content->content_id)->data;
$content->name = $contentDetails->title;
} else {
if ($content->content_type == 'Item') {
$contentDetails = Items::getItem($gameId, $content->content_id)->data;
$content->name = $contentDetails->name;
} else {
if ($content->content_type == 'Npc') {
$contentDetails = Npcs::getNpc($gameId, $content->content_id)->data;
$content->name = $contentDetails->name;
} else {
if ($content->content_type == 'WebPage') {
$contentDetails = WebPages::getWebPage($gameId, $content->content_id)->data;
$content->name = $contentDetails->name;
$content->media = NULL;
$content->media_id = NULL;
} else {
if ($content->content_type == 'AugBubble') {
$contentDetails = AugBubbles::getAugBubble($gameId, $content->content_id)->data;
$content->name = $contentDetails->name;
$content->media = NULL;
$content->media_id = NULL;
} else {
if ($content->content_type == 'CustomMap') {
$contentDetails = Overlays::getOverlay($gameId, $content->content_id)->data;
$content->name = $contentDetails->name;
} else {
if ($content->content_type == 'PlayerNote') {
$contentDetails = Notes::getNoteById($content->content_id)->data;
$content->name = $contentDetails->title;
$content->icon_media_id = 5;
$content->media = NULL;
$content->media_id = NULL;
}
}
}
}
}
}
}
//Get the Icon Media
$mediaHelper = new Media();
$mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->icon_media_id);
$media = $mediaReturnObject->data;
$content->icon_media = $media;
$content->icon_media_id = $contentDetails->icon_media_id;
$content->is_spawnable = Spawnables::hasActiveSpawnable($gameId, $content->content_type, $content->content_id);
if ($content->content_type != 'WebPage' && $content->content_type != 'PlayerNote' && $content->content_type != 'AugBubble' && $content->content_type != 'CustomMap') {
//Get the Media
$mediaHelper = new Media();
$mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->media_id);
$media = $mediaReturnObject->data;
$content->media = $media;
$content->media_id = $contentDetails->media_id;
}
/* Depricated
if ($content->content_type == 'AugBubble'){
//Get the Alignment Media
$mediaHelper = new Media;
$mediaReturnObject = $mediaHelper->getMediaObject($gameId, $contentDetails->alignment_media_id);
$alignmentMedia = $mediaReturnObject->data;
$content->alignment_media = $alignmentMedia;
$content->alignment_media_id = $alignmentMedia->media_id;
}
*/
return $content;
}
示例7: getPlayerLogs
//.........这里部分代码省略.........
}
if (!preg_match("/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/", $reqStartDate)) {
$reqStartDate = "0000-00-00 00:00:00";
}
if (!preg_match("/\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}/", $reqEndDate)) {
$reqEndDate = "9999-00-00 00:00:00";
}
if (!$iknowwhatimdoing && floor(abs(strtotime($reqEndDate) - strtotime($reqStartDate)) / (60 * 60 * 24 * 31)) > 0) {
return new returnData(1, NULL, "Please don't ask for more than a month of data at a time!");
}
if (!is_numeric($reqGetExpired)) {
$reqGetExpired = 0;
} else {
if (intval($reqGetExpired) > 0) {
$reqGetExpired = 1;
}
}
if (!is_numeric($reqVerbose)) {
$reqVerbose = 0;
} else {
if (intval($reqVerbose) > 0) {
$reqVerbose = 1;
}
}
$playerLogs = array();
if ($filterMode == "group") {
$p = Module::queryArray("SELECT player_id, display_name, media_id, group_name from players WHERE group_name = '{$reqGroup}'");
for ($i = 0; $i < count($p); $i++) {
$log = new stdClass();
$log->player = $p[$i];
if ($log->player->display_name == "") {
$log->player->display_name = $log->player->user_name;
}
$log->player->pic_url = Media::getMediaObject("player", $p[$i]->media_id)->data->url;
$playerLogs[] = $log;
}
} else {
if ($filterMode == "players") {
for ($i = 0; $i < count($reqPlayers); $i++) {
$p = Module::queryObject("SELECT player_id, display_name, media_id, group_name from players WHERE player_id = '{$reqPlayers[$i]}'");
$log = new stdClass();
$log->player = $p;
if ($log->player->display_name == "") {
$log->player->display_name = $log->player->user_name;
}
$log->player->pic_url = Media::getMediaObject("player", $p->media_id)->data->url;
$playerLogs[] = $log;
}
} else {
if ($filterMode == "player") {
$p = Module::queryObject("SELECT player_id, display_name, media_id, group_name from players WHERE player_id = '{$reqPlayer}'");
$log = new stdClass();
$log->player = $p;
if ($log->player->display_name == "") {
$log->player->display_name = $log->player->user_name;
}
$log->player->pic_url = Media::getMediaObject("player", $p->media_id)->data->url;
$playerLogs[] = $log;
} else {
$r = Module::queryArray("SELECT player_id FROM player_log WHERE game_id = '{$reqGameId}' AND timestamp BETWEEN '{$reqStartDate}' AND '{$reqEndDate}' AND (deleted = 0 OR deleted = {$reqGetExpired}) GROUP BY player_id");
for ($i = 0; $i < count($r); $i++) {
$p = Module::queryObject("SELECT player_id, user_name, display_name, media_id, group_name from players WHERE player_id = '{$r[$i]->player_id}'");
if (!$p) {
continue;
}
$log = new stdClass();