/** * Profile::view() * * @param string $pilotid * @return */ public function view($pilotid = '') { $pilotid = PilotData::parsePilotID($pilotid); $pilot = PilotData::getPilotData($pilotid); $this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname; $this->set('userinfo', $pilot); $this->set('pilot', $pilot); $this->set('allfields', PilotData::getFieldData($pilotid, false)); $pirep_list = PIREPData::getAllReportsForPilot($pilotid); $this->set('pireps', $pirep_list); $this->set('pirep_list', $pirep_list); $this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid)); $this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid)); $this->render('pilot_public_profile.tpl'); $this->render('pireps_viewall.tpl'); }
/** * Profile::view() * * @param string $pilotid * @return */ public function view($pilotid = '') { #replacement for OFC charts - Google Charts API - simpilot $this->set('chart_url', ChartsData::build_pireptable($pilotid, 30)); #end $pilotid = PilotData::parsePilotID($pilotid); $pilot = PilotData::getPilotData($pilotid); $this->title = 'Profile of ' . $pilot->firstname . ' ' . $pilot->lastname; $this->set('userinfo', $pilot); $this->set('pilot', $pilot); $this->set('allfields', PilotData::getFieldData($pilotid, false)); $pirep_list = PIREPData::getAllReportsForPilot($pilotid); $this->set('pireps', $pirep_list); $this->set('pirep_list', $pirep_list); $this->set('pilotcode', PilotData::getPilotCode($pilot->code, $pilot->pilotid)); $this->set('allawards', AwardsData::getPilotAwards($pilot->pilotid)); $this->render('pilot_public_profile.tpl'); $this->render('pireps_viewall.tpl'); }
/** * PIREPS::viewpireps() * * @return */ public function viewpireps() { if (!Auth::LoggedIn()) { $this->set('message', 'You are not logged in!'); $this->render('core_error.tpl'); return; } if (isset($this->post->submit_pirep) && $this->post->submit_pirep) { if (!$this->SubmitPIREP()) { $this->FilePIREPForm(); return false; } } if (isset($this->post->submit)) { /* See if the PIREP is valid, and whether it's being edited by the owner, not someone else */ $pirep = PIREPData::getReportDetails($this->post->pirepid); if (!$pirep) { $this->set('message', 'Invalid PIREP'); $this->render('core_error.tpl'); return; } # Make sure pilot ID's match if ($pirep->pilotid != Auth::$pilot->pilotid) { $this->set('message', 'This PIREP is not yours!'); $this->render('core_error.tpl'); return; } /* Now do the edit actions */ if ($this->post->action == 'addcomment') { $ret = PIREPData::addComment($this->post->pirepid, Auth::$pilot->pilotid, $this->post->comment); $this->set('message', 'Comment added!'); $this->render('core_success.tpl'); } elseif ($this->post->action == 'editpirep') { $ret = PIREPData::saveFields($this->post->pirepid, $_POST); $this->set('message', 'PIREP edited!'); $this->render('core_success.tpl'); } } $this->title = 'My PIREPs'; // Show PIREPs filed $this->set('userinfo', Auth::$pilot); $this->set('pilot', Auth::$pilot); $pirep_list = PIREPData::getAllReportsForPilot(Auth::$pilot->pilotid); $this->set('pireps', $pirep_list); $this->set('pirep_list', $pirep_list); $this->render('pireps_viewall.tpl'); }