[moodle] / contrib / plugins / grade / report / visual / data.php Repository:

Annotation of /contrib/plugins/grade/report/visual/data.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download)

1 : dservos 1.1 <?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 :     * Page to be read in by the flex application.
27 :     * Outputs data for a visulasation in tab format.
28 :     */
29 :    
30 :     /// Get a session id from the URI request and make a cookie
31 :     /// for it temparaly. This is needed as the flex application will
32 :     /// not have the users oringal cookie and only the session information
33 :     /// witch is passed to it.
34 :     $cookiewasset = false;
35 :     if(empty($_COOKIE) && isset($_GET['sessionid']) && isset($_GET['sessioncookie']) && isset($_GET['sessiontest'])) {
36 :     $_COOKIE['MoodleSession' . $_GET['sessioncookie']] = $_GET['sessionid'];
37 :     $_COOKIE['MoodleSessionTest' . $_GET['sessioncookie']] = $_GET['sessiontest'];
38 :     $cookiewasset = true;
39 :     }
40 :    
41 :     require_once '../../../config.php';
42 :     require_once $CFG->libdir.'/gradelib.php';
43 :     require_once $CFG->dirroot.'/grade/lib.php';
44 :     require_once $CFG->dirroot.'/grade/report/visual/lib.php';
45 :    
46 :     $courseid = required_param('id');
47 :    
48 :     /// basic access checks
49 :     if(isset($DB) && !is_null($DB)) {
50 :     $course = $DB->get_record('course', array('id' => $courseid));
51 :     } else {
52 :     $course = get_record('course', 'id', $courseid);
53 :     }
54 :     if (!$course) {
55 :     print_error('nocourseid');
56 :     }
57 :     require_login($course);
58 :     $context = get_context_instance(CONTEXT_COURSE, $course->id);
59 :     require_capability('gradereport/visual:view', $context);
60 :    
61 :     /// get tracking object
62 :     $gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'visual', 'courseid'=>$courseid));
63 :    
64 :     grade_regrade_final_grades($courseid);
65 :    
66 :     /// Get report object
67 :     $report = new grade_report_visual($courseid, $gpr, $context);
68 :     $report->load_users();
69 :     $report->harvest_data();
70 :     $report->report_data();
71 :    
72 :     /// Output data in tab format.
73 :     echo $report->get_tab();
74 :    
75 :     /// Clean up cookie if it was created.
76 :     if($cookiewasset) {
77 :     $_COOKIE['MoodleSession' . $_GET['sessioncookie']] = null;
78 :     $_COOKIE['MoodleSessionTest' . $_GET['sessioncookie']] = null;
79 :     }
80 :     ?>

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7