Skip to content

Commit ab6f1b2

Browse files
committed
Fixes order see BT#9287
1 parent b8261e5 commit ab6f1b2

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

main/gradebook/lib/fe/flatviewtable.class.php

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -544,30 +544,22 @@ public function get_table_data($from = 1, $per_page = null, $column = null, $dir
544544
// retrieve sorting type
545545

546546
if ($is_western_name_order) {
547-
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
548-
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME;
549-
547+
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME : FlatViewDataGenerator :: FVDG_SORT_LASTNAME);
550548
} else {
551-
//$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
552-
$users_sorting = FlatViewDataGenerator :: FVDG_SORT_LASTNAME;
549+
$users_sorting = ($this->column == 0 ? FlatViewDataGenerator :: FVDG_SORT_LASTNAME : FlatViewDataGenerator :: FVDG_SORT_FIRSTNAME);
553550
}
554551

555552
if ($this->direction == 'DESC') {
556553
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_DESC;
557554
} else {
558555
$users_sorting |= FlatViewDataGenerator :: FVDG_SORT_ASC;
559556
}
560-
// step 1: generate columns: evaluations and links
561557

558+
// step 1: generate columns: evaluations and links
562559
$header_names = $this->datagen->get_header_names($this->offset, $selectlimit);
563560

564-
if ($is_western_name_order) {
565-
$this->set_header(0, $header_names[1]);
566-
$this->set_header(1, $header_names[0]);
567-
} else {
568-
$this->set_header(0, $header_names[0]);
569-
$this->set_header(1, $header_names[1]);
570-
}
561+
$this->set_header(0, $header_names[0]);
562+
$this->set_header(1, $header_names[1]);
571563

572564
$column = 2;
573565
while ($column < count($header_names)) {
@@ -588,14 +580,13 @@ public function get_table_data($from = 1, $per_page = null, $column = null, $dir
588580
$table_row = array();
589581
$count = 0;
590582
$user_id = $user_row[$count++];
591-
$lastname = $user_row[$count++];
592-
$firstname = $user_row[$count++];
583+
$userInfo = api_get_user_info($user_id);
593584
if ($is_western_name_order) {
594-
$table_row[] = $this->build_name_link($user_id, $firstname);
595-
$table_row[] = $this->build_name_link($user_id, $lastname);
585+
$table_row[] = $this->build_name_link($user_id, $userInfo['firstname']);
586+
$table_row[] = $this->build_name_link($user_id, $userInfo['lastname']);
596587
} else {
597-
$table_row[] = $this->build_name_link($user_id, $lastname);
598-
$table_row[] = $this->build_name_link($user_id, $firstname);
588+
$table_row[] = $this->build_name_link($user_id, $userInfo['lastname']);
589+
$table_row[] = $this->build_name_link($user_id, $userInfo['firstname']);
599590
}
600591
while ($count < count($user_row)) {
601592
$table_row[] = $user_row[$count++];

main/gradebook/lib/flatview_data_generator.class.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public function get_header_names($items_start = 0, $items_count = null, $show_de
8787
if (isset($this->params['show_official_code']) && $this->params['show_official_code']) {
8888
$headers[] = get_lang('OfficialCode');
8989
}
90+
9091
if (isset($this->params['join_firstname_lastname']) && $this->params['join_firstname_lastname']) {
9192
if (api_is_western_name_order()) {
9293
$headers[] = get_lang('FirstnameAndLastname');
@@ -167,7 +168,7 @@ public function get_header_names($items_start = 0, $items_count = null, $show_de
167168
$add_weight = " $sub_cat_weight %";
168169
$headers[] = Display::url(
169170
$sub_cat->get_name(),
170-
api_get_self().'?selectcat='.$sub_cat->get_id()
171+
api_get_self().'?selectcat='.$sub_cat->get_id().'&'.api_get_cidreq()
171172
).$add_weight;
172173
}
173174
} else {
@@ -199,7 +200,6 @@ public function get_header_names($items_start = 0, $items_count = null, $show_de
199200
}
200201

201202
$headers[] = api_strtoupper(get_lang('GradebookQualificationTotal'));
202-
203203
return $headers;
204204
}
205205

0 commit comments

Comments
 (0)