-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtabs.php
More file actions
74 lines (58 loc) · 2.42 KB
/
tabs.php
File metadata and controls
74 lines (58 loc) · 2.42 KB
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
<?php // $Id:,v 2.0 2012/05/20 16:10:00 Serafim Panov
$currenttab = $a;
if (!isset($currenttab)) {
$currenttab = 'quizes';
}
if (!isset($idh)) {
$idh = $id;
}
if (!isset($cm)) {
if (! $cm = $DB->get_record("course_modules", array( "id" => $idh))) {
error("Course Module ID was incorrect");
}
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if (!isset($contexts)){
$contexts = new question_edit_contexts($context);
}
$tabs = array();
$row = array();
$inactive = array();
$activated = array();
$row[] = new tabobject('quizes', new moodle_url("/mod/reader/view.php", array('a'=>'quizes', 'id'=>$idh)), "Quizzes");
$row[] = new tabobject('admin', new moodle_url("/mod/reader/admin.php", array('a'=>'admin', 'id'=>$idh)), "Admin Area");
if (has_capability('mod/reader:manage', $contextmodule)) {
$row[] = new tabobject('readersettings', new moodle_url("/course/mod.php", array('update'=>$cm->id, 'return'=>'true', 'sesskey'=>sesskey())), "Main Settings");
}
$tabs[] = $row;
if ($currenttab == 'admin' and isset($mode)) {
$inactive[] = 'admin';
$activated[] = 'admin';
// Standard reports we want to show first.
$reportlist = array ('overview', 'regrade', 'grading', 'analysis');
// Reports that are restricted by capability.
$reportrestrictions = array(
'regrade' => 'mod/quiz:grade',
'grading' => 'mod/quiz:grade'
);
$allreports = get_list_of_plugins("mod/quiz/report");
foreach ($allreports as $report) {
if (!in_array($report, $reportlist)) {
$reportlist[] = $report;
}
}
$row = array();
$currenttab = '';
foreach ($reportlist as $report) {
if (!isset($reportrestrictions[$report]) || has_capability($reportrestrictions[$report], $context)) {
$row[] = new tabobject($report, new moodle_url("/mod/reader/report.php", array("idh" => $idh, "q" => $q, "mode" => $report, "b" => $b)),
get_string($report, 'quiz_'.$report));
if ($report == $mode) {
$currenttab = $report;
}
}
}
$tabs[] = $row;
}
unset ($tabs[1][0]);
print_tabs($tabs, $currenttab, $inactive, $activated);