Exemple #1
0
 public function get_cms_list_wrapper($value, $object_class, $id)
 {
     $this->attributes['data-ajax-click'] = $object_class . ':' . $this->field_name;
     $this->attributes['data-ajax-post'] = '{"id":' . $id . '}';
     $this->attributes['data-ajax-shroud'] = '#button' . $this->field_name . $id;
     return node::create('a#button_' . $this->field_name . $id . '.btn.btn-default', $this->attributes, icon::get($this->field_name));
 }
 public function get_html()
 {
     if (!empty($this->fields)) {
         return parent::get_html();
     }
     return node::create('span');
 }
Exemple #3
0
 function get_main_nav()
 {
     $pages = page::get_all([], ['where' => 'nav=1', 'order' => 'position']);
     return $pages->iterate_return(function (page $page) {
         return node::create('li' . ($page->pid == \core::$singleton->pid ? '.sel' : ''), [], node::create('a', ['href' => $page->get_url()], $page->nav_title ?: $page->title));
     });
 }
Exemple #4
0
 function make_table(league_table $data)
 {
     $html = node::create('div.table_wrapper', [], node::create('h3.heading', [], $data->Title . node::create('table.Pilot.main.results', [], node::create('thead tr', [], node::create('th', ['style' => 'width:45px'], 'Flight No') . node::create('th', ['style' => 'width:60px'], 'Name') . node::create('th', ['style' => 'width:60px'], 'Date') . node::create('th', ['style' => 'width:90px'], 'Club') . node::create('th', ['style' => 'width:95px'], 'Glider') . node::create('th', ['style' => 'width:60px'], 'Score') . node::create('th', ['style' => 'width:298px'], 'Flight Waypoints')) . $data->flights->iterate_return(function (flight $flight) {
         return node::create('tr', [], node::create('td', [], $flight->fid) . node::create('td', [], $flight->p_name) . node::create('td', [], $flight->date) . node::create('td', [], $flight->c_name) . node::create('td', [], $flight->g_name) . node::create('td', [], $flight->to_print()) . node::create('td', [], $flight->coords));
     }))));
     return $html;
 }
Exemple #5
0
 public function get()
 {
     $node = node::create('div.paginate_wrapper');
     if ($this->npp && $this->total > $this->npp) {
         $pages = ceil($this->total / $this->npp);
         if ($this->title) {
             $node->add_child(node::create('span.title', [], $this->do_replace($this->title)));
         }
         if ($pages > 40) {
             $options['data-ajax-change'] = $this->act;
             $options['data-ajax-post'] = $this->post_data;
             $_node = node::create('select.form-control', $options);
             for ($i = 1; $i <= $pages; $i++) {
                 $attributes = ['value' => $i];
                 if ($this->page == $i) {
                     $attributes['selected'] = 'selected';
                 }
                 $_node->add_child(node::create('option', $attributes, $i));
             }
             $node->add_child($_node);
         } else {
             $_node = node::create('ul#pagi.pagination');
             for ($i = 1; $i <= $pages; $i++) {
                 $options['data-ajax-click'] = $this->act;
                 $options['data-ajax-post'] = $this->post_data + ['value' => $i];
                 $_node->add_child(node::create('li' . ($this->page == $i ? '.active' : '') . ' a', $options, $i));
             }
             $node->add_child($_node);
         }
         if ($this->post_title) {
             $node->nest(node::create('span.title', [], $this->do_replace($this->post_title)));
         }
     }
     return $node;
 }
Exemple #6
0
 function make_table(league_table $data)
 {
     $array = new table_array();
     /* @var \object\flight $t */
     foreach ($data->flights as $t) {
         /** @var pilot $class */
         if ($data->options->split_classes && $t->class == 5) {
             $t->ClassID += 8000;
         }
         if (isset($array[$t->ClassID])) {
             $class = $array[$t->ClassID];
             $class->add_flight($t);
         } else {
             $class = new $data->class();
             $class->set_from_flight($t, $data->max_flights, $data->options->split_classes);
             $array[$t->ClassID] = $class;
         }
     }
     if (count($array) > 0) {
         $array->uasort(['\\module\\tables\\object\\league_table', 'cmp']);
         $class1 = 1;
         $class5 = 1;
         $html = node::create('div.table_wrapper', [], node::create('h3.heading', [], $data->Title) . ($data->options->show_top_4 ? $data->ShowTop4($data->WHERE) : '') . node::create('table.results.main', [], $data->write_table_header($data->max_flights, $data->class_primary_key) . $array->iterate_return(function (scorable $pilot) use(&$class1, &$class5) {
             if ($pilot->class == 1) {
                 return $pilot->output($class1++);
             } else {
                 return $pilot->output($class5++);
             }
         })));
     } else {
         $html = node::create('table.main th.c', ['style' => 'width:663px'], 'No Flights to display');
     }
     return $html;
 }
