From e3411c05ec8ad32a4b8ef20d7180c4352cec3d29 Mon Sep 17 00:00:00 2001 From: Marty Gilbert Date: Tue, 13 Dec 2016 14:46:09 -0500 Subject: [PATCH] https://github.com/danmarsden/moodle-mod_attendance/issues/234 (#236) * https://github.com/danmarsden/moodle-mod_attendance/issues/234 I only found 3 files with this error: add_form.php: 121 renderer.php: 809 sessions.php: 240 This was branched off of the MOODLE_30_STABLE branch. * Forgot space in if() statement --- add_form.php | 3 ++- renderer.php | 3 ++- sessions.php | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/add_form.php b/add_form.php index d69dfa0..cfbaa87 100644 --- a/add_form.php +++ b/add_form.php @@ -118,7 +118,8 @@ class mod_attendance_add_form extends moodleform { } // Students can mark own attendance. - if (!empty(get_config('attendance', 'studentscanmark'))) { + $configcanmark = get_config('attendance', 'studentscanmark'); + if (!empty($configcanmark)) { $mform->addElement('checkbox', 'studentscanmark', '', get_string('studentscanmark', 'attendance')); $mform->addHelpButton('studentscanmark', 'studentscanmark', 'attendance'); } else { diff --git a/renderer.php b/renderer.php index 0f16f98..1c57c04 100644 --- a/renderer.php +++ b/renderer.php @@ -813,7 +813,8 @@ class mod_attendance_renderer extends plugin_renderer_base { $cell->colspan = 2; $row->cells[] = $cell; } else { - if (!empty(get_config('attendance', 'studentscanmark')) && !empty($sess->studentscanmark)) { + $configjs = get_config('attendance', 'studentscanmark'); + if (!empty($configjs) && !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/attendance/attendance.php', diff --git a/sessions.php b/sessions.php index 164b193..ff4fd4b 100644 --- a/sessions.php +++ b/sessions.php @@ -234,7 +234,8 @@ function construct_sessions_data_for_add($formdata) { $duration = $sesendtime - $sesstarttime; $now = time(); - if (empty(get_config('attendance', 'studentscanmark'))) { + $configcanmark = get_config('attendance', 'studentscanmark'); + if (empty($configcanmark)) { $formdata->studentscanmark = 0; }