-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.php
More file actions
155 lines (127 loc) · 6.44 KB
/
Copy pathindex.php
File metadata and controls
155 lines (127 loc) · 6.44 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<?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/>.
/**
* The Augmented Teacher
*
* @package local_augmented_teacher
* @author Michael Gardener <mgardener@cissq.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
* @copyright (C) 2017 SmartLearning Inc https://www.smartlearning.dk
*/
require_once(dirname(dirname(dirname(__FILE__))) . '/config.php');
$courseid = optional_param('id', 0, PARAM_INT); // This are required.
$PAGE->set_url('/local/augmented_teacher/index.php', array('id' => $courseid));
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$context = context_course::instance($course->id, MUST_EXIST);
// Not needed anymore.
unset($courseid);
require_login($course);
$systemcontext = context_system::instance();
$isfrontpage = ($course->id == SITEID);
$frontpagectx = context_course::instance(SITEID);
if ($isfrontpage) {
$PAGE->set_pagelayout('admin');
require_capability('moodle/site:viewparticipants', $systemcontext);
} else {
$PAGE->set_pagelayout('incourse');
require_capability('moodle/course:viewparticipants', $context);
}
$PAGE->set_title("$course->shortname: ".get_string('participants'));
$PAGE->set_heading($course->fullname);
$PAGE->set_pagetype('course-view-' . $course->format);
$PAGE->add_body_class('path-user');
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$module = array('name' => 'local_augmented_teacher', 'fullpath' => '/local/augmented_teacher/module.js');
$PAGE->requires->js_init_call('M.local_augmented_teacher.init_taskselection', null, false, $module);
$settingnode = $PAGE->settingsnav->find('local_augmented_teacher', navigation_node::TYPE_SETTING);
$settingnode->make_active();
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('pluginname', 'local_augmented_teacher'));
echo html_writer::empty_tag('br');
echo html_writer::empty_tag('br');
// Should use this variable so that we don't break stuff every time a variable is added or changed.
$baseurl = new moodle_url('/local/augmented_teacher/index.php', array('id' => $course->id));
echo html_writer::start_tag('form',
array(
'id' => 'taskselectionform',
'method' => 'post',
'autocomplete' => 'off',
'action' => $CFG->wwwroot.'/local/augmented_teacher/action_redir.php'
)
);
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'returnto', 'value' => s($PAGE->url->out(false))));
$tasklist = array();
$tasklist['mergedmessages.php'] = get_string('mergedmessages', 'local_augmented_teacher');
if ($CFG->messaging) {
$tasklist['reminders.php'] = get_string('reminders', 'local_augmented_teacher');
$tasklist['notloggedinreminders.php'] = get_string('notloggedinreminder', 'local_augmented_teacher');
$tasklist['excluded_users.php'] = get_string('excludeusersfromreminders', 'local_augmented_teacher');
$tasklist['recommendactivity.php'] = get_string('recommendactivity', 'local_augmented_teacher');
$tasklist['coursenotificationsettings.php'] = get_string('coursenotificationsettings', 'local_augmented_teacher');
}
echo $OUTPUT->help_icon('choosetask', 'local_augmented_teacher');
echo html_writer::tag('label', get_string('choosetask', 'local_augmented_teacher'), array('for' => 'formactionid')) . ' ';
echo html_writer::select($tasklist, 'formaction', '', array('' => 'choosedots'), array('id' => 'formactionid'));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $course->id));
echo html_writer::end_tag('form');
echo html_writer::empty_tag('hr', array('style' => 'margin-top:30px; margin-bottom:40px'));
// Table columns.
$table = new html_table();
$table->attributes = array('style' => 'font-size: 90%; width:310px;', 'class' => '');
$table->head = array(
get_string('day', 'local_augmented_teacher'),
get_string('hours', 'local_augmented_teacher'),
);
$days = array('sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday');
for ($i = 0; $i < 7; $i++) {
$row = new html_table_row();
$row->cells = array();
$row->cells[] = get_string($days[$i], 'calendar');
if ($officehour = $DB->get_record('local_augmented_teacher_ofh', array('userid' => $USER->id, 'dayofweek' => $i))) {
$row->cells[] = gmdate('H:i', $officehour->timestart).'-'.gmdate('H:i', $officehour->timeend);
} else {
$row->cells[] = '-';
}
$table->data[] = $row;
}
$title = get_string('officehours', 'local_augmented_teacher');
if ($istopped = $DB->get_record('local_augmented_teacher_stp', array('courseid' => $course->id))) {
$time = time();
if ($istopped->timestop < $time && $time < $istopped->timeresume) {
echo html_writer::tag('div', get_string('pauseremiderwarning', 'local_augmented_teacher', userdate($istopped->timeresume)),
array('class' => 'alert alert-info'));
}
}
echo html_writer::tag('h3', $title, array('style' => 'margin-bottom: 20px;'));
echo html_writer::table($table);
// Add record form.
$formurl = new moodle_url('/local/augmented_teacher/officehours_edit.php');
$hiddenparams =
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'courseid', 'value' => $course->id)).
html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
$submitbutton = html_writer::tag('button', get_string('update', 'local_augmented_teacher'), array(
'class' => 'btn btn-add-exclusion',
'type' => 'submit',
'value' => 'submit',
));
$form = html_writer::tag('form', $hiddenparams . $submitbutton, array(
'action' => $formurl->out(),
'method' => 'post',
'autocomplete' => 'off'
));
echo html_writer::div($form, 'add-exclusion-form-wrapper', array('id' => 'add-record-btn'));
echo $OUTPUT->footer();