private function getGameLinks($member) { $output = ''; $games = MemberGame::getGamesPlayed($member); $handle = MemberHandle::findHandle($member->id, 7); foreach ($games as $game) { if (count($handle->num_rows) && in_array($game->short_name, array('ws', 'wt'))) { var_dump($game); die; } } }
public function generate() { // header $division_structure = "[table='align:center,width: {$this->info_width}']"; $division_structure .= "[tr][td]"; // banner $division_structure .= "[center][img]http://i.imgur.com/iWpjGZG.png[/img][/center]\r\n"; /** * ------division leaders----- */ $division_structure .= "\r\n\r\n[center][size=5][color={$this->div_name_color}][b][i][u]Division Leaders[/u][/i][/b][/color][/size][/center]\r\n"; $division_structure .= "[center][size=4]"; $division_leaders = Division::findDivisionLeaders($this->game_id); foreach ($division_leaders as $player) { $memberHandle = MemberHandle::findHandle($player->id, $this->division->primary_handle); $player->handle = $memberHandle->handle_value; $player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name, 'color' => $this->division_leaders_color)); $bl_url = "[url=" . $memberHandle->url . $player->handle . "][BL][/url]"; $division_structure .= "{$aod_url} {$bl_url} - {$player->position_desc}\r\n"; } $division_structure .= "[/size][/center]\r\n\r\n"; /** * -----general sergeants----- */ $division_structure .= "[center][size=3][color={$this->platoon_pos_color}]General Sergeants[/color]\r\n"; $general_sergeants = Division::findGeneralSergeants($this->game_id); foreach ($general_sergeants as $player) { $memberHandle = MemberHandle::findHandle($player->id, $this->division->primary_handle); $player->handle = $memberHandle->handle_value; $player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name)); $bl_url = "[url=" . $memberHandle->url . $player->handle . "][BL][/url]"; $division_structure .= "{$aod_url} {$bl_url}\r\n"; } $division_structure .= "[/size][/center]"; $division_structure .= "[/td][/tr][/table]"; /** * ---------platoons---------- */ $division_structure .= "\r\n\r\n[table='align:center,width: {$this->players_width}']"; $platoons = $this->platoons; $i = 1; foreach ($platoons as $platoon) { $countMembers = Platoon::countPlatoon($platoon->id); if ($i == 1) { $division_structure .= "[tr]"; $division_structure .= "[td]"; } else { $division_structure .= "[td]"; } $division_structure .= "[size=5][color={$this->platoon_num_color}]" . ordsuffix($i) . " Platoon[/color][/size] \r\n[i][size=3]{$platoon->name} [/size][/i]\r\n\r\n"; // platoon leader $player = Member::findByMemberId($platoon->leader_id); // is a platoon leader assigned? if ($platoon->leader_id != 0) { $memberHandle = MemberHandle::findHandle($player->id, $this->division->primary_handle); $player->handle = $memberHandle->handle_value; $player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name, 'color' => $this->platoon_leaders_color)); $bl_url = "[url=" . $memberHandle->url . $player->handle . "][BL][/url]"; $division_structure .= "[size=3][color={$this->platoon_pos_color}]Platoon Leader[/color]\r\n{$aod_url} {$bl_url}[/size]\r\n\r\n"; } else { $division_structure .= "[size=3][color={$this->platoon_pos_color}]Platoon Leader[/color]\r\n[color={$this->platoon_leaders_color}]TBA[/color][/size]\r\n\r\n"; } // squad leaders $squads = Squad::findAll($this->game_id, $platoon->id); foreach ($squads as $squad) { if ($squad->leader_id != 0) { $squad_leader = Member::findById($squad->leader_id); $memberHandle = MemberHandle::findHandle($squad_leader->id, $this->division->primary_handle); $squad_leader->handle = $memberHandle->handle_value; $player_name = Rank::convert($squad_leader->rank_id)->abbr . " " . $squad_leader->forum_name; $aod_url = Member::createAODlink(array('member_id' => $squad_leader->member_id, 'forum_name' => $player_name, 'color' => $this->squad_leaders_color)); $bl_url = "[url=" . $memberHandle->url . $squad_leader->handle . "][BL][/url]"; $division_structure .= "[size=3][color={$this->platoon_pos_color}]Squad Leader[/color]\r\n{$aod_url} {$bl_url}[/size]\r\n\r\n"; $division_structure .= "[size=1]"; // direct recruits $recruits = arrayToObject(Member::findRecruits($squad_leader->member_id, $squad_leader->platoon_id, $squad->id, true)); if (count((array) $recruits)) { $division_structure .= "[list=1]"; foreach ($recruits as $player) { $memberHandle = MemberHandle::findHandle($player->id, $this->division->primary_handle); $player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name)); // does member have a division primary member handle? if (count((array) $memberHandle)) { $player->handle = $memberHandle->handle_value; $bl_url = "[url=" . $memberHandle->url . $player->handle . "][BL][/url]"; $division_structure .= "[*]{$aod_url} {$bl_url}\r\n"; } else { $division_structure .= "[*]{$aod_url} [color=red]XX[/color]\r\n"; } } $division_structure .= "[/list]"; } } else { $division_structure .= "[size=3][color={$this->platoon_pos_color}]Squad Leader[/color]\r\n[color={$this->squad_leaders_color}]TBA[/color][/size]\r\n"; $division_structure .= "[size=1]"; } $division_structure .= "\r\n"; // squad members $squadMembers = arrayToObject(Squad::findSquadMembers($squad->id, true, $squad_leader->member_id)); if (count((array) $squadMembers)) { foreach ($squadMembers as $player) { if ($memberHandle = MemberHandle::findHandle($player->id, $this->division->primary_handle)) { $player->handle = $memberHandle->handle_value; $player_name = Rank::convert($player->rank_id)->abbr . " " . $player->forum_name; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => $player_name)); $bl_url = "[url=" . $memberHandle->url . $player->handle . "][BL][/url]"; $division_structure .= "{$aod_url} {$bl_url}\r\n"; } } } $division_structure .= "[/size]\r\n"; } $division_structure .= "\r\n\r\n"; if ($i % $this->num_columns == 0) { $division_structure .= "[/td][/tr][tr]"; } $division_structure .= "[/td]"; $i++; } // end last platoon $division_structure .= "[/tr][/table]\r\n\r\n"; /** * --------part timers-------- */ $i = 1; // header $division_structure .= "\r\n[table='align:center,width: {$this->info_width}']"; $division_structure .= "[tr][td]\r\n[center][size=3][color={$this->platoon_pos_color}][b]Part Time Members[/b][/color][/size][/center][/td][/tr]"; $division_structure .= "[/table]\r\n\r\n"; // players $division_structure .= "[table='align:center,width: {$this->info_width}']"; $division_structure .= "[tr][td]"; $partTimers = PartTime::find_all($this->game_id); foreach ($partTimers as $player) { if ($i % 20 == 0) { $division_structure .= "[/td][td]"; } $bl_url = "[url=" . BATTLELOG . $player->ingame_alias . "][BL][/url]"; $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => "AOD_" . $player->forum_name)); $division_structure .= "{$aod_url} {$bl_url}\r\n"; $i++; } $division_structure .= "[/td]"; $division_structure .= "[/tr][/table]\r\n\r\n"; /** * -----------LOAS------------ */ if (count((array) LeaveOfAbsence::find_all($this->game_id))) { $i = 1; // header $division_structure .= "\r\n[table='align:center,width: {$this->info_width}']"; $division_structure .= "[tr][td]\r\n[center][size=3][color={$this->platoon_pos_color}][b]Leaves of Absence[/b][/color][/size][/center][/td][/tr]"; $division_structure .= "[/table]\r\n\r\n"; // players $division_structure .= "[table='align:center,width: {$this->info_width}']"; $loas = LeaveOfAbsence::find_all($this->game_id); foreach ($loas as $player) { $date_end = strtotime($player->date_end) < strtotime('now') ? "[COLOR='#FF0000']Expired " . formatTime(strtotime($player->date_end)) . "[/COLOR]" : date("M d, Y", strtotime($player->date_end)); $profile = Member::findByMemberId($player->member_id); $aod_url = Member::createAODlink(array('member_id' => $player->member_id, 'forum_name' => "AOD_" . $profile->forum_name)); $division_structure .= "[tr][td]{$aod_url}[/td][td]{$date_end}[/td][td]{$player->reason}[/td][/tr]"; $i++; } $division_structure .= "[/table]"; } $this->content = $division_structure; }
public static function _profile($id) { $user = User::find(intval($_SESSION['userid'])); $member = Member::find(intval($_SESSION['memberid'])); $tools = Tool::find_all($user->role); $divisions = Division::find_all(); $extrajs = array(); // profile data $memberInfo = Member::findByMemberId(intval($id)); if (property_exists($memberInfo, 'id')) { $divisionInfo = Division::findById(intval($memberInfo->game_id)); $platoonInfo = Platoon::findById(intval($memberInfo->platoon_id)); $recruits = Member::findRecruits($memberInfo->member_id); $gamesPlayed = MemberGame::get($memberInfo->id); $aliases = MemberHandle::findByMemberId($memberInfo->id); // game data $bdate = date("Y-m-d", strtotime("tomorrow - 30 days")); $edate = date("Y-m-d", strtotime("tomorrow")); $totalGames = BfActivity::countPlayerGames($memberInfo->member_id, $bdate, $edate); $aodGames = BfActivity::countPlayerAODGames($memberInfo->member_id, $bdate, $edate); $games = BfActivity::find_allGames($memberInfo->member_id); $pctAod = $totalGames > 0 ? $aodGames * 100 / $totalGames : 0; switch ($divisionInfo->short_name) { case "bf": $activity = array('totalGames' => $totalGames, 'aodGames' => $aodGames, 'games' => $games, 'pctAod' => $pctAod); $activity_page = $divisionInfo->short_name; break; case "ps2": $handle_info = MemberHandle::findHandle($memberInfo->id, 11); if (empty($handle_info->handle_value)) { $handle = $memberInfo->forum_name; } else { $handle = $handle_info->handle_value; } $activity = array('ps2_character_name' => $handle); $extrajs[] = "libraries/angular.min"; $extrajs[] = "libraries/angular-chart.min"; $extrajs[] = "ps2/controllers"; $activity_page = $divisionInfo->short_name; break; default: $activity = array(); $activity_page = 'default'; break; } if (property_exists($platoonInfo, 'id')) { $platoonInfo->link = "<li><a href='divisions/{$divisionInfo->short_name}/platoon/{$platoonInfo->number}'>{$platoonInfo->name}</a></li>"; $platoonInfo->item = "<li class='list-group-item text-right'><span class='pull-left'><strong>Platoon: </strong></span> <span class='text-muted'>{$platoonInfo->name}</span></li>"; } // if squad leader, show recruits if ($memberInfo->position_id == 5) { Flight::render('member/sl-personnel', array('member' => $memberInfo), 'sl_personnel'); } Flight::render('member/alerts', array('memberInfo' => $memberInfo), 'alerts'); Flight::render('member/recruits', array('recruits' => $recruits), 'recruits'); Flight::render('member/member_data', array('memberInfo' => $memberInfo, 'divisionInfo' => $divisionInfo, 'platoonInfo' => $platoonInfo, 'aliases' => $aliases), 'member_data'); Flight::render('member/activity/' . $activity_page, $activity, 'activity'); Flight::render('member/history', array(), 'history'); Flight::render('member/profile', array('user' => $user, 'member' => $member, 'memberInfo' => $memberInfo, 'divisionInfo' => $divisionInfo, 'platoonInfo' => $platoonInfo, 'gamesPlayed' => $gamesPlayed), 'content'); Flight::render('layouts/application', array('js' => 'member', 'user' => $user, 'member' => $member, 'tools' => $tools, 'divisions' => $divisions, 'extrajs' => $extrajs)); } else { Flight::redirect('/404', 404); } }