Ejemplo n.º 1
0
 public function index()
 {
     if (!Auth::LoggedIn()) {
         $this->set('message', 'You must be logged in to access this feature!');
         $this->render('core_error.tpl');
         return;
     }
     /*
      * This is from /profile/editprofile
      */
     if (isset($this->post->action)) {
         if ($this->post->action == 'saveprofile') {
             $this->save_profile_post();
         }
         /* this comes from /profile/changepassword
          */
         if ($this->post->action == 'changepassword') {
             $this->change_password_post();
         }
     }
     if (Config::Get('TRANSFER_HOURS_IN_RANKS') == true) {
         $totalhours = intval(Auth::$userinfo->totalhours) + intval(Auth::$userinfo->transferhours);
     } else {
         $totalhours = Auth::$userinfo->totalhours;
     }
     $this->set('pilotcode', PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid));
     $this->set('report', PIREPData::GetLastReports(Auth::$userinfo->pilotid));
     $this->set('nextrank', RanksData::GetNextRank($totalhours));
     $this->set('allawards', AwardsData::GetPilotAwards(Auth::$userinfo->pilotid));
     $this->set('userinfo', Auth::$userinfo);
     $this->set('pilot_hours', $totalhours);
     $this->render('profile_main.tpl');
     CodonEvent::Dispatch('profile_viewed', 'Profile');
 }