datagen = new FlatViewDataGenerator($users, $evals, $links); $this->selectcat = $selectcat; $this->limit_enabled = $limit_enabled; $this->offset = $offset; if (isset ($addparams)) $this->set_additional_parameters($addparams); } /** * Function used by SortableTable to get total number of items in the table */ function get_total_number_of_items() { return $this->datagen->get_total_users_count(); } /** * Function used by SortableTable to generate the data to display */ function get_table_data($from = 1) { // create page navigation if needed $totalitems = $this->datagen->get_total_items_count(); if ($this->limit_enabled && $totalitems > LIMIT) $selectlimit = LIMIT; else $selectlimit = $totalitems; if ($this->limit_enabled && $totalitems > LIMIT) { $calcprevious = LIMIT; $header .= '
' .'' .'' .''; // previous X $header .= ''; // 'glue' $header .= ''; // next X $calcnext = (($this->offset+(2*LIMIT)) > $totalitems) ? ($totalitems-(LIMIT+$this->offset)) : LIMIT; $header .= ''; $header .= '
'; if ($this->offset >= LIMIT) { $header .= '' .''.get_lang('Previous').'/' .get_lang('Previous').' '.$calcprevious . ' ' . get_lang('Evaluations') .''; } else $header .= ''.get_lang('Previous').' ' . get_lang('Evaluations').'/'.get_lang('Previous').' ' . get_lang('Evaluations'); $header .= ''; if ($calcnext > 0) { $header .= '' .get_lang('Next').' '.$calcnext . ' '.get_lang('Evaluations') .''.get_lang('Next').'/' .''; } else { $header .= get_lang('Next').' '.get_lang('Evaluations').''.get_lang('Next').'/'; } $header .= '
'; echo $header; } // retrieve sorting type $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME); if ($this->direction == 'DESC') $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC; else $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC; // step 1: generate columns: evaluations and links $header_names = $this->datagen->get_header_names($this->offset, $selectlimit); $column = 0; $this->set_header($column++, $header_names[0]); $this->set_header($column++, $header_names[1]); while ($column < count($header_names)) { $this->set_header($column, $header_names[$column], false); $column++; } // step 2: generate rows: students $data_array = $this->datagen->get_data($users_sorting, $from, $this->per_page, $this->offset, $selectlimit); $table_data = array(); foreach ($data_array as $user_row) { $table_row = array (); $count = 0; $table_row[]= $this->build_name_link($user_row[$count++], $user_row[$count++]); $table_row[]= $user_row[$count++]; while ($count < count($user_row)) $table_row[] = $user_row[$count++]; $table_data[]= $table_row; } return $table_data; } // Other functions private function build_name_link ($user_id, $lastname) { return ''.$lastname.''; } } ?>