|
|
|
|
@ -28,9 +28,9 @@ class GradebookTable extends SortableTable |
|
|
|
|
* @param array $links |
|
|
|
|
* @param null $addparams |
|
|
|
|
*/ |
|
|
|
|
public function __construct($currentcat, $cats = array(), $evals = array(), $links = array(), $addparams = null) |
|
|
|
|
public function __construct($currentcat, $cats = array(), $evals = array(), $links = array(), $addparams = null, $exportToPdf = false) |
|
|
|
|
{ |
|
|
|
|
parent::__construct('gradebooklist', null, null, api_is_allowed_to_edit() ? 1 : 0); |
|
|
|
|
parent::__construct('gradebooklist', null, null, api_is_allowed_to_edit() ? 1 : 0, 20, 'ASC', 'gradebook_list'); |
|
|
|
|
$this->evals_links = array_merge($evals, $links); |
|
|
|
|
$this->currentcat = $currentcat; |
|
|
|
|
$this->cats = $cats; |
|
|
|
|
@ -42,12 +42,17 @@ class GradebookTable extends SortableTable |
|
|
|
|
|
|
|
|
|
$column= 0; |
|
|
|
|
if (api_is_allowed_to_edit(null, true)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$this->set_header($column++, '', '', 'width="25px"'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->set_header($column++, get_lang('Type'), '', 'width="35px"'); |
|
|
|
|
$this->set_header($column++, get_lang('Name'), false); |
|
|
|
|
|
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$this->set_header($column++, get_lang('Description'), false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_is_allowed_to_edit(null, true)) { |
|
|
|
|
$this->set_header( |
|
|
|
|
@ -64,9 +69,11 @@ class GradebookTable extends SortableTable |
|
|
|
|
$this->set_header($column++, get_lang('Average'), false); |
|
|
|
|
|
|
|
|
|
if (!empty($cats)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$this->set_header($column++, get_lang('Actions'), false); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Deactivates the odd/even alt rows in order that the +/- buttons work see #4047 |
|
|
|
|
$this->odd_even_rows_enabled = false; |
|
|
|
|
@ -204,13 +211,14 @@ class GradebookTable extends SortableTable |
|
|
|
|
|
|
|
|
|
// Id |
|
|
|
|
if (api_is_allowed_to_edit(null, true)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $this->build_id_column($item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Type. |
|
|
|
|
$row[] = $this->build_type_column($item); |
|
|
|
|
|
|
|
|
|
$this->dataForGraph['categories'][] = $item->get_name(); |
|
|
|
|
|
|
|
|
|
// Name. |
|
|
|
|
if (get_class($item) == 'Category') { |
|
|
|
|
@ -221,11 +229,15 @@ class GradebookTable extends SortableTable |
|
|
|
|
$main_categories[$item->get_id()]['name'] = $this->build_name_link($item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$this->dataForGraph['categories'][] = $item->get_name(); |
|
|
|
|
|
|
|
|
|
$main_categories[$item->get_id()]['weight']= $item->get_weight(); |
|
|
|
|
$total_categories_weight += $item->get_weight(); |
|
|
|
|
|
|
|
|
|
// Description. |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $invisibility_span_open.$data[2].$invisibility_span_close; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Weight. |
|
|
|
|
$weight = $scoredisplay->display_score( |
|
|
|
|
@ -285,7 +297,7 @@ class GradebookTable extends SortableTable |
|
|
|
|
|
|
|
|
|
$totalResult = [ |
|
|
|
|
$totalResult[0] + $data['result_score_weight'][0], |
|
|
|
|
$totalResult[1] + $data['result_score_weight'][1], |
|
|
|
|
$totalResult[1] + $data['result_score_weight'][1] |
|
|
|
|
]; |
|
|
|
|
|
|
|
|
|
$totalBest = [ |
|
|
|
|
@ -311,16 +323,20 @@ class GradebookTable extends SortableTable |
|
|
|
|
$row[] = $average; |
|
|
|
|
|
|
|
|
|
if (get_class($item) == 'Category') { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $this->build_edit_column($item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
$row[] = $scoreToDisplay; |
|
|
|
|
|
|
|
|
|
if (!empty($this->cats)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $this->build_edit_column($item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Category added. |
|
|
|
|
$sortable_data[] = $row; |
|
|
|
|
@ -358,20 +374,24 @@ class GradebookTable extends SortableTable |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (api_is_allowed_to_edit(null, true)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $this->build_id_column($item); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
// Type |
|
|
|
|
$row[] = $this->build_type_column($item, array('style' => 'padding-left:5px')); |
|
|
|
|
|
|
|
|
|
// Name. |
|
|
|
|
$row[] = $invisibility_span_open." ".$this->build_name_link($item) . $invisibility_span_close; |
|
|
|
|
|
|
|
|
|
// Description. |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = $invisibility_span_open.$data[2].$invisibility_span_close; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$weight = $data[3]; |
|
|
|
|
$total_weight += $weight; |
|
|
|
|
|
|
|
|
|
// Weight |
|
|
|
|
$row[] = $invisibility_span_open.$weight.$invisibility_span_close; |
|
|
|
|
|
|
|
|
|
if (api_is_allowed_to_edit(null, true)) { |
|
|
|
|
@ -387,8 +407,10 @@ class GradebookTable extends SortableTable |
|
|
|
|
$cat = new Category(); |
|
|
|
|
$show_message = $cat->show_message_resource_delete($item->get_course_code()); |
|
|
|
|
if ($show_message === false) { |
|
|
|
|
if ($this->exportToPdf) { |
|
|
|
|
$row[] = $this->build_edit_column($item); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
// Students get the results and certificates columns |
|
|
|
|
$eval_n_links = array_merge($alleval, $alllink); |
|
|
|
|
@ -418,9 +440,11 @@ class GradebookTable extends SortableTable |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!empty($cats)) { |
|
|
|
|
if ($this->exportToPdf == false) { |
|
|
|
|
$row[] = null; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$row['child_of'] = $parent_id; |
|
|
|
|
$sortable_data[] = $row; |
|
|
|
|
} |
|
|
|
|
@ -518,6 +542,17 @@ class GradebookTable extends SortableTable |
|
|
|
|
SCORE_DIV |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
if ($this->exportToPdf) { |
|
|
|
|
$row = array( |
|
|
|
|
null, |
|
|
|
|
'<h3>' . get_lang('Total') . '</h3>', |
|
|
|
|
$main_weight, |
|
|
|
|
$totalResult, |
|
|
|
|
$totalRanking, |
|
|
|
|
$totalBest, |
|
|
|
|
$totalAverage, |
|
|
|
|
); |
|
|
|
|
} else { |
|
|
|
|
$row = array( |
|
|
|
|
null, |
|
|
|
|
'<h3>' . get_lang('Total') . '</h3>', |
|
|
|
|
@ -528,6 +563,7 @@ class GradebookTable extends SortableTable |
|
|
|
|
$totalBest, |
|
|
|
|
$totalAverage, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$sortable_data[] = $row; |
|
|
|
|
} |
|
|
|
|
|