|
By dservos:
CONTRIB-497
* Added flare libbary to repo as it is needed to build the flash front end. Lib is located at /grade/report/visual/flare_visualization/flare/. For more information see http://flare.prefuse.org/
* Added more visualizations.
* Added settings/preferences page for the report.
* Added printable version.
* Added more documentation.
* Added README.txt
* Cleaned up code.
* Fixed a bunch of small bugs.
|
| 1 |
<?php |
<?php |
| 2 |
|
/////////////////////////////////////////////////////////////////////////// |
| 3 |
|
// // |
| 4 |
|
// NOTICE OF COPYRIGHT // |
| 5 |
|
// // |
| 6 |
|
// Moodle - Modular Object-Oriented Dynamic Learning Environment // |
| 7 |
|
// http://moodle.org // |
| 8 |
|
// // |
| 9 |
|
// Copyright (C) 1999 onwards Martin Dougiamas http://moodle.com // |
| 10 |
|
// // |
| 11 |
|
// This program is free software; you can redistribute it and/or modify // |
| 12 |
|
// it under the terms of the GNU General Public License as published by // |
| 13 |
|
// the Free Software Foundation; either version 2 of the License, or // |
| 14 |
|
// (at your option) any later version. // |
| 15 |
|
// // |
| 16 |
|
// This program is distributed in the hope that it will be useful, // |
| 17 |
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
| 18 |
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
| 19 |
|
// GNU General Public License for more details: // |
| 20 |
|
// // |
| 21 |
|
// http://www.gnu.org/copyleft/gpl.html // |
| 22 |
|
// // |
| 23 |
|
/////////////////////////////////////////////////////////////////////////// |
| 24 |
|
|
| 25 |
|
/** |
| 26 |
|
* Generates XML output that describes a visualization and is |
| 27 |
|
* sent to the flash/flex front end. The output is based on the |
| 28 |
|
* visualizations classes found in ./visualizations |
| 29 |
|
*/ |
| 30 |
|
|
| 31 |
/// Get a session id from the URI request and make a cookie |
/// Get a session id from the URI request and make a cookie |
| 32 |
/// for it temparaly. This is needed as the flex application will |
/// for it temparaly. This is needed as the flex application will |
| 33 |
/// not have the users oringal cookie and only the session information |
/// not have the users oringal cookie and only the session information |
| 59 |
$context = get_context_instance(CONTEXT_COURSE, $course->id); |
$context = get_context_instance(CONTEXT_COURSE, $course->id); |
| 60 |
require_capability('gradereport/visual:view', $context); |
require_capability('gradereport/visual:view', $context); |
| 61 |
|
|
| 62 |
|
$vis = grade_report_visual::get_visualization($visname, $context); |
| 63 |
|
|
| 64 |
error_reporting(0); |
/// Make sure the user is allowed see this visualization |
| 65 |
|
require_capability($vis->capability, $context); |
|
$vis = grade_report_visual::get_visualization($visname); |
|
| 66 |
|
|
| 67 |
|
/// Turn of error reporting as hummans will not be seeing |
| 68 |
|
/// this and it will be read by the front end. Notices and |
| 69 |
|
/// warnings will break the XML format and stop the |
| 70 |
|
/// front end from working. |
| 71 |
|
error_reporting(0); |
| 72 |
|
|
| 73 |
|
/// Define array that repersents the XML output from the |
| 74 |
|
/// visualization class selected. |
| 75 |
$settings = array(); |
$settings = array(); |
| 76 |
$settings['visualization'] = array(); |
$settings['visualization'] = array(); |
| 77 |
|
|
|
//$settings['visualization attr'] = array('id' => 1); |
|
|
//$settings['visualization']['id'] = 1; |
|
| 78 |
$settings['visualization']['name'] = $vis->name; |
$settings['visualization']['name'] = $vis->name; |
| 79 |
$settings['visualization']['classname'] = get_class($vis); |
$settings['visualization']['classname'] = get_class($vis); |
| 80 |
|
|
| 237 |
$settings['visualization']['lang']['axes'] = get_string('axes', 'gradereport_visual'); |
$settings['visualization']['lang']['axes'] = get_string('axes', 'gradereport_visual'); |
| 238 |
$settings['visualization']['lang']['invertaxes'] = get_string('invertaxes', 'gradereport_visual'); |
$settings['visualization']['lang']['invertaxes'] = get_string('invertaxes', 'gradereport_visual'); |
| 239 |
|
|
| 240 |
|
/// Turn array into XML string and output. |
| 241 |
$xml = XML_serialize($settings); |
$xml = XML_serialize($settings); |
| 242 |
echo $xml; |
echo $xml; |
| 243 |
|
|
|
|
|
|
|
|
| 244 |
/// Clean up cookie if it was created. |
/// Clean up cookie if it was created. |
| 245 |
if($cookiewasset) { |
if($cookiewasset) { |
| 246 |
$_COOKIE['MoodleSession' . $_GET['sessioncookie']] = null; |
$_COOKIE['MoodleSession' . $_GET['sessioncookie']] = null; |