|
|
|
@ -87,7 +87,7 @@ class FlatViewDataGenerator |
|
|
|
|
$session_id = api_get_session_id(); |
|
|
|
|
$allcat = $this->category->get_subcategories(null, $course_code, $session_id); |
|
|
|
|
foreach ($allcat as $sub_cat) { |
|
|
|
|
$headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).' <br /> '.$sub_cat->get_weight().' % '; |
|
|
|
|
$headers[] = Display::url($sub_cat->get_name(), api_get_self().'?selectcat='.$sub_cat->get_id()).' '.$sub_cat->get_weight().' % '; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
|
|
@ -97,18 +97,13 @@ class FlatViewDataGenerator |
|
|
|
|
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()]; |
|
|
|
|
|
|
|
|
|
$weight = round($item->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight() *100, 2); |
|
|
|
|
$headers[] = $item->get_name().' <br />'.$weight.' % '; |
|
|
|
|
$headers[] = $item->get_name().' '.$weight.' % '; |
|
|
|
|
if ($show_detail) { |
|
|
|
|
//$headers[] = $item->get_name().' ('.get_lang('Detail').')'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$headers[] = get_lang('GradebookQualificationTotal').' 100%'; |
|
|
|
|
if ($show_detail) { |
|
|
|
|
//$headers[] = get_lang('GradebookQualificationTotal').' ('.get_lang('Detail').')'; |
|
|
|
|
} |
|
|
|
|
$headers[] = get_lang('GradebookQualificationTotal').' 100%'; |
|
|
|
|
return $headers; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -145,8 +140,7 @@ class FlatViewDataGenerator |
|
|
|
|
$headers[] = $item->get_name(); |
|
|
|
|
} |
|
|
|
|
return $headers; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Get actual array data |
|
|
|
@ -217,8 +211,12 @@ class FlatViewDataGenerator |
|
|
|
|
|
|
|
|
|
$grade_model_id = $this->category->get_grade_model_id(); |
|
|
|
|
$parent_id = $this->category->get_parent_id(); |
|
|
|
|
$main_cat = Category::load($parent_id, null, null); |
|
|
|
|
$main_weight = $main_cat[0]->get_weight(); |
|
|
|
|
if ($parent_id == 0) { |
|
|
|
|
$main_weight = $this->category->get_weight(); |
|
|
|
|
} else { |
|
|
|
|
$main_cat = Category::load($parent_id, null, null); |
|
|
|
|
$main_weight = $main_cat[0]->get_weight(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$use_grade_model = true; |
|
|
|
|
if (empty($grade_model_id) || $grade_model_id == -1) { |
|
|
|
@ -233,7 +231,9 @@ class FlatViewDataGenerator |
|
|
|
|
|
|
|
|
|
$item_value = 0; |
|
|
|
|
$item_value_total = 0; |
|
|
|
|
$item_total = 0; |
|
|
|
|
$item_total = 0; |
|
|
|
|
|
|
|
|
|
$convert_using_the_global_weight = false; |
|
|
|
|
|
|
|
|
|
if ($use_grade_model) { |
|
|
|
|
$course_code = api_get_course_id(); |
|
|
|
@ -244,26 +244,31 @@ class FlatViewDataGenerator |
|
|
|
|
$divide = ( ($score[1])==0 ) ? 1 : $score[1]; |
|
|
|
|
|
|
|
|
|
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()]; |
|
|
|
|
|
|
|
|
|
$item_value = round($score[0]/$divide,2) * 100; |
|
|
|
|
$item_value = round($score[0]/$divide,2) * $main_weight; |
|
|
|
|
|
|
|
|
|
//Fixing total when using one or multiple gradebooks |
|
|
|
|
$percentage = round($sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight(), 2); |
|
|
|
|
$item_value = $percentage*$item_value; |
|
|
|
|
|
|
|
|
|
$item_total += $sub_cat->get_weight(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($convert_using_the_global_weight) { |
|
|
|
|
$score[0] = $main_weight*$score[0]/$sub_cat->get_weight(); |
|
|
|
|
$score[1] = $main_weight ; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$temp_score = $scoredisplay->display_score($score, SCORE_DIV_PERCENT, SCORE_ONLY_SCORE); |
|
|
|
|
|
|
|
|
|
$temp_score = $temp_score; |
|
|
|
|
|
|
|
|
|
if (!$show_all) { |
|
|
|
|
$row[] = $temp_score.' '; |
|
|
|
|
} else { |
|
|
|
|
$row[] = $temp_score; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
$item_value_total +=$item_value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if ($convert_using_the_global_weight) { |
|
|
|
|
//$item_total = $main_weight; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) { |
|
|
|
|
$item = $this->evals_links[$count + $items_start]; |
|
|
|
@ -287,7 +292,7 @@ class FlatViewDataGenerator |
|
|
|
|
//$percentage = round($item->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight(), 2); |
|
|
|
|
//if ($debug) var_dump($item->get_weight().' '.$item_value .' -'.$sub_cat_percentage); |
|
|
|
|
$item_value = $item_value*$item->get_weight(); |
|
|
|
|
$item_value = 100*$item_value/$item->get_weight(); |
|
|
|
|
$item_value = $main_weight*$item_value/$item->get_weight(); |
|
|
|
|
} |
|
|
|
|
//if ($debug) var_dump($item_value); |
|
|
|
|
$item_total += $item->get_weight(); |
|
|
|
|