Changing the Flat view report see BT#2849 (partial)

skala
Julio Montoya 14 years ago
parent 7da6236b3e
commit 2ce565cce3
  1. 69
      main/gradebook/gradebook_flatview.php
  2. 4
      main/gradebook/lib/fe/flatviewtable.class.php
  3. 2
      main/gradebook/lib/flatview_data_generator.class.php
  4. 15
      main/inc/lib/course.lib.php
  5. 2
      main/inc/lib/document.lib.php

@ -93,6 +93,10 @@ if (!empty($keyword)) {
}
}
$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
$flatviewtable = new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams);
if (isset ($_GET['exportpdf'])) {
$interbreadcrumb[] = array (
@ -120,15 +124,23 @@ if (isset ($_GET['exportpdf'])) {
$time = time();
$cat_name = trim($cat[0]->get_name());
$course_code = trim($cat[0]->get_course_code());
$report_name = $course_code;
if (!empty($cat_name) && $report_name != $cat_name) {
$report_name .= ' - '.$cat_name;
}
$organization = api_get_setting('Institution');
$creator = api_get_person_name($GLOBALS['_user']['firstName'], $GLOBALS['_user']['lastName']);
$displayscore = ScoreDisplay :: instance();
$customdisplays = $displayscore->get_custom_score_display_settings();
if (is_array($customdisplays) && count(($customdisplays))) {
$total = array();
foreach($customdisplays as $custom) {
$total[$custom['display']] = 0;
}
$user_results = $flatviewtable->datagen->get_data_to_graph2();
foreach($user_results as $user_result) {
$total[$user_result[count($user_result)-1][1]]++;
}
}
$html = '';
$img = api_get_path(SYS_CODE_PATH).'css/'.api_get_visual_theme().'/images/header-logo.png';
if (file_exists($img)) {
@ -139,10 +151,41 @@ if (isset ($_GET['exportpdf'])) {
$html .= '<h2 align="left">'.$organization.'</h2>';
}
}
$html .= '<h1 align="center">'.get_lang('FlatView').'</h1>';
$html .= '<p><strong>'.$report_name.'</strong></p>';
$html .= '<p><strong>'.api_convert_and_format_date(date('Y-m-d', time()), 2).'</strong></p>';
$html .= '<p><strong>'.get_lang('By').': '.$creator.'</strong></p>';
$html .= '<h2 align="center">'.get_lang('FlatView').'</h2>';
$html .= '<table align="center" width="100%"><tr><td valign="top">';
$html .= '<table align="left" width="33%">';
$session_name = api_get_session_name(api_get_session_id());
$teacher_list = CourseManager::get_teacher_list_from_course_code_to_string($course_code);
if (!empty($session_name)) {
$html .= Display::tag('tr', Display::tag('td', get_lang('Session')).Display::tag('td', Display::tag('strong', $session_name)));
}
$html .= Display::tag('tr', Display::tag('td', get_lang('Course')).Display::tag('td', Display::tag('strong', $course_code)));
$html .= Display::tag('tr', Display::tag('td', get_lang('Date')).Display::tag('td', Display::tag('strong', api_convert_and_format_date(date('Y-m-d', time()), DATE_TIME_FORMAT_LONG))));
$html .= Display::tag('tr', Display::tag('td', get_lang('Teacher')).Display::tag('td', Display::tag('strong', $teacher_list)));
$html .= '</table></td>';
$html .= '<td valign="top"><table align="left" width="33%">';
if (!empty($total)) {
foreach($total as $label => $count) {
$total_custom_score = round($count/count($user_results), 2) *100;
$html .= Display::tag('tr', Display::tag('td', $label).Display::tag('td', Display::tag('strong', $total_custom_score.' %')));
}
}
$html .= '</table></td>';
$html .= '<td valign="top"><table align="left" width="33%">';
$headers = $printable_data[0];
unset($headers[0]);
unset($headers[1]);
unset($headers[count($headers)+1]);
foreach ($headers as $head) {
$html .= Display::tag('tr', Display::tag('td', 'P1').Display::tag('td', Display::tag('strong', $head)));
}
$html .= '</table></td></table><br />';
$columns = count($printable_data[0]);
$has_data = is_array($printable_data[1]) && count($printable_data[1]) > 0;
@ -184,6 +227,7 @@ if (isset ($_GET['exportpdf'])) {
$html .= $table->toHtml();
//echo $html;exit;
// Memory release
unset($printable_data);
@ -261,8 +305,7 @@ if (isset($_GET['search'])) {
$addparams['search'] = $keyword;
}
$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
$flatviewtable = new FlatViewTable($cat[0], $users, $alleval, $alllinks, true, $offset, $addparams);
$this_section = SECTION_COURSES;
if (isset($_GET['exportpdf'])) {

@ -21,7 +21,7 @@ set_time_limit(0);
class FlatViewTable extends SortableTable
{
private $selectcat;
private $datagen;
public $datagen;
private $limit_enabled;
private $offset;
@ -188,7 +188,7 @@ class FlatViewTable extends SortableTable
$pre_result = $new_result = array();
$DataSet = new pData();
//filling the Dataset
foreach($user_results as $result) {
foreach ($user_results as $result) {
//print_r($result);
for($i=0; $i< count($header_name); $i++) {
$pre_result[$i+3][]= $result[$i+1];

@ -77,7 +77,7 @@ class FlatViewDataGenerator
//$headers[] = $item->get_name().' <br /> '.get_lang('Max').' '.$this->get_max_result_by_link($count + $items_start).' ';
$weight = round($item->get_weight()/($count_categories*100), 2)*100;
$headers[] = $item->get_name().' <br />'.$weight.'% ';
$headers[] = $item->get_name().' '.$weight.'% ';
if ($show_detail) {
//$headers[] = $item->get_name().' ('.get_lang('Detail').')';
}

@ -1291,6 +1291,21 @@ class CourseManager {
}
return $teachers;
}
public static function get_teacher_list_from_course_code_to_string($course_code) {
$teacher_list = self::get_teacher_list_from_course_code($course_code);
$teacher_string = '';
$list = array();
if (!empty($teacher_list)) {
foreach($teacher_list as $teacher) {
$list[]= api_get_person_name($teacher['firstname'], $teacher['lastname']);
}
if (!empty($list)) {
$teacher_string = implode (', ', $list);
}
}
return $teacher_string;
}
/**
* Return user info array of all users registered in the specified course

@ -2298,7 +2298,7 @@ return 'application/octet-stream';
function documents_total_space($to_group_id = '0') {
$TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
$TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
$course_id = api_get_course_int_id();
$course_id = api_get_course_int_id();
$sql = "SELECT SUM(size) FROM ".$TABLE_ITEMPROPERTY." AS props, ".$TABLE_DOCUMENT." AS docs
WHERE props.c_id = $course_id AND

Loading…
Cancel
Save