Browse Source

Fixes for bugs, and other tweaks to keep travis quiet.

nwp90-nwp90-allsessionsreport
Nick Phillips 6 years ago
committed by Dan Marsden
parent
commit
eb85b45dea
  1. 8
      locallib.php
  2. 25
      renderer.php

8
locallib.php

@ -121,14 +121,6 @@ function get_user_sessions_log_full($userid, $pageparams) {
$usercourses = enrol_get_users_courses($userid); $usercourses = enrol_get_users_courses($userid);
list($usql, $uparams) = $DB->get_in_or_equal(array_keys($usercourses), SQL_PARAMS_NAMED, 'cid0'); list($usql, $uparams) = $DB->get_in_or_equal(array_keys($usercourses), SQL_PARAMS_NAMED, 'cid0');
// If we base on structure->get_user_filtered_sessions_log_extended:
/* if ($this->pageparams->startdate && $this->pageparams->enddate) { */
/* $where = "ats.sessdate >= :csdate AND */
/* ats.sessdate >= :sdate AND ats.sessdate < :edate"; */
/* } else { */
/* $where = "ats.attendanceid = :aid AND ats.sessdate >= :csdate"; */
/* } */
$coursesql = "(1 = 1)"; $coursesql = "(1 = 1)";
$courseparams = array(); $courseparams = array();
$now = time(); $now = time();

25
renderer.php

@ -62,7 +62,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$filtertable->width = '100%'; $filtertable->width = '100%';
$filtertable->align = array('left', 'center', 'right', 'right'); $filtertable->align = array('left', 'center', 'right', 'right');
if ($fcontrols->pageparams->mode === mod_attendance_view_page_params::MODE_ALL_SESSIONS) { if (property_exists($fcontrols->pageparams, 'mode') &&
$fcontrols->pageparams->mode === mod_attendance_view_page_params::MODE_ALL_SESSIONS) {
$classes .= ' float-right'; $classes .= ' float-right';
$row = array(); $row = array();
@ -1338,10 +1339,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$context = context_module::instance($userdata->filtercontrols->cm->id); $context = context_module::instance($userdata->filtercontrols->cm->id);
// 'course', 'activity', 'date'
$groupby = $userdata->pageparams->groupby; $groupby = $userdata->pageparams->groupby;
//$groupby = 'course';
//$groupby = 'activity';
//$groupby = 'date';
$table = new html_table(); $table = new html_table();
$table->attributes['class'] = 'generaltable attwidth boxaligncenter allsessions'; $table->attributes['class'] = 'generaltable attwidth boxaligncenter allsessions';
@ -1402,8 +1401,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$colcount++; $colcount++;
} }
// use "session" instead // use "session" instead of "description"
//$table->head[] = get_string('description', 'attendance');
$table->head[] = get_string('session', 'attendance'); $table->head[] = get_string('session', 'attendance');
$table->align[] = 'left'; $table->align[] = 'left';
$table->colclasses[] = 'desccol'; $table->colclasses[] = 'desccol';
@ -1512,9 +1510,6 @@ class mod_attendance_renderer extends plugin_renderer_base {
// //
// A bit yucky because we can't tell whether we've seen statusset before, and // A bit yucky because we can't tell whether we've seen statusset before, and
// we usually will have, so much wasted spinning. // we usually will have, so much wasted spinning.
if ($sess->id == 163) {
error_log("STATUSSET: ".print_r($sess->statusset, true));
}
foreach ($userdata->statuses[$sess->attendanceid] as $attstatus) { foreach ($userdata->statuses[$sess->attendanceid] as $attstatus) {
if ($attstatus->setnumber === $sess->statusset) { if ($attstatus->setnumber === $sess->statusset) {
if (!array_key_exists($attstatus->acronym, $stats['date'][$weekformat]['statuses'])) { if (!array_key_exists($attstatus->acronym, $stats['date'][$weekformat]['statuses'])) {
@ -1680,7 +1675,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row = new html_table_row(); $row = new html_table_row();
$row->attributes['class'] = 'grouper'; $row->attributes['class'] = 'grouper';
$cell = new html_table_cell(); $cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2; $cell->rowspan = count($group) + 2;
$row->cells[] = $cell; $row->cells[] = $cell;
$week = date("W", $sess->sessdate); $week = date("W", $sess->sessdate);
$year = date("Y", $sess->sessdate); $year = date("Y", $sess->sessdate);
@ -1724,7 +1719,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$row = new html_table_row(); $row = new html_table_row();
$row->attributes['class'] = 'grouper'; $row->attributes['class'] = 'grouper';
$cell = new html_table_cell(); $cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2; $cell->rowspan = count($group) + 2;
if ($groupby === 'activity') { if ($groupby === 'activity') {
$headcell = $cell; // keep ref to be able to adjust rowspan later $headcell = $cell; // keep ref to be able to adjust rowspan later
$cell->rowspan += 2; $cell->rowspan += 2;
@ -1766,12 +1761,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
if ($groupby === 'activity') { if ($groupby === 'activity') {
if ($sess->courseid === $lastgroup[0]) { if ($sess->courseid === $lastgroup[0]) {
$headcell->rowspan += sizeof($group) + 2; $headcell->rowspan += count($group) + 2;
} }
$row = new html_table_row(); $row = new html_table_row();
$row->attributes['class'] = 'grouper'; $row->attributes['class'] = 'grouper';
$cell = new html_table_cell(); $cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2; $cell->rowspan = count($group) + 2;
$row->cells[] = $cell; $row->cells[] = $cell;
$attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $sess->cmid, $attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $sess->cmid,
'studentid' => $userdata->user->id, 'studentid' => $userdata->user->id,
@ -1812,7 +1807,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
// Now iterate over sessions in group... // Now iterate over sessions in group...
foreach($group as $sess) { foreach ($group as $sess) {
$row = new html_table_row(); $row = new html_table_row();
// partialdate? / course? / activity? / date? / session / type / status / points / remarks / action // partialdate? / course? / activity? / date? / session / type / status / points / remarks / action
@ -1868,7 +1863,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
} }
if (!empty($USER->editing)) { if (!empty($USER->editing)) {
// TODO! // TODO: add ability to edit attendance here
} else { } else {
if (!empty($sess->statusid)) { if (!empty($sess->statusid)) {
$status = $userdata->statuses[$sess->attendanceid][$sess->statusid]; $status = $userdata->statuses[$sess->attendanceid][$sess->statusid];

Loading…
Cancel
Save