diff --git a/export_form.php b/export_form.php index 0cf5b87..2f8ef6f 100644 --- a/export_form.php +++ b/export_form.php @@ -125,10 +125,10 @@ class mod_attendance_export_form extends moodleform { $mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod', 'attendance')); $mform->disabledIf('sessionenddate', 'includeallsessions', 'checked'); - $mform->addElement('select', 'format', get_string('format'), - array('excel' => get_string('downloadexcel', 'attendance'), - 'ooo' => get_string('downloadooo', 'attendance'), - 'text' => get_string('downloadtext', 'attendance'))); + $formatoptions = array('excel' => get_string('downloadexcel', 'attendance'), + 'ooo' => get_string('downloadooo', 'attendance'), + 'text' => get_string('downloadtext', 'attendance')); + $mform->addElement('select', 'format', get_string('format'), $formatoptions); $submitstring = get_string('ok'); $this->add_action_buttons(false, $submitstring); @@ -139,7 +139,7 @@ class mod_attendance_export_form extends moodleform { public function validation($data, $files) { $errors = parent::validation($data, $files); - // Validate the 'users' field. + // Validate the 'users' field. if ($data['selectedusers'] && empty($data['users'])) { $errors['users'] = get_string('mustselectusers', 'mod_attendance'); } diff --git a/renderer.php b/renderer.php index 3849f2f..2941170 100644 --- a/renderer.php +++ b/renderer.php @@ -234,8 +234,12 @@ class mod_attendance_renderer extends plugin_renderer_base { $dta = $this->construct_date_time_actions($sessdata, $sess); $table->data[$sess->id][] = $i; - $table->data[$sess->id][] = $sess->groupid ? get_string('group') . ': ' . $sessdata->groups[$sess->groupid]->name - : get_string('commonsession', 'attendance'); + if ($sess->groupid) { + $table->data[$sess->id][] = get_string('group') . ': ' . $sessdata->groups[$sess->groupid]->name; + } else { + $table->data[$sess->id][] = get_string('commonsession', 'attendance'); + } + $table->data[$sess->id][] = $dta['date']; $table->data[$sess->id][] = $dta['time']; $table->data[$sess->id][] = $sess->description; @@ -770,8 +774,12 @@ class mod_attendance_renderer extends plugin_renderer_base { $row = new html_table_row(); $row->cells[] = $i; - $sessiontypeshort = $sess->groupid ? get_string('group') . ': ' . $userdata->groups[$sess->groupid]->name - : get_string('commonsession', 'attendance'); + if ($sess->groupid) { + $sessiontypeshort = get_string('group') . ': ' . $userdata->groups[$sess->groupid]->name; + } else { + $sessiontypeshort = get_string('commonsession', 'attendance'); + } + $row->cells[] = html_writer::tag('nobr', $sessiontypeshort); $row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance')); $row->cells[] = $this->construct_time($sess->sessdate, $sess->duration); @@ -850,8 +858,11 @@ class mod_attendance_renderer extends plugin_renderer_base { $sesstext = html_writer::link($reportdata->url_take($sess->id, $sess->groupid), $sesstext); } $sesstext .= html_writer::empty_tag('br'); - $sesstext .= $sess->groupid ? get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name - : get_string('commonsession', 'attendance'); + if ($sess->groupid) { + $sesstext .= get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name; + } else { + $sesstext .= get_string('commonsession', 'attendance'); + } $table->head[] = $sesstext; $table->align[] = 'center'; diff --git a/sessions.php b/sessions.php index c2b1809..18ffee4 100644 --- a/sessions.php +++ b/sessions.php @@ -76,8 +76,12 @@ switch ($att->pageparams->action) { if ($formdata = $mform->get_data()) { $sessions = construct_sessions_data_for_add($formdata); $att->add_sessions($sessions); - $message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') : - get_string('sessionsgenerated', 'attendance', count($sessions)); + if (count($sessions) == 1) { + $message = get_string('sessiongenerated', 'attendance'); + } else { + $message = get_string('sessionsgenerated', 'attendance', count($sessions)); + } + mod_attendance_notifyqueue::notify_success($message); // Redirect to the sessions tab always showing all sessions. $SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL; diff --git a/tests/behat/extra_features.feature b/tests/behat/extra_features.feature index 8f9599a..e4e7a5a 100644 --- a/tests/behat/extra_features.feature +++ b/tests/behat/extra_features.feature @@ -167,14 +167,14 @@ Feature: Test the various new features in the attendance module And I follow "Add" And I set the following fields to these values: | id_addmultiply | 0 | - | Use status set | Status set 1 (P L E A) | + | Status set | Status set 1 (P L E A) | | id_sestime_starthour | 10 | | id_sestime_startminute | 0 | And I click on "submitbutton" "button" And I follow "Add" And I set the following fields to these values: | id_addmultiply | 0 | - | Use status set | Status set 2 (G O B) | + | Status set | Status set 2 (G O B) | | id_sestime_starthour | 11 | | id_sestime_startminute | 0 | And I click on "submitbutton" "button"