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. 23
      renderer.php

8
locallib.php

@ -121,14 +121,6 @@ function get_user_sessions_log_full($userid, $pageparams) {
$usercourses = enrol_get_users_courses($userid);
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)";
$courseparams = array();
$now = time();

23
renderer.php

@ -62,7 +62,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$filtertable->width = '100%';
$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';
$row = array();
@ -1338,10 +1339,8 @@ class mod_attendance_renderer extends plugin_renderer_base {
$context = context_module::instance($userdata->filtercontrols->cm->id);
// 'course', 'activity', 'date'
$groupby = $userdata->pageparams->groupby;
//$groupby = 'course';
//$groupby = 'activity';
//$groupby = 'date';
$table = new html_table();
$table->attributes['class'] = 'generaltable attwidth boxaligncenter allsessions';
@ -1402,8 +1401,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
$colcount++;
}
// use "session" instead
//$table->head[] = get_string('description', 'attendance');
// use "session" instead of "description"
$table->head[] = get_string('session', 'attendance');
$table->align[] = 'left';
$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
// 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) {
if ($attstatus->setnumber === $sess->statusset) {
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->attributes['class'] = 'grouper';
$cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2;
$cell->rowspan = count($group) + 2;
$row->cells[] = $cell;
$week = date("W", $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->attributes['class'] = 'grouper';
$cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2;
$cell->rowspan = count($group) + 2;
if ($groupby === 'activity') {
$headcell = $cell; // keep ref to be able to adjust rowspan later
$cell->rowspan += 2;
@ -1766,12 +1761,12 @@ class mod_attendance_renderer extends plugin_renderer_base {
}
if ($groupby === 'activity') {
if ($sess->courseid === $lastgroup[0]) {
$headcell->rowspan += sizeof($group) + 2;
$headcell->rowspan += count($group) + 2;
}
$row = new html_table_row();
$row->attributes['class'] = 'grouper';
$cell = new html_table_cell();
$cell->rowspan = sizeof($group) + 2;
$cell->rowspan = count($group) + 2;
$row->cells[] = $cell;
$attendanceurl = new moodle_url('/mod/attendance/view.php', array('id' => $sess->cmid,
'studentid' => $userdata->user->id,
@ -1868,7 +1863,7 @@ class mod_attendance_renderer extends plugin_renderer_base {
}
if (!empty($USER->editing)) {
// TODO!
// TODO: add ability to edit attendance here
} else {
if (!empty($sess->statusid)) {
$status = $userdata->statuses[$sess->attendanceid][$sess->statusid];

Loading…
Cancel
Save