Exemple #7
0
 public function get_latest_gliders()
 {
     $gliders = glider::get_all(['gid', 'name', 'manufacturer.title'], ['join' => ['manufacturer' => 'manufacturer.mid = glider.mid'], 'limit' => 5, 'order' => 'gid DESC']);
     $table = node::create('table#latest_pilots.module.table.table-striped', [], node::create('thead', [], node::create('th', [], 'ID') . node::create('th', [], 'Glider') . node::create('th', [], 'Manufacturer')) . $gliders->iterate_return(function (glider $glider) {
         return node::create('tr', [], node::create('td a', ['href' => '/cms/module/4/' . $glider->gid, 'title' => 'Glider: ' . $glider->name], $glider->gid) . node::create('td a', ['href' => '/cms/module/4/' . $glider->gid, 'title' => 'Glider: ' . $glider->name], $glider->name) . node::create('td a', ['href' => '/cms/module/5/' . $glider->gid, 'title' => 'Manufacturer: ' . $glider->manufacturer->title], $glider->manufacturer->title));
     }));
     return $table;
 }
 public function __construct()
 {
     $fields = [form::create('field_string', 'username')->set_attr('label', 'Username'), form::create('field_password', 'password')->set_attr('label', 'Password')];
     parent::__construct($fields);
     $this->pre_fields_text = node::create('h2.form-signin-heading.text-center', [], node::create('small', [], 'Admin Login<br/>') . ini::get('site', 'title_tag'))->get();
     $this->submit = 'Login';
     $this->id = 'cms_login';
 }
Exemple #9
0
 public function get_view()
 {
     $articles = article::get_all(['aid', 'date', 'title', 'poster', 'post', 'snippet'], ['order' => 'date DESC', 'where' => 'parent_aid=0']);
     $html = node::create('div#list_wrapper', [], $articles->iterate_return(function (article $article) {
         return $article->get_cell();
     }) . node::create('div#article_wrapper', []));
     return $html;
 }
