-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.php
More file actions
133 lines (118 loc) · 5.64 KB
/
lib.php
File metadata and controls
133 lines (118 loc) · 5.64 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
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
133
<?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/>.
use local_providerapi\form\assigncourse_form;
defined('MOODLE_INTERNAL') || die();
/**
* navigation
*
* @param global_navigation $nav
* @return void
*/
function local_providerapi_extend_navigation(global_navigation $nav) {
global $CFG;
if (isloggedin()) {
$systemcontext = context_system::instance();
$url = new moodle_url($CFG->wwwroot . '/local/providerapi/modules/institution/index.php');
$root = $nav->add(get_string('pluginname', 'local_providerapi'), $url, navigation_node::TYPE_SITE_ADMIN, null,
'providerroot', new pix_icon('database', '', 'local_providerapi'));
if (has_capability('local/providerapi:viewrootnav', $systemcontext)) {
$root->showinflatnavigation = true;
}
// Institutions.
$institutions = $root->add(get_string('institutions', 'local_providerapi'),
new moodle_url('/local/providerapi/modules/institution/index.php'),
navigation_node::TYPE_SETTING, null, 'institutionmodule', null);
$institutions->nodetype = navigation_node::NODETYPE_BRANCH;
if (has_capability('local/providerapi:sharedcourse', $systemcontext)) {
$courses = $root->add(get_string('courses', 'local_providerapi'),
new moodle_url('/local/providerapi/modules/course/index.php'), navigation_node::TYPE_SETTING, null,
'coursemodule');
$courses->nodetype = navigation_node::NODETYPE_BRANCH;
}
if (has_capability('local/providerapi:viewbatch', $systemcontext)) {
$batches = $root->add(get_string('batches', 'local_providerapi'),
new moodle_url('/local/providerapi/modules/batch/index.php'), navigation_node::TYPE_SETTING, null,
'batchmmodule');
$batches->nodetype = navigation_node::NODETYPE_BRANCH;
}
}
}
/**
* @param $args
* @return mixed
* @throws required_capability_exception
*/
function local_providerapi_output_fragment_batchassigncourse_form($args) {
$args = (object) $args;
$context = $args->context;
$batchid = $args->batchid;
$formdata = [];
if (!empty($args->jsonformdata)) {
$serialiseddata = json_decode($args->jsonformdata);
parse_str($serialiseddata, $formdata);
}
require_capability('local/providerapi:assigncourse', $context);
$mform = new assigncourse_form(null, array('batchid' => $batchid), 'post', '', null, true,
$formdata);
if (!empty($args->jsonformdata)) {
// If we were passed non-empty form data we want the mform to call validation functions and show errors.
$mform->is_validated();
}
return $mform->render();
}
/**
* Get icon mapping for font-awesome.
*/
function local_providerapi_get_fontawesome_icon_map() {
return array(
'local_providerapi:home' => 'fa fa-home',
'local_providerapi:setting' => 'fa fa-cog',
'local_providerapi:settingspin' => 'fa fa-lg fa-cog fa-spin',
'local_providerapi:fa-hand-o-right' => 'fa-hand-o-right',
'local_providerapi:database' => 'fa fa-database',
'local_providerapi:arrow-right' => 'fa fa-arrow-right',
'local_providerapi:bank' => 'fa fa-university',
'local_providerapi:sube' => 'fa fa-building',
'local_providerapi:users' => 'fa fa-users',
'local_providerapi:try' => 'fa fa-try fa-fw',
'local_providerapi:percent' => 'fa fa-percent fa-fw',
'local_providerapi:pdf' => 'fa-file-pdf-o',
'local_providerapi:square' => 'fa fa-square-o',
'local_providerapi:pencil-square' => 'fa fa-pencil-square-o',
'local_providerapi:amountdown' => 'fa fa-sort-amount-down',
'local_providerapi:cap' => 'fa fa-graduation-cap',
'local_providerapi:share' => 'fa fa-share-square',
'local_providerapi:tasks' => 'fa fa-tasks',
'local_providerapi:list' => 'fa fa-list',
'local_providerapi:send' => 'fa fa-paper-plane',
'local_providerapi:draft' => 'fa fa-firstdraft',
'local_providerapi:public' => 'fa fa-share-square',
'local_providerapi:comment' => 'fa fa-comment',
'local_providerapi:down' => 'fa fa-arrow-alt-circle-down',
'local_providerapi:atlas' => 'fa fa-atlas',
'local_providerapi:book' => 'fa fa-book',
'local_providerapi:bookmark' => 'fa fa-bookmark',
'local_providerapi:school' => 'fa fa-school',
'local_providerapi:award' => 'fa fa-award',
'local_providerapi:usergraduate' => 'fa fa-user-graduate',
'local_providerapi:chalkboard' => 'fa fa-chalkboard',
'local_providerapi:bookopen' => 'fa fa-book-open',
'local_providerapi:calendar' => 'fa fa-calendar-alt',
'local_providerapi:utensils' => 'fa fa-coffee',
'local_providerapi:cookie' => 'fa fa-cookie-bite',
'local_providerapi:copy' => 'fa fa-copy',
);
}