-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathstudent_attenance_form.php
77 lines (64 loc) · 3.12 KB
/
student_attenance_form.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
<?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/>.
require_once($CFG->libdir.'/formslib.php');
class mod_attendance_student_attendance_form extends moodleform {
public function definition() {
global $CFG, $DB, $USER;
$mform =& $this->_form;
$course = $this->_customdata['course'];
$cm = $this->_customdata['cm'];
$modcontext = $this->_customdata['modcontext'];
$attforsession = $this->_customdata['session'];
$attblock = $this->_customdata['attendance'];
$faceimg = $this->_customdata['faceimg'];
$tag = $this->_customdata['tag'];
$statuses = $attblock->get_statuses();
$mform->addElement('hidden', 'sessid', null);
$mform->setType('sessid', PARAM_INT);
$mform->setConstant('sessid', $attforsession->id);
$mform->addElement('hidden', 'sesskey', null);
$mform->setType('sesskey', PARAM_INT);
$mform->setConstant('sesskey', sesskey());
// Set a title as the date and time of the session.
$sesstiontitle = userdate($attforsession->sessdate, get_string('strftimedate')).' '
.userdate($attforsession->sessdate, get_string('strftimehm', 'mod_attendance'));
$mform->addElement('header', 'session', $sesstiontitle);
// If a session description is set display it.
if (!empty($attforsession->description)) {
$mform->addElement('html', $attforsession->description);
}
if (!empty($faceimg)) {
//$group = array();
$coursecontext = context_course::instance($course->id);
$url = moodle_url::make_pluginfile_url($coursecontext->id, 'mod_attendance', 'myarea', 0, '/', $faceimg);
//$group[] =& $mform->createElement('html', "<img src=\"$url\" />");
//$mform->addGroup($group, 'ratinggroup', '', ' ', false);
$mform->addElement('html', "<img src=\"$url\" />");
$change_string = 'Change photo';
// Add get_string('savechanges')
$mform->addElement('submit', 'changebutton', $change_string);
if ($tag == 1) {
$mform->addElement('static', '', 'Teacher approval pending.', '');
} else {
// add get_string
$submit_string = 'Confirm';
$this->add_action_buttons(true, $submit_string);
}
} else {
$mform->addElement('static', '', 'No images added for this session.', '');
}
}
}