Exemple #10
0
 public function __construct()
 {
     parent::__construct([form::create('field_link', 'pid')->set_attr('label', 'Pilot:')->set_attr('required', true)->set_attr('default', 'Choose A Pilot')->set_attr('post_text', node::create('a', ['data-ajax-click' => '\\form\\add_pilot_form:get_form'], 'Not in the list? Click here to add a new pilot'))->set_attr('link_module', '\\object\\pilot')->set_attr('link_field', 'name')->set_attr('options', ['order' => 'name']), form::create('field_link', 'gid')->set_attr('label', 'Glider:')->set_attr('required', true)->set_attr('post_text', node::create('a', ['data-ajax-click' => '\\form\\add_glider_form:get_form'], 'Not in the list? Click here to add a new glider'))->set_attr('link_module', '\\object\\glider')->set_attr('link_field', ['manufacturer.title', 'name'])->set_attr('options', ['join' => ['manufacturer' => 'manufacturer.mid = glider.mid'], 'order' => 'manufacturer.title, glider.name']), form::create('field_link', 'cid')->set_attr('label', 'Club:')->set_attr('required', true)->set_attr('link_module', '\\object\\club')->set_attr('link_field', 'title')->set_attr('options', ['order' => 'title']), form::create('field_string', 'coords')->set_attr('label', 'Flight coordinates')->set_attr('required_parent', 'defined')->set_attr('required', true)->set_attr('pre_text', node::create('p', [], 'Enter the coordinates below in \'XX000000;XX000000\' format, with no ending \';\''))->add_wrapper_class('cf')->set_attr('post_text', node::create('p.defined_info')), form::create('field_date', 'date')->set_attr('label', 'Date:')->set_attr('required', true), form::create('field_link', 'lid')->set_attr('label', 'Launch:')->set_attr('required', true)->set_attr('link_module', '\\object\\launch_type')->set_attr('link_field', 'title'), form::create('field_boolean', 'ridge')->set_attr('label', 'The flight was predominantly in ridge lift, so according to the rules will not qualify for multipliers')->add_wrapper_class('long_text'), form::create('field_textarea', 'info')->set_attr('label', 'Please write any extra information you wish to be made public here')->set_attr('required', false)->add_wrapper_class('long_text'), form::create('field_textarea', 'admin_info')->set_attr('label', 'Please write any extra information you wish to be seen by the admin team here')->set_attr('required', false)->add_wrapper_class('long_text'), form::create('field_boolean', 'delay')->set_attr('label', 'Publication of the flight should be delayed until it has been inspected by the admin team.'), form::create('field_boolean', 'personal')->set_attr('label', 'Show the flight in your personal log only / the flight was flown outside of the UK'), form::create('field_boolean', 'agree')->set_attr('label', 'The NXCL is free to publish the flight to the public and to be passed on to skywings for publication. The flight has not broken any airspace laws')->set_attr('required', true)]);
     $this->attributes['class'][] = 'form-compact';
     $this->h2 = 'Coordinate Flight';
     $this->id = 'coordinate_form';
     $this->name = 'coordinate';
     $this->title = 'Add Flight Form';
 }
Exemple #11
0
 public function get()
 {
     if (!ajax) {
         \core::$inline_script[] = 'loaded_modules = {"' . uri . '":true};';
         return node::create('div#main div#' . $this->get_page_selector(), ['data-url' => isset($_POST['url']) ? $_POST['url'] : '/' . uri], $this->get_view());
     } else {
         \classes\ajax::inject('#main', 'append', '<div id="' . $this->get_page_selector() . '" data-url="' . (isset($_POST['url']) ? $_POST['url'] : '/' . uri) . '">' . $this->get_view() . '</div>', '#' . $this->get_page_selector());
     }
 }
Exemple #12
0
 public function get_view()
 {
     $flights = flight::get_all(['flight.*', 'pilot.name', 'pilot.pid'], ['join' => ['pilot' => 'flight.pid = pilot.pid'], 'where' => '`delayed` = 0 AND personal = 0', 'limit' => 40, 'order' => 'fid DESC']);
     $wrapper = node::create('h1.page-header', [], 'Latest') . node::create('div.table_wrapper', [], node::create('table.results.main', [], node::create('thead', [], node::create('tr', [], node::create('th', [], 'ID') . node::create('th', [], 'Pilot') . node::create('th', [], 'Date Flown') . node::create('th', [], 'Date Added') . node::create('th', [], 'Score') . node::create('th', [], 'Flight Waypoints'))) . node::create('tbody', [], $flights->iterate_return(function (flight $flight) use(&$body) {
         $added = substr($flight->created, 0, 10);
         return node::create('tr', [], node::create('td', [], $flight->fid) . node::create('td', [], $flight->pilot->name) . node::create('td', [], date('Y-m-d', $flight->date)) . node::create('td', [], $added != '0000-00-00' ? $added : 'Unknown') . $flight->to_print() . node::create('td', [], $flight->coords));
     }))));
     return $wrapper;
 }
Exemple #13
0
 protected function get_flight_defined($ftid, $class, $gender)
 {
     $flight = new flight();
     $flight->do_retrieve(['fid', 'p.name AS p_name', 'base_score', 'date', 'speed'], ['join' => ['pilot p' => 'p.pid = flight.pid', 'glider g' => 'g.gid = flight.gid'], 'where_equals' => ['ftid' => $ftid, 'g.class' => $class, 'p.gender' => $gender], 'order' => 'speed DESC']);
     $html = '';
     if ($flight->fid) {
         $html .= node::create('tr', [], node::create('td', [], 'Speed') . node::create('td', [], $class) . node::create('td', [], $gender) . node::create('td', [], $flight->p_name) . node::create('td', [], number_format($flight->speed, 2)) . node::create('td', [], date('d/m/Y', $flight->date)));
     }
     return $html;
 }
