From 91d19e10eafe0b0eec3f6733e173e17cce9e4a31 Mon Sep 17 00:00:00 2001 From: Joseph Baxter Date: Wed, 21 May 2014 14:51:27 +0100 Subject: [PATCH] first round of fixes --- add_form.php | 6 +++--- attendance.php | 18 +++++++++--------- .../backup_attendance_activity_task.class.php | 4 ++-- .../restore_attendance_activity_task.class.php | 4 ++-- locallib.php | 6 +++--- renderer.php | 8 ++++---- student_attenance_form.php | 6 +++--- 7 files changed, 26 insertions(+), 26 deletions(-) diff --git a/add_form.php b/add_form.php index 53dc051..a9550a3 100644 --- a/add_form.php +++ b/add_form.php @@ -103,9 +103,9 @@ class mod_attendance_add_form extends moodleform { $mform->addElement('checkbox', 'addmultiply', '', get_string('createmultiplesessions', 'attendance')); $mform->addHelpButton('addmultiply', 'createmultiplesessions', 'attendance'); - // Studetns can mark own attendance. - $mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark','attforblock')); - $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attforblock'); + // Students can mark own attendance. + $mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark','attendance')); + $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); $mform->addElement('date_time_selector', 'sessiondate', get_string('sessiondate', 'attendance')); diff --git a/attendance.php b/attendance.php index 9f5699b..539354c 100644 --- a/attendance.php +++ b/attendance.php @@ -18,7 +18,7 @@ * Prints attendance info for particular user * * @package mod - * @subpackage attforblock + * @subpackage attendance * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ @@ -34,37 +34,37 @@ $attendance_session_id = required_param('sessid', PARAM_INT); $attforsession = $DB->get_record('attendance_sessions', array('id' => $id), '*', MUST_EXIST); -$attforblock = $DB->get_record('attforblock', array('id' => $attforsession->attendanceid), '*', MUST_EXIST); -$cm = get_coursemodule_from_instance('attforblock', $attforblock->id, 0, false, MUST_EXIST); +$attendance = $DB->get_record('attendance', array('id' => $attforsession->attendanceid), '*', MUST_EXIST); +$cm = get_coursemodule_from_instance('attendance', $attendance->id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); // Require the user is logged in. require_login($course, true, $cm); $pageparams->sessionid = $id; -$att = new attforblock($attforblock, $cm, $course, $PAGE->context, $pageparams); +$att = new attendance($attendance, $cm, $course, $PAGE->context, $pageparams); // Require that a session key is passed to this page. require_sesskey(); // Create the form. -$mform = new mod_attforblock_student_attendance_form(null, +$mform = new mod_attendance_student_attendance_form(null, array('course' => $course, 'cm' => $cm, 'modcontext' => $PAGE->context, 'session' => $attforsession, 'attendance' => $att)); if ($mform->is_cancelled()) { // The user cancelled the form, so redirect them to the view page. - $url = new moodle_url('/mod/attforblock/view.php', array('id' => $cm->id)); + $url = new moodle_url('/mod/attendance/view.php', array('id' => $cm->id)); redirect($url); } else if ($fromform = $mform->get_data()) { if (!empty($fromform->status)) { $success = $att->take_from_student($fromform); - $url = new moodle_url('/mod/attforblock/view.php', array('id' => $cm->id)); + $url = new moodle_url('/mod/attendance/view.php', array('id' => $cm->id)); if ($success) { // Redirect back to the view page for the block. redirect($url); } else { - print_error ('attendance_already_submitted', 'mod_attforblock', $url); + print_error ('attendance_already_submitted', 'mod_attendance', $url); } } @@ -78,7 +78,7 @@ $PAGE->set_heading($course->fullname); $PAGE->set_cacheable(true); $PAGE->navbar->add($att->name); -$output = $PAGE->get_renderer('mod_attforblock'); +$output = $PAGE->get_renderer('mod_attendance'); echo $output->header(); $mform->display(); echo $output->footer(); diff --git a/backup/moodle2/backup_attendance_activity_task.class.php b/backup/moodle2/backup_attendance_activity_task.class.php index 87b5c89..df3b4a0 100644 --- a/backup/moodle2/backup_attendance_activity_task.class.php +++ b/backup/moodle2/backup_attendance_activity_task.class.php @@ -60,11 +60,11 @@ class backup_attendance_activity_task extends backup_activity_task { // Link to attendance view by moduleid. $search = "/(" . $base . "\/mod\/attendance\/view.php\?id\=)([0-9]+)/"; - $content= preg_replace($search, '$@ATTFORBLOCKVIEWBYID*$2@$', $content); + $content= preg_replace($search, '$@ATTENDANCEVIEWBYID*$2@$', $content); // Link to attendance view by moduleid and studentid. $search = "/(" . $base . "\/mod\/attendance\/view.php\?id\=)([0-9]+)\&studentid\=([0-9]+)/"; - $content= preg_replace($search, '$@ATTFORBLOCKVIEWBYIDSTUD*$2*$3@$', $content); + $content= preg_replace($search, '$@ATTENDANCEVIEWBYIDSTUD*$2*$3@$', $content); return $content; } diff --git a/backup/moodle2/restore_attendance_activity_task.class.php b/backup/moodle2/restore_attendance_activity_task.class.php index 5ca7794..629cecd 100644 --- a/backup/moodle2/restore_attendance_activity_task.class.php +++ b/backup/moodle2/restore_attendance_activity_task.class.php @@ -67,9 +67,9 @@ class restore_attendance_activity_task extends restore_activity_task { static public function define_decode_rules() { $rules = array(); - $rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYID', + $rules[] = new restore_decode_rule('ATTENDANCEVIEWBYID', '/mod/attendance/view.php?id=$1', 'course_module'); - $rules[] = new restore_decode_rule('ATTFORBLOCKVIEWBYIDSTUD', + $rules[] = new restore_decode_rule('ATTENDANCEVIEWBYIDSTUD', '/mod/attendance/view.php?id=$1&studentid=$2', array('course_module', 'user')); return $rules; diff --git a/locallib.php b/locallib.php index d5d2d79..ce2e3c8 100644 --- a/locallib.php +++ b/locallib.php @@ -854,7 +854,7 @@ class attendance { $record->studentid = $USER->id; $record->statusid = $mformdata->status; $record->statusset = $statuses; - $record->remarks = get_string('set_by_student', 'mod_attforblock'); + $record->remarks = get_string('set_by_student', 'mod_attendance'); $record->sessionid = $mformdata->sessid; $record->timetaken = $now; $record->takenby = $USER->id; @@ -882,8 +882,8 @@ class attendance { $params = array( 'sessionid' => $mformdata->sessid); $url = $this->url_take($params); - $this->log('attendance taked', $url, $USER->firstname.' '.$USER->lastname); - + add_to_log($this->course->id, 'attendance', 'taken', $url, '', $USER->id); + return true; } diff --git a/renderer.php b/renderer.php index 7ec3216..537b75d 100644 --- a/renderer.php +++ b/renderer.php @@ -174,7 +174,7 @@ class mod_attendance_renderer extends plugin_renderer_base { $views[ATT_VIEW_ALL] = get_string('all', 'attendance'); $views[ATT_VIEW_ALLPAST] = get_string('allpast', 'attendance'); if ($fcontrols->reportcontrol) { - $views[ATT_VIEW_NOTPRESENT] = get_string('lowgrade', 'attforblock'); + $views[ATT_VIEW_NOTPRESENT] = get_string('lowgrade', 'attendance'); } $views[ATT_VIEW_MONTHS] = get_string('months', 'attendance'); $views[ATT_VIEW_WEEKS] = get_string('weeks', 'attendance'); @@ -739,9 +739,9 @@ class mod_attendance_renderer extends plugin_renderer_base { } else { if (!empty($sess->studentscanmark)) { // Student can mark their own attendance. // URL to the page that lets the student modify their attendance. - $url = new moodle_url('/mod/attforblock/attendance.php', + $url = new moodle_url('/mod/attendance/attendance.php', array('sessid' => $sess->id, 'sesskey' => sesskey())); - $cell = new html_table_cell(html_writer::link($url, get_string('submitattendance', 'attforblock'))); + $cell = new html_table_cell(html_writer::link($url, get_string('submitattendance', 'attendance'))); $cell->colspan = 2; $row->cells[] = $cell; } else { // Student cannot mark their own attendace. @@ -766,7 +766,7 @@ class mod_attendance_renderer extends plugin_renderer_base { global $PAGE; // Initilise Javascript used to (un)check all checkboxes. - $this->page->requires->js_init_call('M.mod_attforblock.init_manage'); + $this->page->requires->js_init_call('M.mod_attendance.init_manage'); // Check if the user should be able to bulk send messages to other users on the course. $bulkmessagecapability = has_capability('moodle/course:bulkmessaging', $PAGE->context); diff --git a/student_attenance_form.php b/student_attenance_form.php index 7089b39..5f7d7d7 100644 --- a/student_attenance_form.php +++ b/student_attenance_form.php @@ -16,7 +16,7 @@ require_once($CFG->libdir.'/formslib.php'); -class mod_attforblock_student_attendance_form extends moodleform { +class mod_attendance_student_attendance_form extends moodleform { public function definition() { global $CFG, $USER; @@ -40,7 +40,7 @@ class mod_attforblock_student_attendance_form extends moodleform { // 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_attforblock')); + .userdate($attforsession->sessdate, get_string('strftimehm', 'mod_attendance')); $mform->addElement('header', 'session', $sesstiontitle); @@ -56,7 +56,7 @@ class mod_attforblock_student_attendance_form extends moodleform { } // Add the radio buttons as a control with the user's name in front. $mform->addGroup($radioarray, 'statusarray', $USER->firstname.' '.$USER->lastname.':', array(''), false); - $mform->addRule('statusarray', get_string('attendancenotset', 'attforblock'), 'required', '', 'client', false, false); + $mform->addRule('statusarray', get_string('attendancenotset', 'attendance'), 'required', '', 'client', false, false); $this->add_action_buttons(); }