Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent f49a59710b
commit 888c456451
  1. 11
      main/gradebook/gradebook_flatview.php
  2. 22
      main/gradebook/lib/fe/displaygradebook.php
  3. 25
      main/gradebook/lib/flatview_data_generator.class.php

@ -102,7 +102,16 @@ $offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
// Main course category
$mainCourseCategory = Category::load(null, null, api_get_course_id(), null, null, api_get_session_id());
$flatviewtable = new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams, $mainCourseCategory[0]);
$flatviewtable = new FlatViewTable(
$cat[0],
$users,
$alleval,
$alllinks,
true,
$offset,
$addparams,
$mainCourseCategory[0]
);
$parameters = array('selectcat' => intval($_GET['selectcat']));
$flatviewtable->set_additional_parameters($parameters);

@ -22,6 +22,7 @@ class DisplayGradebook
*/
static function display_header_result($evalobj, $selectcat, $page)
{
$header = null;
if (api_is_allowed_to_edit(null, true)) {
$header = '<div class="actions">';
if ($page != 'statistics') {
@ -424,35 +425,16 @@ class DisplayGradebook
$item = $allEvalsLinks[$count];
$score = $item->calc_score($user_id);
$divide = ( ($score[1]) == 0 ) ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0] / $divide * $item->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $main_weight * $main_weight;
$item_value = $score[0] / $divide * $item->get_weight();
//var_dump($score[0], $divide, $item->get_weight(), $sub_cat_percentage, $main_weight, $item_value);
$item_value_total += $item_value;
}
$item_total = $main_weight;
/*for ($count = 0; $count < count($catEvalsLinks); $count++) {
$item = $catEvalsLinks[$count];
$score = $item->calc_score($user_id);
$divide = ( ($score[1]) == 0 ) ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0]/$divide;
$item_value = $score[0] / $divide * $item->get_weight() * $sub_cat_percentage / $main_weight;
$catItemValueTotal += $score[0];
$catItemTotal += $item->get_weight();
}*/
//$item_total = $item->get_weight;
/*$item_value_total += $catItemValueTotal;
$item_total += $catItemTotal;*/
$total_score = array($item_value_total, $item_total);
$scorecourse_display = $scoredisplay->display_score($total_score, SCORE_DIV_PERCENT);
if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
$scoreinfo .= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>';
}

@ -179,6 +179,7 @@ class FlatViewDataGenerator
/**
* @param int $id
*
* @return int
*/
public function get_max_result_by_link($id)
@ -281,7 +282,7 @@ class FlatViewDataGenerator
if (isset($this->category) && !empty($this->category)) {
$categories = Category::load(null, null, null, $this->category->get_id());
if (!empty($categories)) {
foreach($categories as $category) {
foreach ($categories as $category) {
$sum_categories_weight_array[$category->get_id()] = $category->get_weight();
}
} else {
@ -365,19 +366,21 @@ class FlatViewDataGenerator
$evaluationsAdded = array();
if ($parent_id == 0 && !empty($allcat)) {
/** @var Category $sub_cat */
foreach ($allcat as $sub_cat) {
$score = $sub_cat->calc_score($user_id);
$real_score = $score;
$score = $sub_cat->calc_score($user_id);
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
$real_score = $score;
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
$item_value = $score[0]/$divide*$main_weight;
$item_value = $score[0]/$divide*$main_weight;
//Fixing total when using one or multiple gradebooks
$percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight();
$item_value = $percentage*$item_value;
$item_total += $sub_cat->get_weight();
// Fixing total when using one or multiple gradebooks
$percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight();
$item_value = $percentage*$item_value;
$item_total += $sub_cat->get_weight();
/*
if ($convert_using_the_global_weight) {
@ -396,6 +399,8 @@ class FlatViewDataGenerator
$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)
) {
@ -573,7 +578,7 @@ class FlatViewDataGenerator
$row[] = $temp_score;
}
}
$item_value_total +=$item_value;
$item_value_total += $item_value;
}
return array(

Loading…
Cancel
Save