Exemple #14
0
 public function get()
 {
     if (!ajax) {
         \core::$inline_script[] = 'loaded_modules = {"' . uri . '":true};';
         return node::create('div#main div#' . $this->get_page_selector(), ['data-url' => isset($_POST['url']) ? $_POST['url'] : '/' . uri], $this->get_view());
     } else {
         $this->get_view_ajax();
     }
     return '';
 }
 public static function get_list($nnid = 0)
 {
     $nodes = _navigation_node::get_all([], ['where_equals' => ['parent_nnid' => $nnid]]);
     if ($nodes->count()) {
         return node::create('ul', [], $nodes->iterate_return(function (_navigation_node $node) {
             return node::create('li', [], node::create('a', ['href' => $node->get_url()], $node->get_title()) . static::get_list($node->get_primary_key()));
         }));
     } else {
         return '';
     }
 }
Exemple #16
0
 public function get_view()
 {
     $html = node::create('div.content', [], $this->module->current->body);
     $pages = page::get_all(['title', 'info', 'module_name', 'fn', 'icon'], ['order' => 'position', 'where' => 'pid != 12']);
     if ($pages) {
         $html .= node::create('div#page_list', [], $pages->iterate_return(function (page $page) {
             return node::create('div.page', [], node::create('a', ['href' => $page->get_url()], node::create('h2', [], icon::get($page->icon) . '<br/>' . $page->title) . ($page->info ? node::create('p', [], $page->info) : '')));
         }));
     }
     return $html;
 }
 /**
  * @return \html\node
  */
 public function get_view()
 {
     $images = image_size::get_all([]);
     if ($images) {
         $html = node::create('div', [], node::create('table.module', [], node::create('thead', [], node::create('th', [], 'Field ID') . node::create('th', [], 'Title') . node::create('th', [], '')) . $images->iterate_return(function (image_size $image_size) {
             return node::create('tr', [], node::create('td', [], $image_size->fid) . node::create('td', [], $image_size->title) . node::create('td a.button', ['href' => '?module=cms&act=image_reprocess&fid=' . $image_size->isid], 'Reprocess'));
         })));
         return $html;
     }
     return '';
 }
Exemple #18
0
 public function get()
 {
     if (!ajax) {
         \core::$inline_script[] = 'loaded_modules = {"' . uri . '":true};';
         $html = node::create('div#left_col', [], node::create('div#nav ul', [], \core::$singleton->module->get_main_nav()) . node::create('div#main_wrapper div#main', [], node::create('div#' . $this->get_page_selector(), ['data-uri' => isset($_POST['url']) ? $_POST['url'] : uri], $this->get_view()))) . node::create('div#map_interface_3d', [], icon::get('chevron-left', 'span', ['class' => ['show', 'toggle']]) . icon::get('remove', 'span', ['class' => ['hide', 'toggle']]) . node::create('div#tree_content', [], node::create('a.load_airspace.button', ['href' => '#', 'onclick' => 'map.load_airspace();'], 'Load Airspace'))) . node::create('div#map_wrapper', [], node::create('div#waypoint_mode_help', [], 'You are in waypoint mode') . node::create('div#map_interface', [], node::create('div#map_interface_padding', [], node::create('div#graph_wrapper', [], '') . node::create('div#slider', [], '') . node::create('div#controls', [], node::create('a#play.glyphicon.glyphicon-play', ['onclick' => "map.play()"], 'Play') . node::create('a#pause.glyphicon.glyphicon-pause', ['onclick' => "map.pause()"], 'Pause') . node::create('a#slider_time', [], '00:00')))) . node::create('div#map p.loading', [], 'Google Maps are loading...') . node::create('div#map3d p.loading', [], 'Google Earth is loading...'));
         return $html;
     } else {
         $content = $this->get_view();
         return ['#main', 'append', '<div id="' . $this->get_page_selector() . '" data-url="' . (isset($_POST['url']) ? $_POST['url'] : '/' . uri) . '">' . $content . '</div>', '#' . $this->get_page_selector()];
     }
 }
