Browse Source

MOODLE-845 add department and institution

MOODLE_26_STABLE
Joseph Baxter 11 years ago
parent
commit
105f3598ba
  1. 12
      export.php
  2. 11
      export_form.php
  3. 6
      locallib.php

12
export.php

@ -91,6 +91,12 @@ if ($mform->is_submitted()) {
if (isset($formdata->ident['idnumber'])) {
$data->tabhead[] = get_string('idnumber');
}
if (isset($formdata->ident['institution'])) {
$data->tabhead[] = get_string('institution');
}
if (isset($formdata->ident['department'])) {
$data->tabhead[] = get_string('department');
}
$data->tabhead[] = get_string('lastname');
$data->tabhead[] = get_string('firstname');
$groupmode = groups_get_activity_groupmode($cm, $course);
@ -127,6 +133,12 @@ if ($mform->is_submitted()) {
if (isset($formdata->ident['idnumber'])) {
$data->table[$i][] = $user->idnumber;
}
if (isset($formdata->ident['institution'])) {
$data->table[$i][] = $user->institution;
}
if (isset($formdata->ident['department'])) {
$data->table[$i][] = $user->department;
}
$data->table[$i][] = $user->lastname;
$data->table[$i][] = $user->firstname;
if (!empty($groupmode)) {

11
export_form.php

@ -63,12 +63,17 @@ class mod_attendance_export_form extends moodleform {
$ident = array();
$ident[] =& $mform->createElement('checkbox', 'id', '', get_string('studentid', 'attendance'));
$ident[] =& $mform->createElement('checkbox', 'uname', '', get_string('username'));
$ident[] =& $mform->createElement('checkbox', 'idnumber', '', get_string('idnumber'));
$optional = array('idnumber', 'institution', 'department');
foreach ($optional as $opt) {
$ident[] =& $mform->createElement('checkbox', $opt, '', get_string($opt));
$mform->setType($opt, PARAM_NOTAGS);
}
$mform->addGroup($ident, 'ident', get_string('identifyby', 'attendance'), array('<br />'), true);
$mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true, 'ident[idnumber]' => false));
$mform->setDefaults(array('ident[id]' => true, 'ident[uname]' => true));
$mform->setType('id', PARAM_INT);
$mform->setType('uname', PARAM_INT);
$mform->setType('idnumber', PARAM_NOTAGS);
$mform->addElement('checkbox', 'includeallsessions', get_string('includeall', 'attendance'), get_string('yes'));
$mform->setDefault('includeallsessions', true);

6
locallib.php

@ -981,12 +981,12 @@ class attendance {
global $DB, $CFG;
// Fields we need from the user table.
$userfields = user_picture::fields('u').',u.username,u.idnumber';
$userfields = user_picture::fields('u').',u.username,u.idnumber,u.institution,u.department';
if (isset($this->pageparams->sort) and ($this->pageparams->sort == ATT_SORT_FIRSTNAME)) {
$orderby = "u.firstname ASC, u.lastname ASC, u.idnumber ASC";
$orderby = "u.firstname ASC, u.lastname ASC, u.idnumber ASC, u.institution ASC, u.department ASC";
} else {
$orderby = "u.lastname ASC, u.firstname ASC, u.idnumber ASC";
$orderby = "u.lastname ASC, u.firstname ASC, u.idnumber ASC, u.institution ASC, u.department ASC";
}
if ($page) {

Loading…
Cancel
Save