public function testDeletePIREP() { # Delete it PIREPData::DeleteFlightReport($this->pirep_id); # Verify delete $data = PIREPData::GetReportDetails($this->pirep_id); $this->assertFalse($data); echo '<br />'; }
/** * Reject the report, and then send them the comment * that was entered into the report */ protected function reject_pirep_post() { $pirepid = $this->post->pirepid; $comment = $this->post->comment; if ($pirepid == '' || $comment == '') { return; } PIREPData::ChangePIREPStatus($pirepid, PIREP_REJECTED); // 2 is rejected $pirep_details = PIREPData::GetReportDetails($pirepid); // If it was previously accepted, subtract the flight data if (intval($pirep_details->accepted) == PIREP_ACCEPTED) { PilotData::UpdateFlightData($pirep_details->pilotid, -1 * floatval($pirep->flighttime), -1); } //PilotData::UpdatePilotStats($pirep_details->pilotid); RanksData::CalculateUpdatePilotRank($pirep_details->pilotid); PilotData::resetPilotPay($pirep_details->pilotid); StatsData::UpdateTotalHours(); // Send comment for rejection if ($comment != '') { $commenter = Auth::$userinfo->pilotid; // The person logged in commented PIREPData::AddComment($pirepid, $commenter, $comment); // Send them an email $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_commentadded.tpl', true); Util::SendEmail($pirep_details->email, 'Comment Added', $message); } LogData::addLog(Auth::$userinfo->pilotid, 'Rejected PIREP #' . $pirepid); # Call the event CodonEvent::Dispatch('pirep_rejected', 'PIREPAdmin', $pirep_details); }
protected function add_comment_post() { $comment = $this->post->comment; $commenter = Auth::$userinfo->pilotid; $pirepid = $this->post->pirepid; $pirep_details = PIREPData::GetReportDetails($pirepid); PIREPData::AddComment($pirepid, $commenter, $comment); // Send them an email $this->set('firstname', $pirep_details->firstname); $this->set('lastname', $pirep_details->lastname); $this->set('pirepid', $pirepid); $message = Template::GetTemplate('email_commentadded.tpl', true); Util::SendEmail($pirep_details->email, 'Comment Added', $message); LogData::addLog(Auth::$userinfo->pilotid, 'Added a comment to PIREP #' . $pirepid); }
public function editpirep() { if (!Auth::LoggedIn()) { $this->set('message', 'You must be logged in to access this feature!'); $this->render('core_error.tpl'); return; } if (!isset($this->get->id)) { $this->set('message', 'No PIREP specified'); $this->render('core_error.tpl'); return; } $pirep = PIREPData::GetReportDetails($this->get->id); if (!$pirep) { $this->set('message', 'Invalid PIREP'); $this->render('core_error.tpl'); return; } # Make sure pilot ID's match if ($pirep->pilotid != Auth::$userinfo->pilotid) { $this->set('message', 'You cannot add a comment to a PIREP that is not yours!'); $this->render('core_error.tpl'); return; } if (PIREPData::isPIREPUnderAge($pirep->pirepid, Config::Get('PIREP_CUSTOM_FIELD_EDIT')) == false) { $this->set('message', 'You cannot edit a PIREP after the cutoff time of ' . Config::Get('PIREP_CUSTOM_FIELD_EDIT') . ' hours'); $this->render('core_error.tpl'); return; } $this->set('pirep', $pirep); $this->set('pirepfields', PIREPData::GetAllFields()); $this->render('pirep_editform.tpl'); }