Beispiel #1
0
 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 '';
 }