Exemple #19
0
 public function get_html_wrapper()
 {
     $html = '';
     $html .= $this->pre_text;
     if (!$this->hidden && isset($this->label) && !empty($this->label)) {
         $html .= node::create('label.control-label.col-md-' . $this->parent_form->bootstrap[0], ['for' => $this->field_name, 'id' => $this->field_name . '_wrapper'], $this->label);
     }
     $html .= node::create('div.col-md-' . $this->parent_form->bootstrap[1] . ' div.fileinput.fileinput-new.input-group', ['data-provides' => 'fileinput'], [node::create('div.form-control', ['data-trigger' => 'fileinput'], [icon::get('file', 'i', ['class' => ['fileinput-exists']]), node::create('span.fileinput-filename', [], '')]), node::create('span.input-group-addon.btn.btn-default.btn-file', [], [node::create('span.fileinput-exists', [], 'Change'), node::create('span.fileinput-new', [], 'Select File'), $this->get_html()]), node::create('a.input-group-addon.btn.btn-default.fileinput-exists.fileremove', ['data-dismiss' => 'fileinput'], 'Remove')]);
     $html .= $this->post_text;
     return $html;
 }
Exemple #20
0
 /**
  * @return node
  */
 public function get_submit()
 {
     if ($this->has_submit) {
         $field = node::create('div.form-group.submit-group div.col-md-offset-' . $this->bootstrap[0] . '.col-md-' . $this->bootstrap[1], [], [node::create('button.btn.btn-default', $this->submit_attributes, $this->submit), node::create('a.form_toggle', ['data-show' => 'basic_tables_wrapper'], 'Basic View')]);
         if (!$this->submittable) {
             $field->add_attribute('disabled', 'disabled');
         }
         return $field;
     }
     return node::create('');
 }
Exemple #21
0
 /**
  * @param string $id_suffix
  * @return \core\classes\paginate
  */
 public function get_paginate($id_suffix)
 {
     $paginate = new paginate();
     $paginate->npp = $this->paginate_npp;
     $paginate->base_url = $this->get_paginate_base_url();
     $paginate->total = $this->get_paginate_total();
     $paginate->page = $this->get_paginate_page();
     $paginate->act = $this->get_paginate_act();
     $paginate->title = $this->get_paginate_title();
     $paginate->post_title = $this->get_paginate_post_title();
     return node::create('div#' . $this->get_id() . '_paginate_' . $id_suffix . '.paginate', [], $paginate);
 }
Exemple #22
0
 public function get_view()
 {
     $html = node::create('div.flight_wrapper', [], node::create('h1', [], $this->module->current->pilot->name . ' ' . node::create('span', [], date('Y-m-d', $this->module->current->date))) . $this->module->current->get_info());
     if ($this->module->current->did > 1) {
         \core::$inline_script[] = '
         var graph = new Graph($("#graph-' . $this->module->current->fid . '"));
         var flight = new Track(' . $this->module->current->fid . ');
         flight.add_nxcl_data(function() {graph.swap(flight)});
         map.callback(function(map) {map.add_flight(' . $this->module->current->fid . ')});';
     }
     return $html;
 }
Exemple #23
0
 public function get_html_wrapper()
 {
     $html = '';
     $html .= $this->pre_text;
     $label = '';
     if (!$this->hidden && isset($this->label) && !empty($this->label)) {
         $label = node::create('label.control-label.col-md-' . $this->parent_form->bootstrap[0], ['for' => $this->field_name, 'id' => $this->field_name . '_wrapper'], $this->label);
     }
     $html .= node::create('div.col-md-offset-' . $this->parent_form->bootstrap[0] . '.col-md-' . $this->parent_form->bootstrap[1] . ' div.checkbox label', [], $this->get_html() . $this->label);
     $html .= $this->post_text;
     return $html;
 }
