コード例 #1
0
ファイル: result_league.php プロジェクト: robchett/uknxcl
 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;
 }
コード例 #2
0
ファイル: result_club.php プロジェクト: robchett/uknxcl
 function make_table(league_table $data)
 {
     $pilots = 2000;
     if ($data->options->official) {
         $pilots = 4;
     }
     $pilots_array = new table_array();
     /** @var \object\flight $flight */
     foreach ($data->flights as $flight) {
         if (isset($pilots_array[$flight->ClassID . '.' . $flight->c_name])) {
             $pilots_array[$flight->ClassID . '.' . $flight->c_name]->add_flight($flight);
         } else {
             /** @var pilot $pilot */
             $pilot = new $data->class();
             $pilot->set_from_flight($flight, $data->max_flights, false);
             $pilots_array[$flight->ClassID . '.' . $flight->c_name] = $pilot;
         }
     }
     // Sort pilots by score.
     if ($pilots_array->count()) {
         $pilots_array->uasort(['\\module\\tables\\object\\league_table', 'cmp']);
     } else {
         return node::create('table.main thead tr th.c', ['style' => 'width:663px'], 'No Flights to display');
     }
     $club_array = new table_array();
     $pilots_array->iterate(function (scorable $pilot) use($data, $pilots, $club_array) {
         /** @var club $club */
         if ($pilot->club) {
             if (isset($club_array[$pilot->club])) {
                 $club = $club_array[$pilot->club];
                 $club->AddSub($pilot);
             } else {
                 $club = new $data->SClass();
                 $club->set_from_pilot($pilot, $pilots);
                 $club_array[$pilot->club] = $club;
             }
         }
     });
     $club_array->uasort(['\\module\\tables\\object\\league_table', 'cmp']);
     $html = node::create('div.table_wrapper', [], node::create('h3.heading', [], $data->Title) . $club_array->iterate_return(function (club $club, $i) use($data) {
         return node::create('div.table_wrapper.inner', [], $club->writeClubSemiHead($i + 1) . node::create('table.results.main.flights_' . $data->max_flights, [], $data->write_table_header($data->max_flights, $data->class_primary_key) . $club->content));
     }));
     return $html;
 }
コード例 #3
0
ファイル: skywings.php プロジェクト: robchett/uknxcl
 public function get_view()
 {
     $html = '';
     $league_table = new league_table();
     $league_table->set_year(date('Y'));
     $league_table->get_flights();
     $league_table->class = '\\object\\pilot_official';
     /** @var \object\pilot[]|\object\pilot_official[] $array */
     $array = [];
     foreach ($league_table->flights as $t) {
         if ($league_table->options->split_classes && $t->class == 5) {
             $t->ClassID += 8000;
         }
         if (isset($array[$t->ClassID])) {
             $array[$t->ClassID]->add_flight($t);
         } else {
             /** @var $class \object\pilot */
             $class = new $league_table->class();
             $class->output_function = 'csv';
             $class->set_from_flight($t, $league_table->max_flights, $league_table->options->split_classes);
             $array[$t->ClassID] = $class;
         }
     }
     if (isset($array)) {
         usort($array, ['\\module\\tables\\object\\league_table', 'cmp']);
         //if(1)ShowTop4W($WHERE);
         $class1 = 1;
         $class5 = 1;
         $html .= '<pre>Pos ,Name ,Glider ,Club ,Best ,Second ,Third ,Forth ,Fifth ,Sixth ,Total' . "\n";
         for ($j = 0; $j < count($array); $j++) {
             if ($array[$j]->class == 1) {
                 $html .= $array[$j]->output($class1);
                 $class1++;
             } else {
                 $html .= $array[$j]->output($class5);
                 $class5++;
             }
         }
         $html .= '</pre>' . "\n";
         return $html;
     }
     return '';
 }
コード例 #4
0
ファイル: controller.php プロジェクト: robchett/uknxcl
 public function __controller(array $path)
 {
     $end_count = 1;
     if (isset($path[1]) && file_exists(root . '/inc/module/tables/view/' . $path[1] . '.php')) {
         $this->view = $path[1];
         $end_count++;
     }
     $this->current = new league_table();
     $this->current->base_url = '/mass_overlay';
     if (isset($path[$end_count])) {
         $this->current->set_default(league_table::decode_url(end($path)));
     }
     parent::__controller($path);
 }
コード例 #5
0
ファイル: controller.php プロジェクト: robchett/uknxcl
 public function __controller(array $path)
 {
     $layout = '';
     $end_count = 1;
     if (isset($path[1]) && file_exists(root . '/inc/module/tables/view/' . $path[1] . '.php')) {
         $this->view = $path[1];
         $end_count++;
     }
     $this->current = new object\league_table();
     if (isset($path[$end_count]) && !strstr($path[$end_count], '-')) {
         $layout = $path[$end_count];
     }
     if (isset($path[$end_count])) {
         $this->current->set_default(object\league_table::decode_url(end($path)));
     }
     if ($layout) {
         $this->current->set_layout_from_url($layout);
     }
     parent::__controller($path);
 }
コード例 #6
0
ファイル: table_gen_form.php プロジェクト: robchett/uknxcl
 public function do_submit()
 {
     $table = new _object\league_table();
     $table->set_from_request();
     get::header_redirect($table->get_url() . '?module=core&act=load_page&form=' . $_REQUEST['ajax_origin']);
 }
コード例 #7
0
 public function get_glider_mode()
 {
     if ($this->glider_mode) {
         $this->parent->set_glider_view();
     }
 }
コード例 #8
0
 public function do_submit()
 {
     $table = new _object\league_table();
     $table->use_preset($this->type, $this->year);
     if ($this->type == 10) {
         $table->options->pilot_id = $this->pilot;
     }
     $table->set_year($this->year);
     if ($this->no_min) {
         $table->options->minimum_score = 0;
     }
     if ($this->glider_mode) {
         $table->options->glider_mode = true;
     }
     if ($this->split_classes) {
         $table->options->split_classes = true;
     }
     get::header_redirect($table->get_url() . '?module=core&act=load_page&form=' . $_REQUEST['ajax_origin']);
 }