-
Notifications
You must be signed in to change notification settings - Fork 0
/
tabs.php
92 lines (77 loc) · 3.62 KB
/
tabs.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
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle 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.
//
// Moodle 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 Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* prints the tabbed bar
*
* @author Andreas Grabs
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package mod_individualfeedback
*/
defined('MOODLE_INTERNAL') OR die('not allowed');
$tabs = array();
$row = array();
$inactive = array();
$activated = array();
//some pages deliver the cmid instead the id
if (isset($cmid) AND intval($cmid) AND $cmid > 0) {
$usedid = $cmid;
} else {
$usedid = $id;
}
$context = context_module::instance($usedid);
$courseid = optional_param('courseid', false, PARAM_INT);
// $current_tab = $SESSION->individualfeedback->current_tab;
if (!isset($current_tab)) {
$current_tab = '';
}
$viewurl = new moodle_url('/mod/individualfeedback/view.php', array('id' => $usedid));
$row[] = new tabobject('view', $viewurl->out(), get_string('overview', 'individualfeedback'));
$urlparams = ['id' => $usedid];
if ($individualfeedback->course == SITEID && $courseid) {
$urlparams['courseid'] = $courseid;
}
if (has_capability('mod/individualfeedback:edititems', $context)) {
$editurl = new moodle_url('/mod/individualfeedback/edit.php', $urlparams + ['do_show' => 'edit']);
$row[] = new tabobject('edit', $editurl->out(), get_string('edit_items', 'individualfeedback'));
$templateurl = new moodle_url('/mod/individualfeedback/edit.php', $urlparams + ['do_show' => 'templates']);
$row[] = new tabobject('templates', $templateurl->out(), get_string('templates', 'individualfeedback'));
}
if ($individualfeedback->course == SITEID && has_capability('mod/individualfeedback:mapcourse', $context)) {
$mapurl = new moodle_url('/mod/individualfeedback/mapcourse.php', $urlparams);
$row[] = new tabobject('mapcourse', $mapurl->out(), get_string('mappedcourses', 'individualfeedback'));
}
if (has_capability('mod/individualfeedback:viewreports', $context)) {
if ($individualfeedback->course == SITEID) {
$analysisurl = new moodle_url('/mod/individualfeedback/analysis_course.php', $urlparams);
} else {
$analysisurl = new moodle_url('/mod/individualfeedback/analysis.php', $urlparams);
}
$row[] = new tabobject('analysis', $analysisurl->out(), get_string('evaluations', 'individualfeedback'));
$reporturl = new moodle_url('/mod/individualfeedback/show_entries.php', $urlparams);
$row[] = new tabobject('showentries',
$reporturl->out(),
get_string('show_entries', 'individualfeedback'));
if ($individualfeedback->anonymous == INDIVIDUALFEEDBACK_ANONYMOUS_NO AND $individualfeedback->course != SITEID) {
$nonrespondenturl = new moodle_url('/mod/individualfeedback/show_nonrespondents.php', $urlparams);
$row[] = new tabobject('nonrespondents',
$nonrespondenturl->out(),
get_string('show_nonrespondents', 'individualfeedback'));
}
}
if (count($row) > 1) {
$tabs[] = $row;
print_tabs($tabs, $current_tab, $inactive, $activated);
}