From 375c56b75f1d8355c0f806b53675d79e294c2bca Mon Sep 17 00:00:00 2001 From: Arnaud Ligot Date: Sun, 6 Mar 2011 16:45:20 +0100 Subject: [PATCH] enabling jquery dataTable for reports as html format --- main/reports/index.php | 4 +++- main/reports/reports.php | 20 ++++++++++++++----- .../exercicesMultiCourses.reports.php | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/main/reports/index.php b/main/reports/index.php index 5958b66ffe..09a99e5509 100644 --- a/main/reports/index.php +++ b/main/reports/index.php @@ -29,7 +29,7 @@ $this_section = SECTION_REPORTS; $tool_name=get_lang('Reports'); // Displaying the header -foreach (array('jquery.js','jquery-ui-1.8.5.custom.min.js', 'jquery.ba-bbq.min.js', 'jquery.validate.js', 'jquery.form.js', 'jquery.form.wizard.js') as $js) +foreach (array('jquery.js','jquery-ui-1.8.5.custom.min.js', 'jquery.ba-bbq.min.js', 'jquery.validate.js', 'jquery.form.js', 'jquery.form.wizard.js', 'jquery.dataTables.min.js') as $js) $htmlHeadXtra[] = ''."\n"; @@ -102,6 +102,8 @@ $htmlHeadXtra[] = ' '; +$htmlCSSXtra[] = 'dataTable.css'; + reports_loadTemplates(); Display::display_header($tool_name); diff --git a/main/reports/reports.php b/main/reports/reports.php index ccad2d0233..da0567d132 100644 --- a/main/reports/reports.php +++ b/main/reports/reports.php @@ -57,19 +57,29 @@ if (is_array($reports_template[$_REQUEST['type']])) { } if ($_REQUEST['format'] == 'html') { - echo ''; // FIXME style + echo ''; + echo '
'; // FIXME style $nfields = mysql_num_fields($result); - echo ''; + echo ''; for ($i=0; $i < $nfields; $i++) echo ''; - echo ''; + echo ''; while ($row = Database::fetch_row($result)) { echo ''; foreach ($row as $col) echo ''; - echo ''; + echo "\n"; + echo ''; + foreach ($row as $col) + echo ''; + echo "\n"; + } - echo '
'.mysql_field_name($result, $i).'
'.$col.'
'.$col.'
'; + echo ''; } else if ($_REQUEST['format'] == 'csv') { $nfields = mysql_num_fields($result); for ($i=0; $i < $nfields; $i++) diff --git a/main/reports/templates/exercicesMultiCourses.reports.php b/main/reports/templates/exercicesMultiCourses.reports.php index 3b7bce524b..68130d510a 100644 --- a/main/reports/templates/exercicesMultiCourses.reports.php +++ b/main/reports/templates/exercicesMultiCourses.reports.php @@ -38,7 +38,7 @@ function reports_template_exercicesMultiCourses_getSQL() { $columns = Database::query('select r.id as kid, c.title as course, r.child_name as test from reports_keys r, course c where r.course_id=c.id order by r.course_id, r.child_name'); if (Database::num_rows($columns) == 0) die(''.get_lang('no data found').''); - $query = 'select u.user_id, u.lastname, u.firstname '; + $query = 'select u.lastname, u.firstname '; $columns = Database::store_result($columns); foreach ($columns as $key => $column) $query .= ', avg(k'.$key.'.score) as `'.$column['course'].'-'.$column['test'].'` '; // FIXME function