Adding setting for gradebook score results page see BT#4895 (now it works as usual)

skala
Julio Montoya 12 years ago
parent 163c94e71f
commit f134536d83
  1. 2
      main/gradebook/lib/fe/flatviewtable.class.php
  2. 47
      main/gradebook/lib/flatview_data_generator.class.php

@ -403,7 +403,7 @@ class FlatViewTable extends SortableTable
/** /**
* Function used by SortableTable to get total number of items in the table * Function used by SortableTable to get total number of items in the table
*/ */
function get_total_number_of_items () { function get_total_number_of_items() {
return $this->datagen->get_total_users_count(); return $this->datagen->get_total_users_count();
} }

@ -322,15 +322,21 @@ class FlatViewDataGenerator
$item_value = $percentage*$item_value; $item_value = $percentage*$item_value;
$item_total += $sub_cat->get_weight(); $item_total += $sub_cat->get_weight();
if ($convert_using_the_global_weight) { if ($convert_using_the_global_weight) {
//$score[0] = $main_weight*$score[0]/$sub_cat->get_weight();
$score[0] = $score[0]/$main_weight*$sub_cat->get_weight(); $score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
$score[1] = $main_weight ; $score[1] = $main_weight ;
} }
$real_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM); //if (true) {
$temp_score = Display::tip($temp_score, $real_score); $real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($real_score, $temp_score);
} else {
$real_score = $scoredisplay->display_score($real_score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $real_score);
}
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) { if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) { if (!$show_all) {
@ -348,6 +354,7 @@ class FlatViewDataGenerator
for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
$item = $this->evals_links[$count + $items_start]; $item = $this->evals_links[$count + $items_start];
$score = $item->calc_score($user_id); $score = $item->calc_score($user_id);
$real_score = $score;
$divide = ( ($score[1])==0 ) ? 1 : $score[1]; $divide = ( ($score[1])==0 ) ? 1 : $score[1];
//sub cat weight //sub cat weight
@ -359,20 +366,24 @@ class FlatViewDataGenerator
if ($this->category->get_parent_id() == 0 ) { if ($this->category->get_parent_id() == 0 ) {
$item_value = $score[0]/$divide*$item->get_weight(); $item_value = $score[0]/$divide*$item->get_weight();
} else { } else {
$item_value = $item_value*$item->get_weight(); $item_value = $item_value*$item->get_weight();
//var_dump($item_value.' - '.$item->get_weight());
//$item_value = $main_weight*$item_value/$item->get_weight();
//$item_value = $item_value*100/$item->get_weight();
} }
$item_total += $item->get_weight(); $item_total += $item->get_weight();
$complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); /*
//$temp_score = $item_value.' - '.$scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); $complete_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE);
//$temp_score = $item_value; $temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM); $temp_score = Display::tip($temp_score, $complete_score);*/
$temp_score = Display::tip($temp_score, $complete_score);
//if (true) {
if (api_get_setting('gradebook_show_percentage_in_reports') == 'false') {
$real_score = $scoredisplay->display_score($real_score, SCORE_SIMPLE);
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($real_score, $temp_score);
} else {
$temp_score = $scoredisplay->display_score(array($item_value, null), SCORE_DIV_SIMPLE_WITH_CUSTOM);
$temp_score = Display::tip($temp_score, $complete_score);
}
if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) { if (!isset($this->params['only_total_category']) || (isset($this->params['only_total_category']) && $this->params['only_total_category'] == false)) {
if (!$show_all) { if (!$show_all) {

Loading…
Cancel
Save