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(); // 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; 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)); } else { Flight::redirect('/404', 404); } }
</form> <div class="margin-top-20"></div> </div> <?php } ?> <div class="tab-pane" id="aliasinfo"> <form id='alias-form'> <div class="margin-top-20"></div> <div class='form-group handles-group'> <table class="table table-striped table-hover" id="aliases" style="overflow-y: scroll; max-height: 400px;"> <?php $memberHandles = MemberHandle::findByMemberId($member->id); ?> <?php if (count($memberHandles)) { ?> <?php foreach ($memberHandles as $handle) { ?> <?php if ($handle->isVisible || User::isDev()) { ?> <tr class="member-handle" data-handle-type="<?php echo $handle->handle_type; ?> " data-handle-id="<?php echo $handle->id;