Browse Source

Coding guideline/behat fixes

MOODLE_29_STABLE
Dan Marsden 9 years ago
parent
commit
403b4e4bad
  1. 6
      export_form.php
  2. 23
      renderer.php
  3. 8
      sessions.php
  4. 4
      tests/behat/extra_features.feature

6
export_form.php

@ -125,10 +125,10 @@ class mod_attendance_export_form extends moodleform {
$mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod', 'attendance')); $mform->addElement('date_selector', 'sessionenddate', get_string('endofperiod', 'attendance'));
$mform->disabledIf('sessionenddate', 'includeallsessions', 'checked'); $mform->disabledIf('sessionenddate', 'includeallsessions', 'checked');
$mform->addElement('select', 'format', get_string('format'), $formatoptions = array('excel' => get_string('downloadexcel', 'attendance'),
array('excel' => get_string('downloadexcel', 'attendance'),
'ooo' => get_string('downloadooo', 'attendance'), 'ooo' => get_string('downloadooo', 'attendance'),
'text' => get_string('downloadtext', 'attendance'))); 'text' => get_string('downloadtext', 'attendance'));
$mform->addElement('select', 'format', get_string('format'), $formatoptions);
$submitstring = get_string('ok'); $submitstring = get_string('ok');
$this->add_action_buttons(false, $submitstring); $this->add_action_buttons(false, $submitstring);

23
renderer.php

@ -234,8 +234,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
$dta = $this->construct_date_time_actions($sessdata, $sess); $dta = $this->construct_date_time_actions($sessdata, $sess);
$table->data[$sess->id][] = $i; $table->data[$sess->id][] = $i;
$table->data[$sess->id][] = $sess->groupid ? get_string('group') . ': ' . $sessdata->groups[$sess->groupid]->name if ($sess->groupid) {
: get_string('commonsession', 'attendance'); $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['date'];
$table->data[$sess->id][] = $dta['time']; $table->data[$sess->id][] = $dta['time'];
$table->data[$sess->id][] = $sess->description; $table->data[$sess->id][] = $sess->description;
@ -770,8 +774,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row = new html_table_row(); $row = new html_table_row();
$row->cells[] = $i; $row->cells[] = $i;
$sessiontypeshort = $sess->groupid ? get_string('group') . ': ' . $userdata->groups[$sess->groupid]->name if ($sess->groupid) {
: get_string('commonsession', 'attendance'); $sessiontypeshort = get_string('group') . ': ' . $userdata->groups[$sess->groupid]->name;
} else {
$sessiontypeshort = get_string('commonsession', 'attendance');
}
$row->cells[] = html_writer::tag('nobr', $sessiontypeshort); $row->cells[] = html_writer::tag('nobr', $sessiontypeshort);
$row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance')); $row->cells[] = userdate($sess->sessdate, get_string('strftimedmyw', 'attendance'));
$row->cells[] = $this->construct_time($sess->sessdate, $sess->duration); $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::link($reportdata->url_take($sess->id, $sess->groupid), $sesstext);
} }
$sesstext .= html_writer::empty_tag('br'); $sesstext .= html_writer::empty_tag('br');
$sesstext .= $sess->groupid ? get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name if ($sess->groupid) {
: get_string('commonsession', 'attendance'); $sesstext .= get_string('group') . ': ' . $reportdata->groups[$sess->groupid]->name;
} else {
$sesstext .= get_string('commonsession', 'attendance');
}
$table->head[] = $sesstext; $table->head[] = $sesstext;
$table->align[] = 'center'; $table->align[] = 'center';

8
sessions.php

@ -76,8 +76,12 @@ switch ($att->pageparams->action) {
if ($formdata = $mform->get_data()) { if ($formdata = $mform->get_data()) {
$sessions = construct_sessions_data_for_add($formdata); $sessions = construct_sessions_data_for_add($formdata);
$att->add_sessions($sessions); $att->add_sessions($sessions);
$message = count($sessions) == 1 ? get_string('sessiongenerated', 'attendance') : if (count($sessions) == 1) {
get_string('sessionsgenerated', 'attendance', count($sessions)); $message = get_string('sessiongenerated', 'attendance');
} else {
$message = get_string('sessionsgenerated', 'attendance', count($sessions));
}
mod_attendance_notifyqueue::notify_success($message); mod_attendance_notifyqueue::notify_success($message);
// Redirect to the sessions tab always showing all sessions. // Redirect to the sessions tab always showing all sessions.
$SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL; $SESSION->attcurrentattview[$cm->course] = ATT_VIEW_ALL;

4
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 follow "Add"
And I set the following fields to these values: And I set the following fields to these values:
| id_addmultiply | 0 | | 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_starthour | 10 |
| id_sestime_startminute | 0 | | id_sestime_startminute | 0 |
And I click on "submitbutton" "button" And I click on "submitbutton" "button"
And I follow "Add" And I follow "Add"
And I set the following fields to these values: And I set the following fields to these values:
| id_addmultiply | 0 | | 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_starthour | 11 |
| id_sestime_startminute | 0 | | id_sestime_startminute | 0 |
And I click on "submitbutton" "button" And I click on "submitbutton" "button"

Loading…
Cancel
Save