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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (view) (download)

1 : dservos 1.1 <?php
2 : dservos 1.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 :     * Index page for the visual grade book report.
27 :     */
28 :    
29 : dservos 1.1 require_once '../../../config.php';
30 :     require_once $CFG->libdir.'/gradelib.php';
31 :     require_once $CFG->dirroot.'/grade/lib.php';
32 : dservos 1.3 require_once $CFG->dirroot.'/grade/report/visual/lib.php';
33 : dservos 1.1
34 :     $courseid = required_param('id');
35 : dservos 1.3 $visid = optional_param('visid');
36 : dservos 1.1
37 :     /// basic access checks
38 :     if(isset($DB) && !is_null($DB)) {
39 :     $course = $DB->get_record('course', array('id' => $courseid));
40 :     } else {
41 :     $course = get_record('course', 'id', $courseid);
42 :     }
43 :     if (!$course) {
44 :     print_error('nocourseid');
45 :     }
46 :     require_login($course);
47 :     $context = get_context_instance(CONTEXT_COURSE, $course->id);
48 :     require_capability('gradereport/visual:view', $context);
49 :    
50 : dservos 1.3 /// get tracking object
51 :     $gpr = new grade_plugin_return(array('type'=>'report', 'plugin'=>'visual', 'courseid'=>$courseid));
52 :    
53 : dservos 1.4 /// get the visual report object.
54 : dservos 1.3 $report = new grade_report_visual($courseid, $gpr, $context, $visid);
55 :    
56 : dservos 1.4 /// make sure the user is allowed to view the selected visualization.
57 :     require_capability(grade_report_visual::get_visualization($report->visid, $context)->capability, $context);
58 :    
59 : dservos 1.1 /// last selected report session tracking
60 :     if (!isset($USER->grade_last_report)) {
61 :     $USER->grade_last_report = array();
62 :     }
63 :     $USER->grade_last_report[$course->id] = 'visual';
64 :    
65 :     /// Build navigation
66 :     $strgrades = get_string('grades');
67 :     $reportname = get_string('modulename', 'gradereport_visual');
68 :     $navigation = grade_build_nav(__FILE__, $reportname, $courseid);
69 :    
70 :     /// Print header
71 :     print_header_simple($strgrades.': '.$reportname, ': '.$strgrades, $navigation, '', '', true, null, navmenu($course), false, null);
72 :    
73 :     /// Print the plugin selector at the top
74 :     print_grade_plugin_selector($courseid, 'report', 'stats');
75 :    
76 : dservos 1.4 /// Add tabs
77 : dservos 1.1 $currenttab = 'visualreport';
78 :     require('tabs.php');
79 :    
80 : dservos 1.4 /// Make and output the html for the report.
81 : dservos 1.3 $report->visualization_selector();
82 :     $report->adapt_html();
83 :    
84 : dservos 1.1 /// Print footer
85 :     print_footer($course);
86 :     ?>

Moodle CVS Admin
ViewVC Help
Powered by ViewVC 1.0.7