Browse Source

Add ability to exlude sessions from absentee report calculations.

MOODLE_32_STABLE
Dan Marsden 7 years ago
parent
commit
c38a02cd0e
  1. 11
      add_form.php
  2. 3
      db/install.xml
  3. 13
      db/upgrade.php
  4. 2
      lang/en/attendance.php
  5. 2
      locallib.php
  6. 3
      settings.php
  7. 4
      version.php

11
add_form.php

@ -125,6 +125,17 @@ class mod_attendance_add_form extends moodleform {
array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext)); array('maxfiles' => EDITOR_UNLIMITED_FILES, 'noclean' => true, 'context' => $modcontext));
$mform->setType('sdescription', PARAM_RAW); $mform->setType('sdescription', PARAM_RAW);
// If warnings allow selector for reporting.
if (!empty(get_config('attendance', 'enablewarnings'))) {
$mform->addElement('checkbox', 'absenteereport', '', get_string('includeabsentee', 'attendance'));
$mform->addHelpButton('absenteereport', 'includeabsentee', 'attendance');
if (isset($pluginconfig->absenteereport_default)) {
$mform->setDefault('absenteereport', $pluginconfig->absenteereport_default);
}
} else {
$mform->addElement('hidden', 'absenteereport', 1);
$mform->setType('absenteereport', PARAM_INT);
}
// For multiple sessions. // For multiple sessions.
$mform->addElement('header', 'headeraddmultiplesessions', get_string('addmultiplesessions', 'attendance')); $mform->addElement('header', 'headeraddmultiplesessions', get_string('addmultiplesessions', 'attendance'));
if (!empty($pluginconfig->multisessionexpanded)) { if (!empty($pluginconfig->multisessionexpanded)) {

3
db/install.xml

@ -24,7 +24,7 @@
<INDEX NAME="course" UNIQUE="false" FIELDS="course"/> <INDEX NAME="course" UNIQUE="false" FIELDS="course"/>
</INDEXES> </INDEXES>
</TABLE> </TABLE>
<TABLE NAME="attendance_sessions" COMMENT="attendance_sessions table retrofitted from MySQL"> <TABLE NAME="attendance_sessions" COMMENT="attendance_sessions table">
<FIELDS> <FIELDS>
<FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/>
<FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="attendanceid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
@ -42,6 +42,7 @@
<FIELD NAME="automark" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="automark" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="automarkcompleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="automarkcompleted" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
<FIELD NAME="statusset" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which set of statuses to use"/> <FIELD NAME="statusset" TYPE="int" LENGTH="5" NOTNULL="true" DEFAULT="0" SEQUENCE="false" COMMENT="Which set of statuses to use"/>
<FIELD NAME="absenteereport" TYPE="int" LENGTH="1" NOTNULL="true" DEFAULT="1" SEQUENCE="false"/>
<FIELD NAME="caleventid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/> <FIELD NAME="caleventid" TYPE="int" LENGTH="10" NOTNULL="true" DEFAULT="0" SEQUENCE="false"/>
</FIELDS> </FIELDS>
<KEYS> <KEYS>

13
db/upgrade.php

@ -440,5 +440,18 @@ function xmldb_attendance_upgrade($oldversion=0) {
// Attendance savepoint reached. // Attendance savepoint reached.
upgrade_mod_savepoint(true, 2016121321, 'attendance'); upgrade_mod_savepoint(true, 2016121321, 'attendance');
} }
if ($oldversion < 2016121324) {
$table = new xmldb_table('attendance_sessions');
$field = new xmldb_field('absenteereport');
$field->set_attributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'statusset');
if (!$dbman->field_exists($table, $field)) {
$dbman->add_field($table, $field);
}
upgrade_mod_savepoint(true, 2016121324, 'attendance');
}
return $result; return $result;
} }

2
lang/en/attendance.php

@ -498,3 +498,5 @@ $string['warningthreshold'] = 'Warning threshold';
$string['week'] = 'week(s)'; $string['week'] = 'week(s)';
$string['weeks'] = 'Weeks'; $string['weeks'] = 'Weeks';
$string['youcantdo'] = 'You can\'t do anything'; $string['youcantdo'] = 'You can\'t do anything';
$string['includeabsentee'] = 'Include session when calculating absentee report';
$string['includeabsentee_help'] = 'If checked this session will be included in the absentee report calculations.';

2
locallib.php

@ -765,7 +765,7 @@ function attendance_get_users_to_notify($courseids = array(), $orderby = '', $al
GROUP BY attendanceid, setnumber) stm GROUP BY attendanceid, setnumber) stm
ON (stm.setnumber = ats.statusset AND stm.attendanceid = ats.attendanceid) ON (stm.setnumber = ats.statusset AND stm.attendanceid = ats.attendanceid)
{$joingroup} {$joingroup}
WHERE 1 = 1 {$where} WHERE ats.absenteereport = 1 {$where}
GROUP BY uniqueid, a.id, a.name, a.course, c.fullname, atl.studentid, n.id, n.warningpercent, GROUP BY uniqueid, a.id, a.name, a.course, c.fullname, atl.studentid, n.id, n.warningpercent,
n.emailsubject, n.emailcontent, n.emailcontentformat, n.warnafter, n.maxwarn, n.emailsubject, n.emailcontent, n.emailcontentformat, n.warnafter, n.maxwarn,
n.emailuser, n.thirdpartyemails, cm.id, c.id, {$unames2}, ns.userid n.emailuser, n.thirdpartyemails, cm.id, c.id, {$unames2}, ns.userid

3
settings.php

@ -101,6 +101,9 @@ if ($ADMIN->fulltree) {
$description = new lang_string('defaultsessionsettings_help', 'mod_attendance'); $description = new lang_string('defaultsessionsettings_help', 'mod_attendance');
$settings->add(new admin_setting_heading('defaultsessionsettings', $name, $description)); $settings->add(new admin_setting_heading('defaultsessionsettings', $name, $description));
$settings->add(new admin_setting_configcheckbox('attendance/absenteereport_default',
get_string('includeabsentee', 'attendance'), '', 1));
$settings->add(new admin_setting_configcheckbox('attendance/studentscanmark_default', $settings->add(new admin_setting_configcheckbox('attendance/studentscanmark_default',
get_string('studentscanmark', 'attendance'), '', 0)); get_string('studentscanmark', 'attendance'), '', 0));

4
version.php

@ -23,9 +23,9 @@
*/ */
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->version = 2016121323; $plugin->version = 2016121324;
$plugin->requires = 2016111800; $plugin->requires = 2016111800;
$plugin->release = '3.2.17'; $plugin->release = '3.2.18';
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
$plugin->cron = 0; $plugin->cron = 0;
$plugin->component = 'mod_attendance'; $plugin->component = 'mod_attendance';

Loading…
Cancel
Save