Fixes order see BT#9287

1.9.x
jmontoya 11 years ago
parent b8261e508d
commit ab6f1b2990
  1. 29
      main/gradebook/lib/fe/flatviewtable.class.php
  2. 4
      main/gradebook/lib/flatview_data_generator.class.php

@ -544,12 +544,9 @@ class FlatViewTable extends SortableTable
// retrieve sorting type // retrieve sorting type
if ($is_western_name_order) { if ($is_western_name_order) {
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME); $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME;
} else { } else {
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME); $users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_LASTNAME;
} }
if ($this->direction == 'DESC') { if ($this->direction == 'DESC') {
@ -557,17 +554,12 @@ class FlatViewTable extends SortableTable
} else { } else {
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC; $users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC;
} }
// step 1: generate columns: evaluations and links
// step 1: generate columns: evaluations and links
$header_names = $this->datagen->get_header_names($this->offset, $selectlimit); $header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
if ($is_western_name_order) { $this->set_header(0, $header_names[0]);
$this->set_header(0, $header_names[1]); $this->set_header(1, $header_names[1]);
$this->set_header(1, $header_names[0]);
} else {
$this->set_header(0, $header_names[0]);
$this->set_header(1, $header_names[1]);
}
$column = 2; $column = 2;
while ($column < count($header_names)) { while ($column < count($header_names)) {
@ -588,14 +580,13 @@ class FlatViewTable extends SortableTable
$table_row = array(); $table_row = array();
$count = 0; $count = 0;
$user_id = $user_row[$count++]; $user_id = $user_row[$count++];
$lastname = $user_row[$count++]; $userInfo = api_get_user_info($user_id);
$firstname = $user_row[$count++];
if ($is_western_name_order) { if ($is_western_name_order) {
$table_row[] = $this->build_name_link($user_id, $firstname); $table_row[] = $this->build_name_link($user_id, $userInfo['firstname']);
$table_row[] = $this->build_name_link($user_id, $lastname); $table_row[] = $this->build_name_link($user_id, $userInfo['lastname']);
} else { } else {
$table_row[] = $this->build_name_link($user_id, $lastname); $table_row[] = $this->build_name_link($user_id, $userInfo['lastname']);
$table_row[] = $this->build_name_link($user_id, $firstname); $table_row[] = $this->build_name_link($user_id, $userInfo['firstname']);
} }
while ($count < count($user_row)) { while ($count < count($user_row)) {
$table_row[] = $user_row[$count++]; $table_row[] = $user_row[$count++];

@ -87,6 +87,7 @@ class FlatViewDataGenerator
if (isset($this->params['show_official_code']) && $this->params['show_official_code']) { if (isset($this->params['show_official_code']) && $this->params['show_official_code']) {
$headers[] = get_lang('OfficialCode'); $headers[] = get_lang('OfficialCode');
} }
if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) { if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) {
if (api_is_western_name_order()) { if (api_is_western_name_order()) {
$headers[] = get_lang('FirstnameAndLastname'); $headers[] = get_lang('FirstnameAndLastname');
@ -167,7 +168,7 @@ class FlatViewDataGenerator
$add_weight = " $sub_cat_weight %"; $add_weight = " $sub_cat_weight %";
$headers[] = Display::url( $headers[] = Display::url(
$sub_cat->get_name(), $sub_cat->get_name(),
api_get_self().'?selectcat='.$sub_cat->get_id() api_get_self().'?selectcat='.$sub_cat->get_id().'&'.api_get_cidreq()
).$add_weight; ).$add_weight;
} }
} else { } else {
@ -199,7 +200,6 @@ class FlatViewDataGenerator
} }
$headers[] = api_strtoupper(get_lang('GradebookQualificationTotal')); $headers[] = api_strtoupper(get_lang('GradebookQualificationTotal'));
return $headers; return $headers;
} }

Loading…
Cancel
Save