Example #1
0
//shows course students and starts getAttended function
if ($action == 'check_attendance') {
    $title = get_string('checkattendance', 'local_attendance');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo '<h3 id="sessionStatus">' . get_string('waitingfor', 'local_attendance') . '<span>. . . </span></h3>';
    echo '<script>var courseid = ' . $courseid . ';</script>';
    //course id that will be used inside javascript
    echo '<div class="alert alert-info">' . get_string('knowledgemessage', 'local_attendance') . ' <span id="remainingTime"></span> ' . get_string('minutes', 'local_attendance') . '</div>';
    echo '<h4 id="percentage">' . get_string('total', 'local_attendance') . ': <span>0</span>%</h4>';
    echo '<h4 id="numberAttended">' . get_string('attendants', 'local_attendance') . ': <span>0</span></h4>';
    echo '<script type="text/javascript" language="javascript" src="scripts/java.js"></script>';
    echo $OUTPUT->single_button(new moodle_url('/local/attendance/attendance.php', array('courseid' => $courseid, 'action' => 'close_session')), get_string('closesession', 'local_attendance'));
    $table = tables::getCourseStudents($courseid);
    echo html_writer::table($table);
}
//start page that lets the user continue or start a session
if ($action == 'startpage') {
    $title = get_string('checkattendance', 'local_attendance');
    $PAGE->set_title($title);
    $PAGE->set_heading($title);
    echo $OUTPUT->header();
    echo $OUTPUT->heading($title);
    echo '<h3>' . $courseName->fullname . '</h3>';
    if (isset($message)) {
        echo $message;
    }
    $session = $DB->get_record('local_attendance_session', array('courseid' => $courseid, 'open' => 1));
    if (empty($session)) {