-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtabs.php
82 lines (68 loc) · 2.72 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
<?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 apply
*/
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) {
$used_id = $cmid;
}
else {
$used_id = $id;
}
if (!$courseid) $courseid = optional_param('courseid', false, PARAM_INT);
//
$context = context_module::instance($used_id);
if (!isset($current_tab)) {
$current_tab = '';
}
// View my applications
$viewurl = new moodle_url('/mod/apply/view.php', array('id'=>$used_id, 'do_show'=>'view'));
$row[] = new tabobject('view', $viewurl->out(), get_string('overview', 'apply'));
// View all Report
if (has_capability('mod/apply:viewreports', $context)) {
$url_params = array('id'=>$used_id, 'do_show'=>'view_entries', 'sort'=>'time_modified', 'order'=>'DESC');
$reporturl = new moodle_url('/mod/apply/view_entries.php', $url_params);
$row[] = new tabobject('view_entries', $reporturl->out(), get_string('view_entries', 'apply'));
}
// Edit Item and Template
if (has_capability('mod/apply:edititems', $context)) {
//
$editurl = new moodle_url('/mod/apply/edit.php', array('id'=>$used_id, 'do_show'=>'edit'));
$row[] = new tabobject('edit', $editurl->out(), get_string('edit_items', 'apply'));
//
// $templateurl = new moodle_url('/mod/apply/edit.php', array('id'=>$used_id, 'do_show'=>'templates'));
// $row[] = new tabobject('templates', $templateurl->out(), get_string('templates', 'apply'));
}
$row[] = new tabobject('', $CFG->wwwroot.'/course/view.php?id='.$courseid, get_string('returnto_course', 'apply'));
if (count($row) > 1) {
$tabs[] = $row;
echo '<table align="center" style="margin-bottom:0.0em;"><tr><td>';
echo '<style type="text/css">';
include('./html/html.css');
echo '</style>';
print_tabs($tabs, $current_tab, $inactive, $activated);
echo '</td></tr></table>';
}