public static function _index()
 {
     $user = User::find(intval($_SESSION['userid']));
     $member = Member::find(intval($_SESSION['memberid']));
     $tools = Tool::find_all($user->role);
     $divisions = Division::find_all();
     $division = Division::findById(intval($member->game_id));
     $notifications = new Notification($user, $member);
     $squad = Squad::find($member->member_id);
     $platoon = Platoon::find($member->platoon_id);
     $squads = Squad::findAll($member->game_id, $member->platoon_id);
     Flight::render('user/main_tools', compact('user', 'tools'), 'main_tools');
     Flight::render('member/personnel', compact('member', 'squad', 'platoon', 'squads'), 'personnel');
     Flight::render('application/divisions', compact('divisions'), 'divisions_list');
     Flight::render('user/notifications', array('notifications' => $notifications->messages), 'notifications_list');
     Flight::render('layouts/home', compact('user', 'member', 'division'), 'content');
     Flight::render('layouts/application', compact('user', 'member', 'tools', 'divisions', 'division'));
 }
示例#2
0
 /**
  * checks user's editing abilities for a specific member
  * @param  int $mid the member id of the member being edited
  * @param  int $user the user object of the user doing the editing
  * @param  int $member the member object of the user doing the editing
  * @return boolean      self explanatory
  */
 public static function canEdit($mid, $myUser, $myMember)
 {
     $player = Member::findByMemberId($mid);
     $squad = $player->squad_id != 0 ? Squad::find($player->squad_id) : false;
     // is the user a dev or clan administrator?
     if (self::isDev()) {
         return true;
         // is the user the assigned squad leader?
     } elseif ($myUser->role == 1 && $squad && $squad->leader_id == $myMember->id) {
         return true;
         // is the user the platoon leader of the user?
     } elseif ($myUser->role == 2 && $myMember->platoon_id == $player->platoon_id) {
         return true;
         // is the user the division leader of the user?
     } elseif ($myUser->role == 3 && $myMember->game_id == $player->game_id) {
         return true;
         // is the user editing someone of a lesser role, or himself?
     } elseif ($mid == $myMember->member_id) {
         return true;
     } else {
         return false;
     }
 }