Exemple #24
0
 public function get_module_list()
 {
     $modules = _cms_module::get_all(['mid', 'title', 'primary_key', '_cms_group.title', 'table_name'], ['join' => ['_cms_group' => '_cms_group.gid = _cms_module.gid']]);
     if ($modules) {
         $html = node::create('div', [], node::create('table.module.table.table-striped', [], node::create('thead', [], node::create('th', [], 'Module ID') . node::create('th', [], 'Group') . node::create('th', [], 'Title') . node::create('th', [], 'Table Name') . node::create('th', [], 'Primary Key')) . $modules->iterate_return(function (_cms_module $module) {
             $attributes = ['href' => '/cms/admin_edit/' . $module->mid];
             return node::create('tr', [], node::create('td a', $attributes, $module->mid) . node::create('td a', $attributes, $module->_cms_group->title) . node::create('td a', $attributes, $module->title) . node::create('td a', $attributes, $module->table_name) . node::create('td a', $attributes, $module->primary_key));
         })));
         return $html;
     }
     return '';
 }
Exemple #25
0
 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()]);
     }
 }
Exemple #26
0
 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()]);
 }
Exemple #27
0
 public function get_view()
 {
     $comps = comp::get_all(['type', 'round', 'task', 'comp.title AS title', 'date', 'cid', 'comp_group.title', 'file'], ['join' => ['comp_group' => 'comp.cgid = comp_group.cgid'], 'order' => 'date DESC, round DESC, task DESC, comp.cgid ASC']);
     $html = node::create('div#comp_wrapper div#comp_inner', [], node::create('div#comp_list', [], node::create('h1.page-header', [], 'Select a Competition') . node::create('table.main.results', [], node::create('thead', [], node::create('th', [], 'Comp') . node::create('th', [], 'Round') . node::create('th', [], 'Task') . node::create('th', [], 'Class') . node::create('th', [], 'Title') . node::create('th', [], 'Date') . node::create('th', [])) . node::create('tbody', [], $comps->iterate_return(function (comp $comp) use(&$body) {
         return node::create('tr', [], node::create('td', [], $comp->type) . node::create('td', [], (int) $comp->round) . node::create('td', [], (int) $comp->task) . node::create('td', [], $comp->comp_group->title) . node::create('td', [], $comp->title) . node::create('td', [], date('d/m/Y', $comp->date)) . node::create('td a.button', ['href' => $comp->get_url()], 'View'));
     }))) . node::create('div#comp_view')));
     $script = "\$('#comp').on('click','#comp_list ul li a',function () {\r\n                cpid = \$(this).attr('data-click');\r\n                page('/comp/' + cpid);\r\n            });";
     if (ajax) {
         ajax::add_script($script);
     } else {
         \core::$inline_script[] = $script;
     }
     return $html;
 }
