diff --git a/backup/moodle2/backup_attendance_stepslib.php b/backup/moodle2/backup_attendance_stepslib.php
index a861aec..6aefd4c 100644
--- a/backup/moodle2/backup_attendance_stepslib.php
+++ b/backup/moodle2/backup_attendance_stepslib.php
@@ -44,7 +44,7 @@ class backup_attendance_activity_structure_step extends backup_activity_structur
// XML nodes declaration - non-user data.
$attendance = new backup_nested_element('attendance', array('id'), array(
- 'name', 'intro', 'introformat', 'grade', 'showsessiondetails', 'sessiondetailspos', 'subnet'));
+ 'name', 'intro', 'introformat', 'grade', 'showextrauserdetails', 'showsessiondetails', 'sessiondetailspos', 'subnet'));
$statuses = new backup_nested_element('statuses');
$status = new backup_nested_element('status', array('id'), array(
diff --git a/classes/report_page_params.php b/classes/report_page_params.php
index a0d995c..0a68861 100644
--- a/classes/report_page_params.php
+++ b/classes/report_page_params.php
@@ -35,6 +35,8 @@ class mod_attendance_report_page_params extends mod_attendance_page_with_filter_
/** @var int */
public $sort;
/** @var int */
+ public $showextrauserdetails;
+ /** @var int */
public $showsessiondetails;
/** @var int */
public $sessiondetailspos;
@@ -73,6 +75,10 @@ class mod_attendance_report_page_params extends mod_attendance_page_with_filter_
$params['sort'] = $this->sort;
}
+ if (empty($this->showextrauserdetails)) {
+ $params['showextrauserdetails'] = 0;
+ }
+
if (empty($this->showsessiondetails)) {
$params['showsessiondetails'] = 0;
}
diff --git a/classes/structure.php b/classes/structure.php
index b4ba507..8be5462 100644
--- a/classes/structure.php
+++ b/classes/structure.php
@@ -76,6 +76,9 @@ class mod_attendance_structure {
/** @var boolean flag set when automarking is complete. */
public $automarkcompleted;
+ /** @var int Define if extra user details should be shown in reports */
+ public $showextrauserdetails;
+
/** @var int Define if session details should be shown in reports */
public $showsessiondetails;
@@ -125,6 +128,9 @@ class mod_attendance_structure {
$this->pageparams = $pageparams;
+ if (isset($pageparams->showextrauserdetails) && $pageparams->showextrauserdetails != $this->showextrauserdetails) {
+ $DB->set_field('attendance', 'showextrauserdetails', $pageparams->showextrauserdetails, array('id' => $this->id));
+ }
if (isset($pageparams->showsessiondetails) && $pageparams->showsessiondetails != $this->showsessiondetails) {
$DB->set_field('attendance', 'showsessiondetails', $pageparams->showsessiondetails, array('id' => $this->id));
}
diff --git a/db/install.xml b/db/install.xml
index 8734fc1..54ff929 100644
--- a/db/install.xml
+++ b/db/install.xml
@@ -16,6 +16,7 @@
+
@@ -148,4 +149,4 @@
-
\ No newline at end of file
+
diff --git a/db/upgrade.php b/db/upgrade.php
index 35162a5..2bcf707 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -465,5 +465,15 @@ function xmldb_attendance_upgrade($oldversion=0) {
upgrade_mod_savepoint(true, 2017050223, 'attendance');
}
+ if ($oldversion < 2017050225) {
+ $table = new xmldb_table('attendance');
+ $field = new xmldb_field('showextrauserdetails', XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, '1', 'subnet');
+ if (!$dbman->field_exists($table, $field)) {
+ $dbman->add_field($table, $field);
+ }
+ upgrade_mod_savepoint(true, 2017050225, 'attendance');
+ }
+
+
return $result;
}
diff --git a/lang/en/attendance.php b/lang/en/attendance.php
index 5853490..11301c3 100644
--- a/lang/en/attendance.php
+++ b/lang/en/attendance.php
@@ -418,6 +418,7 @@ $string['setunmarked'] = 'Automatically set when not marked';
$string['setunmarked_help'] = 'If enabled in the session, set this status if a student has not marked their own attendance.';
$string['showdefaults'] = 'Show defaults';
$string['showduration'] = 'Show duration';
+$string['showextrauserdetails'] = 'Show extra user details';
$string['showsessiondetails'] = 'Show session details';
$string['somedisabledstatus'] = '(Some options have been removed as the session has started.)';
$string['sortedgrid'] = 'Sorted grid';
diff --git a/renderer.php b/renderer.php
index 125d245..6de99dd 100644
--- a/renderer.php
+++ b/renderer.php
@@ -1239,13 +1239,31 @@ class mod_attendance_renderer extends plugin_renderer_base {
* @return array Array of html_table_row objects
*/
protected function get_user_rows(attendance_report_data $reportdata) {
+ global $OUTPUT;
$rows = array();
$extrafields = get_extra_user_fields($reportdata->att->context);
+ $showextrauserdetails = $reportdata->pageparams->showextrauserdetails;
+ $params = $reportdata->pageparams->get_significant_params();
+ $text = get_string('users');
+ if ($extrafields) {
+ if ($showextrauserdetails) {
+ $params['showextrauserdetails'] = 0;
+ $url = $reportdata->att->url_report($params);
+ $text .= $OUTPUT->action_icon($url, new pix_icon('t/switch_minus',
+ get_string('hideextrauserdetails', 'attendance')), null, null);
+ } else {
+ $params['showextrauserdetails'] = 1;
+ $url = $reportdata->att->url_report($params);
+ $text .= $OUTPUT->action_icon($url, new pix_icon('t/switch_plus',
+ get_string('showextrauserdetails', 'attendance')), null, null);
+ $extrafields = array();
+ }
+ }
$usercolspan = 1 + count($extrafields);
$row = new html_table_row();
$row->cells[] = $this->build_header_cell('');
- $row->cells[] = $this->build_header_cell(get_string('users'), false, false, $usercolspan);
+ $row->cells[] = $this->build_header_cell($text, false, false, $usercolspan);
$rows[] = $row;
$row = new html_table_row();
diff --git a/report.php b/report.php
index f0c5439..f30c69c 100644
--- a/report.php
+++ b/report.php
@@ -46,6 +46,7 @@ $context = context_module::instance($cm->id);
require_capability('mod/attendance:viewreports', $context);
$pageparams->init($cm);
+$pageparams->showextrauserdetails = optional_param('showextrauserdetails', $attrecord->showextrauserdetails, PARAM_INT);
$pageparams->showsessiondetails = optional_param('showsessiondetails', $attrecord->showsessiondetails, PARAM_INT);
$pageparams->sessiondetailspos = optional_param('sessiondetailspos', $attrecord->sessiondetailspos, PARAM_TEXT);
diff --git a/version.php b/version.php
index 6bf7d0d..535e867 100644
--- a/version.php
+++ b/version.php
@@ -23,9 +23,9 @@
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2017050224;
+$plugin->version = 2017050225;
$plugin->requires = 2017042100;
-$plugin->release = '3.3.14';
+$plugin->release = '3.3.15';
$plugin->maturity = MATURITY_STABLE;
$plugin->cron = 0;
$plugin->component = 'mod_attendance';