Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent 9bab31add1
commit 8fc2e8d100
  1. 26
      main/gradebook/gradebook_flatview.php
  2. 6
      main/gradebook/lib/flatview_data_generator.class.php
  3. 19
      main/gradebook/lib/gradebook_functions.inc.php

@ -151,14 +151,27 @@ if (isset($_GET['exportpdf'])) {
$params['export_pdf'] = true;
$params['only_total_category'] = false;
export_pdf_flatview($cat, $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
} else {
Display :: display_header(get_lang('ExportPDF'));
}
}
if (isset($_GET['print'])) {
$printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
echo print_table($printable_data[1],$printable_data[0], get_lang('FlatView'), $cat[0]->get_name());
$printable_data = get_printable_data(
$cat[0],
$users,
$alleval,
$alllinks,
$params,
$mainCourseCategory[0]
);
echo print_table(
$printable_data[1],
$printable_data[0],
get_lang('FlatView'),
$cat[0]->get_name()
);
exit;
}
@ -174,7 +187,14 @@ if (!empty($_GET['export_report']) && $_GET['export_report'] == 'export_report')
}
require_once 'gradebook_result.class.php';
$printable_data = get_printable_data($cat[0], $users, $alleval, $alllinks, $params, $mainCourseCategory[0]);
$printable_data = get_printable_data(
$cat[0],
$users,
$alleval,
$alllinks,
$params,
$mainCourseCategory[0]
);
switch ($_GET['export_format']) {
case 'xls':

@ -389,7 +389,6 @@ class FlatViewDataGenerator
$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) {
$score[0] = $score[0]/$main_weight*$sub_cat->get_weight();
@ -407,8 +406,6 @@ 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)
) {
@ -424,7 +421,6 @@ class FlatViewDataGenerator
//$item_total = $main_weight;
}
} else {
// All evaluations
$result = $this->parseEvaluations(
$user_id,
@ -462,7 +458,7 @@ class FlatViewDataGenerator
if ($export_to_pdf) {
$row['total'] = $scoredisplay->display_score($total_score);
} else {
$row[] = $scoredisplay->display_score($total_score);
$row[] = $scoredisplay->display_score($total_score);
}
} else {
if ($export_to_pdf) {

@ -445,9 +445,24 @@ function get_table_type_course($type)
return Database::get_course_table($table_evaluated[$type][0]);
}
/**
* @param Category $cat
* @param $users
* @param $alleval
* @param $alllinks
* @param $params
* @param null $mainCourseCategory
* @return array
*/
function get_printable_data($cat, $users, $alleval, $alllinks, $params, $mainCourseCategory = null)
{
$datagen = new FlatViewDataGenerator($users, $alleval, $alllinks, $params, $mainCourseCategory);
$datagen = new FlatViewDataGenerator(
$users,
$alleval,
$alllinks,
$params,
$mainCourseCategory
);
$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
$offset = intval($offset);
@ -828,7 +843,6 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array(
if ($has_data) {
$counter = 1;
//var_dump($printable_data);exit;
foreach ($printable_data[1] as &$printable_data_row) {
$column = 0;
$table->setCellContents($row, $column, $counter);
@ -847,7 +861,6 @@ function export_pdf_flatview($cat, $users, $alleval, $alllinks, $params = array(
if ($key === 'total') {
$attributes['style'] = 'font-weight:bold';
}
//var_dump($key, $printable_data_cell, $attributes);
$table->setCellContents($row, $column, $printable_data_cell);
$table->updateCellAttributes($row, $column, $attributes);
$column++;

Loading…
Cancel
Save