Exemplo n.º 1
0
 /**
  * Profile::index()
  *
  * @return
  */
 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();
         }
     }
     $pilot = PilotData::getPilotData(Auth::$pilot->pilotid);
     if (Config::Get('TRANSFER_HOURS_IN_RANKS') == true) {
         $totalhours = $pilot->totalhours + $pilot->transferhours;
     } else {
         $totalhours = $pilot->totalhours;
     }
     $this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid));
     $this->set('report', PIREPData::getLastReports($pilot->pilotid));
     $this->set('nextrank', RanksData::getNextRank($totalhours));
     $this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid));
     $this->set('userinfo', $pilot);
     $this->set('pilot', $pilot);
     $this->set('pilot_hours', $totalhours);
     $this->render('profile_main.tpl');
     CodonEvent::Dispatch('profile_viewed', 'Profile');
 }