public function do_submit() { $flight = new flight(); $flight->set_from_request(); $flight->dim = 1; if (strtotime($this->date) + 30 * 24 * 60 * 60 < time()) { $this->force_delay = true; $flight->admin_info .= 'delayed as flight is old.'; } $track = new track(); $task = $track->set_task($this->coords); $flight_type = new flight_type(); $flight_type->do_retrieve(['ftid', 'multi', 'multi_defined'], ['where_equals' => ['fn' => $task->type]]); $flight->ftid = $flight_type->ftid; $flight->set_date($this->date); $flight->multi = !$this->ridge ? flight_type::get_multiplier($flight->ftid, $flight->season, $this->defined) : 1; $flight->base_score = $task->get_distance(); $flight->coords = $this->coords; $flight->score = $flight->base_score * $flight->multi; $flight->delayed = $this->force_delay ? true : $this->delay; $flight->do_save(); jquery::colorbox(['html' => 'Your flight has been added successfully', 'className' => 'success']); $form = new coordinates_form(); ajax::update($form->get_html()->get()); }
public function get_form() { if (isset($_REQUEST['ftid']) && isset($_REQUEST['coordinates'])) { $dec = new object\declaration(); $form = $dec->get_form(); jquery::colorbox(['html' => $form->get_html()->get()]); } }
public function do_submit() { $this->glider->set_from_request(); $this->glider->name = ucwords($this->name); $this->glider->do_save(); $manu = new manufacturer(); $manu->do_retrieve_from_id(['title'], $this->mid); if ($this->glider->gid) { $this->glider->do_update_selector(); jquery::colorbox(["html" => node::create('div.callout.callout-primary', [], node::create('h2.page-header', [], $manu->title . ' - ' . $this->glider->name) . node::create('p', [], 'Has been added to the database and should now be selectable from the list.'))->get()]); } }
public function do_submit() { $this->pilot->name = ucwords($this->name); $this->pilot->gender = $this->gender; $this->pilot->bhpa_no = $this->bhpa_no; $this->pilot->email = $this->email; $this->pilot->rating = $this->rating; $this->pilot->do_save(); if ($this->pilot->pid) { $this->pilot->do_update_selector(); } jquery::colorbox(['html' => node::create('div.callout.callout-primary', [], node::create('h2.page-header', [], $this->name) . node::create('p', [], 'Added to the database'))->get()]); }
/** * */ public function get_cms_change_group() { $form = new cms_change_group_form(); $form->mid = $_REQUEST['mid']; jquery::colorbox(['html' => $form->get_html()->get()]); }
public function get_form_ajax() { $html = utf8_encode($this->get_form()->get_html()->get()); jquery::colorbox(['html' => $html]); }
public function do_submit() { $flight = new flight(); $flight->set_from_request(); $flight->live = false; $flight->do_save(); if ($flight->fid) { $flight->move_temp_files($this->temp_id); $igc_parser = new igc_parser(); $igc_parser->load_data($flight->fid, false); $flight->did = $igc_parser->has_height_data() ? 3 : 2; $flight->winter = $igc_parser->is_winter(); $flight->set_date(strtotime($igc_parser->get_date())); $this->force_delay = false; if (!$this->check_date($igc_parser)) { $this->force_delay = true; $flight->admin_info .= 'delayed as flight is old.' . "\n"; } if ($igc_parser->get_validated() === 0) { $flight->admin_info .= 'G record invalid.' . "\n"; } $flight->defined = $this->type == 'task'; $flight->duration = $igc_parser->get_duration(); foreach (['od' => 'open_distance', 'or' => 'out_and_return', 'tr' => 'triangle', 'ft' => 'flat_triangle'] as $task_id => $name) { if ($task = $igc_parser->get_task($name)) { $flight->{$task_id . '_score'} = $task->get_distance(); $flight->{$task_id . '_time'} = $task->get_duration(); $flight->{$task_id . '_coordinates'} = $task->get_gridref(); if ($this->type == $task->type) { $flight->ftid = $this->type; $flight->base_score = $task->get_distance(); $flight->duration = $task->get_duration(); $flight->coords = $task->get_gridref(); } } } if ($flight->defined) { $task = $igc_parser->get_task('declared'); $flight->ftid = $task->type; if ($flight->ftid == \track\task::TYPE_OPEN_DISTANCE) { $flight->ftid = \track\task::TYPE_GOAL; } $flight->base_score = $task->get_distance(); $flight->duration = $task->get_duration(); $flight->coords = $task->get_gridref(); } $flight->multi = !$flight->ridge ? flight_type::get_multiplier($flight->ftid, $igc_parser->get_date('Y'), $flight->defined) : 1; $flight->score = $flight->multi * $flight->base_score; $flight->delayed = $this->force_delay || $this->delay; $flight->live = true; $flight->do_save(); jquery::colorbox(['html' => 'Your flight has been added successfully', 'className' => 'success']); $form = new igc_form(); ajax::update($form->get_html()->get()); $users = new_flight_notification::get_all([]); foreach ($users as $user) { $mail = new email(); $mail->load_template(root . '/template/email/basic.html'); $mail->set_recipients([$user->email]); $subject = 'New flight added'; if ($flight->delayed) { $subject .= ' - Delayed'; } if ($igc_parser->get_validated() === 0) { $subject .= ' - G record invalid'; } $mail->set_subject($subject); $mail->replacements = ['[content]' => ' <h2>New flight added: ' . $flight->get_primary_key() . '</h2> <table class="btn-primary" cellpadding="0" cellspacing="0" border="0"> <tr> <td> <a href="' . host . '/cms/edit/2/' . $flight->get_primary_key() . '">View in CMS</a> </td> </tr> </table>']; $mail->send(); } } else { jquery::colorbox(['html' => 'Your flight has failed to save', 'className' => 'success failure']); } }