-
Notifications
You must be signed in to change notification settings - Fork 5
/
tabs.php
132 lines (120 loc) · 6.02 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
// This file is part of mod_datalynx for Moodle - http://moodle.org/
//
// It 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.
//
// It 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/>.
/**
* @package mod_datalynx
* @copyright 2013 onwards Ivan Sakic, Michael Pollak, Thomas Niedermaier, David Bogner
* @copyright based on the work by 2012 Itamar Tzadok
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*
*/
defined('MOODLE_INTERNAL') || die();
$istemplatemanager = has_capability('mod/datalynx:managetemplates', $this->context);
// Tabs are displayed only for template managers.
if (isloggedin() && $istemplatemanager) {
if (empty($currenttab) || empty($this->data) || empty($this->course)) {
throw new moodle_exception('emptytab', 'datalynx');
}
$inactive = array();
$activated = array();
$tabs = array();
// Browse/Management.
$row = array();
$row[] = new tabobject('browse',
new moodle_url('/mod/datalynx/view.php', array('d' => $this->id())), get_string('browse', 'datalynx'));
$row[] = new tabobject('manage',
new moodle_url('/mod/datalynx/view/index.php', array('d' => $this->id())), get_string('manage', 'datalynx'));
// Add view edit tab.
if ($currenttab == 'browse' && !empty($this->_currentview)) {
$params = array('d' => $this->id(), 'sesskey' => sesskey(),
'vedit' => $this->_currentview->id());
$editviewurl = new moodle_url('/mod/datalynx/view/view_edit.php', $params);
$row[] = new tabobject('editview', $editviewurl,
$OUTPUT->pix_icon('t/edit', get_string('vieweditthis', 'datalynx')), get_string('vieweditthis', 'datalynx'));
}
$tabs[] = $row;
if ($currenttab != 'browse') {
$inactive[] = 'manage';
$activated[] = 'manage';
$row = array();
// Template manager can do everything.
if ($istemplatemanager) {
$row[] = new tabobject('views',
new moodle_url('/mod/datalynx/view/index.php', array('d' => $this->id())),
get_string('views', 'datalynx'));
$row[] = new tabobject('fields',
new moodle_url('/mod/datalynx/field/index.php', array('d' => $this->id())),
get_string('fields', 'datalynx'));
$row[] = new tabobject('filters',
new moodle_url('/mod/datalynx/filter/index.php', array('d' => $this->id())),
get_string('filters', 'datalynx'));
$row[] = new tabobject('customfilters',
new moodle_url('/mod/datalynx/customfilter/index.php', array('d' => $this->id())),
get_string('customfilters', 'datalynx'));
$row[] = new tabobject('rules',
new moodle_url('/mod/datalynx/rule/index.php', array('d' => $this->id())),
get_string('rules', 'datalynx'));
$row[] = new tabobject('tools',
new moodle_url('/mod/datalynx/tool/index.php', array('d' => $this->id())),
get_string('tools', 'datalynx'));
$row[] = new tabobject('js',
new moodle_url('/mod/datalynx/js.php', array('d' => $this->id(), 'jsedit' => 1)),
get_string('jsinclude', 'datalynx'));
$row[] = new tabobject('css',
new moodle_url('/mod/datalynx/css.php', array('d' => $this->id(), 'cssedit' => 1)),
get_string('cssinclude', 'datalynx'));
$row[] = new tabobject('presets',
new moodle_url('/mod/datalynx/preset/index.php', array('d' => $this->id())),
get_string('presets', 'datalynx'));
$row[] = new tabobject('import',
new moodle_url('/mod/datalynx/import.php', array('d' => $this->id())),
get_string('import', 'datalynx'));
$row[] = new tabobject('statistics',
new moodle_url('/mod/datalynx/statistics/index.php', array('d' => $this->id())),
get_string('statistics', 'datalynx'));
}
$tabs[] = $row;
}
if ($currenttab == 'fields' || $currenttab == 'fields2' || $currenttab == 'behaviors' ||
$currenttab == 'renderers' || $currenttab == 'fieldgroups'
) {
$inactive[] = 'fields';
$activated[] = 'fields';
if ($currenttab == 'fields') {
$inactive[] = 'fields2';
$activated[] = 'fields2';
$currenttab = 'fields2';
}
$row = array();
// Template manager can do everything.
if ($istemplatemanager) {
$row[] = new tabobject('fields2',
new moodle_url('/mod/datalynx/field/index.php', array('d' => $this->id())),
get_string('fields', 'datalynx'));
$row[] = new tabobject('behaviors',
new moodle_url('/mod/datalynx/behavior/index.php', array('d' => $this->id())),
get_string('behaviors', 'datalynx'));
$row[] = new tabobject('renderers',
new moodle_url('/mod/datalynx/renderer/index.php', array('d' => $this->id())),
get_string('renderers', 'datalynx'));
$row[] = new tabobject('fieldgroups',
new moodle_url('/mod/datalynx/field/fieldgroup/index.php', array('d' => $this->id())),
get_string('fieldgroups', 'datalynx'));
}
$tabs[] = $row;
}
// Print out the tabs and continue!
print_tabs($tabs, $currenttab, $inactive, $activated);
}