Exemple #28
0
 function make_table(league_table $data)
 {
     $html = node::create('div.table_wrapper', [], node::create('h3.heading', [], $data->Title) . node::create('table.main.results.tablesorter', [], node::create('thead tr', [], node::create('th', ['style' => 'width:42px'], 'Flight No') . node::create('th', ['style' => 'width:63px'], 'Date') . node::create('th', ['style' => 'width:90px'], 'Club') . node::create('th', ['style' => 'width:95px'], 'Glider') . node::create('th', ['style' => 'width:60px'], 'Score') . node::create('th', ['style' => 'width:298px'], 'Flight Waypoints')) . $data->flights->iterate_return(function (flight $flight) {
         return node::create('tr', [], node::create('td', [], $flight->fid) . node::create('td', [], date('d/m/Y', $flight->date)) . node::create('td', [], $flight->c_name) . node::create('td', [], $flight->g_name) . $flight->to_print() . node::create('td', [], $flight->coords));
     })));
     if ($data->flights->count()) {
         $script = '$("table.main").tablesorter( {
         headers: {
             0: {sorter: false},
             1: {sorter: "uk_date"},
             2: {sorter: false},
             3: {sorter: false},
             4: {sorter: "score"},
             5: {sorter: false},
         }
Exemple #29
0
 function make_table(league_table $data)
 {
     $html = '';
     for ($i = 1; $i < 5; $i++) {
         $where = $data->where . ' AND ftid=' . $i;
         $flights = flight::get_all(['fid', 'flight.pid', 'flight.gid', $data->class_table_alias . '.' . $data->class_primary_key . ' AS ClassID', $data->class_table_alias . '.name AS p_name', $data->S_alias . '.title AS c_name', 'g.class AS class', 'g.name AS g_name', 'coords', 'g.mid', 'g.kingpost', 'did', 'defined', 'lid', 'multi', 'ftid', $data->ScoreType . ' AS score'], ['join' => ["glider g" => "flight.gid=g.gid", "club c" => "flight.cid=c.cid", "pilot p" => "flight.pid=p.pid", 'manufacturer gm' => 'g.mid = gm.mid'], 'where' => $where, 'order' => 'score DESC', 'limit' => 10, 'parameters' => $data->parameters]);
         if ($flights) {
             $html .= node::create('div.table_wrapper', [], node::create('h3.heading', [], flight_type::get_type($i) . ' - ' . $data->year_title) . node::create('table.main.results', [], node::create('thead tr', [], node::create('th', ['style' => 'width:20px'], 'Pos') . node::create('th', ['style' => 'width:100px'], $data->class_table_alias == 'p' ? 'Name' : 'Glider') . node::create('th', ['style' => 'width:70px'], $data->class_table_alias == 'p' ? 'Club' : 'Manufacturer') . ($data->class_table_alias == 'p' ? node::create('th', ['style' => 'width:100px'], 'Glider') : '') . node::create('th', ['style' => 'width:58px'], 'Score') . node::create('th', ['style' => 'width:300px'], 'Flight Waypoints')) . $flights->iterate_return(function (flight $flight, $count) use(&$html, $data) {
                 $count++;
                 return node::create('tr', [], node::create('td', [], $count) . node::create('td', [], $flight->p_name) . node::create('td', [], $flight->c_name) . ($data->class_table_alias == 'p' ? node::create('td', [], $flight->g_name) : '') . $flight->to_print() . node::create('td', [], $flight->coords));
             })));
         }
     }
     return $html;
 }
Exemple #30
0
 public function get_view()
 {
     $form = new form\planner_load_waypoints();
     $html = node::create('h1.page-header', [], 'Flight Planner') . node::create('div#waypoints', [], node::create('div#wp_overlay a#enter_wp_mode.button', [], 'Enter Planner mode') . node::create('p', [], 'Click the map to add a waypoint or load the a predefined set of waypoints: ') . node::create('div.callout.callout-primary', [], [node::create('h3', [], 'Load a waypoint set'), $form->get_html()]) . node::create('p', [], 'Click waypoints to add them to your flight path') . node::create('ul#flight_types', [], node::create('li', [], 'An open distance flight of 5 or less points can be saved as a declaration of intent by clicking ' . node::create('a#decOD.button.inline', ['data-ajax-click' => 'planner:get_form', 'data-ajax-post' => '{"coordinates":"", "ftid":' . flight_type::GO_ID . '}', 'disabled' => 'disabled'], 'here')) . node::create('li', [], 'An out and return of 3 points where the 3rd is also the 1st can be saved as a declaration of intent by clicking ' . node::create('a#decOR.button.inline', ['data-ajax-click' => 'planner:get_form', 'data-ajax-post' => '{"coordinates":"", "ftid":' . flight_type::OR_ID . '}', 'disabled' => 'disabled'], 'here')) . node::create('li', [], 'A triangle of 4 points where the 4th is also the 1st can be saved as a declaration of intent by clicking ' . node::create('a#decTR.button.inline', ['data-ajax-click' => 'planner:get_form', 'data-ajax-post' => '{"coordinates":"", "ftid":' . flight_type::TR_ID . '}', 'disabled' => 'disabled'], 'here'))) . node::create('div#path_wrapper', [], node::create('h4.page-header', [], 'Path') . node::create('div#path', [], '')) . node::create('p', [], node::create('a#leave_wp_mode.button', [], 'Leave Waypoint mode (clears map of markers a well)')));
     $script = '$("a#enter_wp_mode").click(function(){map.planner.enable();});';
     $script .= '$("a#leave_wp_mode").click(function(){map.planner.clear();});';
     if (ajax) {
         $script .= 'map.planner.calculate_distances();map.planner.writeplanner();';
         ajax::add_script($script);
     } else {
         if ($this->module->import_string) {
             \core::$global_script[] = 'var planner_string = "' . $this->module->import_string . '"';
         }
         \core::$inline_script[] = $script;
     }
     return $html;
 }