2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Displays help via AJAX call or in a new page
20 * Use {@link core_renderer::help_icon()} or {@link addHelpButton()} to display
23 * @copyright 2017 Dan Marsden
24 * @package mod_attendance
25 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
28 require_once(dirname(__FILE__
).'/../../config.php');
30 $session = required_param('session', PARAM_INT
);
31 $session = $DB->get_record('attendance_sessions', array('id' => $session), '*', MUST_EXIST
);
33 $cm = get_coursemodule_from_instance('attendance', $session->attendanceid
);
34 require_login($cm->course
, $cm);
36 $context = context_module
::instance($cm->id
);
37 $capabilities = array('mod/attendance:manageattendances', 'mod/attendance:takeattendances', 'mod/attendance:changeattendances');
38 if (!has_any_capability($capabilities, $context)) {
42 $PAGE->set_url('/mod/attendance/password.php');
43 $PAGE->set_pagelayout('popup');
45 $PAGE->set_context(context_system
::instance());
47 $PAGE->set_title(get_string('password', 'attendance'));
49 echo $OUTPUT->header();
50 echo html_writer
::span($session->studentpassword
, 'student-password');
51 echo $OUTPUT->footer();