-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathreportlinkspage.class.php
110 lines (91 loc) · 4.18 KB
/
reportlinkspage.class.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
* ELIS(TM): Enterprise Learning Intelligence Suite
* Copyright (C) 2008-2013 Remote-Learner.net Inc (http://www.remote-learner.net)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package local_elisprogram
* @author Remote-Learner.net Inc
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2008-2013 Remote Learner.net Inc http://www.remote-learner.net
*
*/
defined('MOODLE_INTERNAL') || die();
require_once elispm::lib('page.class.php');
require_once elispm::lib('data/pmclass.class.php');
require_once elispm::file('pmclasspage.class.php');
/// Page for linking to external class reports
class class_reportlinkspage extends pm_page {
var $pagename = 'replnk';
var $tab_page = 'pmclasspage';
var $section = 'curr';
/**
* Return the context that the page is related to. Used by the constructor
* for calling $this->set_context().
* @return object The page context
*/
protected function _get_page_context() {
$id = $this->required_param('id', PARAM_INT);
return \local_elisprogram\context\pmclass::instance($id);
}
function build_navbar_default($who = null) {
global $CFG;
parent::build_navbar_default($who);
$this->navbar->add($this->get_page_title_default());
}
function get_page_title_default() {
return get_string('classreportlinks', 'local_elisprogram');
}
/**
* Returns an instance of the page class that should provide the tabs for this association page.
* This allows the association interface to be located "under" the general management interface for
* the data object whose associations are being viewed or modified.
*
* @param $params
* @return object
*/
function get_tab_page($params=array()) {
return new $this->tab_page($params);
}
function print_header($_) {
$id = required_param('id', PARAM_INT);
parent::print_header($_);
$this->get_tab_page()->print_tabs(get_class($this), array('id' => $id));
}
function can_do_default() {
global $USER;
$id = $this->required_param('id', PARAM_INT);
// TODO: Ugly, this needs to be overhauled
$cpage = new pmclasspage();
return $cpage->_has_capability('local/elisreports:view', $id)
|| instructor::user_is_instructor_of_class(cm_get_crlmuserid($USER->id), $id);
}
function display_default() {
global $CFG, $DB;
echo '<ul>';
$id = required_param('id', PARAM_INT); // the class id
$record = $DB->get_record(pmclass::TABLE, array('id'=>$id));
$course_id = isset($record->courseid) ? $record->courseid : 0; // the associated crlm course id (needed for course/class dependent filter on report)
// Class roster report
$class_roster_report_link = $CFG->wwwroot . '/local/elisreports/render_report_page.php?report=class_roster&classid=' . $id . '&classid_parent=' . $course_id;
$class_roster_report_name = get_string('classrosterreport', 'local_elisprogram');
echo '<li><a href="' . $class_roster_report_link . '">' . $class_roster_report_name . '</a></li>';
// Class completion report
$class_completion_report_link = $CFG->wwwroot . '/local/elisreports/render_report_page.php?report=class_completion_gas_gauge&class=' . $id . '&class_parent=' . $course_id;
$class_completion_report_name = get_string('classcompletionreport', 'local_elisprogram');
echo '<li><a href="' . $class_completion_report_link . '">' . $class_completion_report_name . '</a></li>';
echo '</ul>';
}
}