Browse Source

Some interface improvements (sessions filtering by different criteries) for manage.php, report.php, view.php

MOODLE_23_STABLE
Artem Andreev 15 years ago
parent
commit
7678a49767
  1. 96
      calendar.js
  2. 2
      lang/en_utf8/attforblock.php
  3. 11
      lang/ru_utf8/attforblock.php
  4. 195
      locallib.php
  5. 31
      manage.php
  6. 97
      report.php
  7. 2
      sessions.php
  8. 47
      styles.php
  9. 7
      view.php

96
calendar.js

@ -0,0 +1,96 @@
document.body.className += ' yui-skin-sam';
YAHOO.util.Event.onDOMReady(function(){
var Event = YAHOO.util.Event,
Dom = YAHOO.util.Dom,
dialog, calendar;
var showBtn = Dom.get("show");
Event.on(showBtn, "click", function() {
// Lazy Dialog Creation - Wait to create the Dialog, and setup document click listeners, until the first time the button is clicked.
if (!dialog) {
// Hide Calendar if we click anywhere in the document other than the calendar
Event.on(document, "click", function(e) {
var el = Event.getTarget(e);
var dialogEl = dialog.element;
if (el != dialogEl && !Dom.isAncestor(dialogEl, el) && el != showBtn && !Dom.isAncestor(showBtn, el)) {
dialog.hide();
}
});
function resetHandler() {
calendar.cfg.setProperty("pagedate", calendar.today);
calendar.render();
}
function closeHandler() {
dialog.hide();
}
dialog = new YAHOO.widget.Dialog("container", {
visible:false,
context:["show", "tl", "bl"],
buttons:[{text: cal_today, handler: resetHandler, isDefault:true}, {text: cal_close, handler: closeHandler}],
draggable:false,
close:false
});
dialog.setHeader('');
dialog.setBody('<div id="cal"></div>');
dialog.render(document.body);
dialog.showEvent.subscribe(function() {
if (YAHOO.env.ua.ie) {
// Since we're hiding the table using yui-overlay-hidden, we
// want to let the dialog know that the content size has changed, when
// shown
dialog.fireEvent("changeContent");
}
});
}
// Lazy Calendar Creation - Wait to create the Calendar until the first time the button is clicked.
if (!calendar) {
calendar = new YAHOO.widget.Calendar("cal", {
iframe:false, // Turn iframe off, since container has iframe support.
hide_blank_weeks:true // Enable, to demonstrate how we handle changing height, using changeContent
});
calendar.cfg.setProperty("start_weekday", cal_start_weekday);
calendar.cfg.setProperty("MONTHS_LONG", cal_months);
calendar.cfg.setProperty("WEEKDAYS_SHORT", cal_week_days);
calendar.select(new Date(cal_cur_date*1000));
calendar.render();
calendar.selectEvent.subscribe(function() {
if (calendar.getSelectedDates().length > 0) {
Dom.get("current").value = calendar.getSelectedDates()[0] / 1000;
Dom.get("currentdate").submit();
}
dialog.hide();
});
calendar.renderEvent.subscribe(function() {
// Tell Dialog it's contents have changed, which allows
// container to redraw the underlay (for IE6/Safari2)
dialog.fireEvent("changeContent");
});
}
var seldate = calendar.getSelectedDates();
if (seldate.length > 0) {
// Set the pagedate to show the selected date if it exists
calendar.cfg.setProperty("pagedate", seldate[0]);
calendar.render();
}
dialog.show();
});
});

2
lang/en_utf8/attforblock.php

@ -15,6 +15,7 @@ $string['add'] = 'Add';
$string['addmultiplesessions'] = 'Add multiple sessions';
$string['addsession'] = 'Add session';
$string['allcourses'] = 'All courses';
$string['all'] = 'All';
$string['alltaken'] = 'All taken';
$string['attendanceforthecourse'] = 'Attendance for the course';
$string['attendancegrade'] = 'Attendance grade';
@ -37,6 +38,7 @@ $string['commonsession'] = 'Common';
$string['countofselected'] = 'Count of selected';
$string['createmultiplesessions'] = 'Create multiple sessions';
$string['createonesession'] = 'Create one session for the course';
$string['days'] = 'Day';
$string['defaults'] = 'Defaults';
$string['delete'] = 'Delete';
$string['deletelogs'] = 'Delete attendance data';

11
lang/ru_utf8/attforblock.php

@ -14,6 +14,7 @@ $string['acronym'] = 'Сокращ.';
$string['add'] = 'Добавить';
$string['addmultiplesessions'] = 'Добавить несколько занятий';
$string['addsession'] = 'Добавить занятие';
$string['all'] = 'Все';
$string['alltaken'] = 'Все прошедшие';
$string['attendanceforthecourse'] = 'Посещаемость для курса';
$string['attendancegrade'] = 'Оценка за посещаемость';
@ -30,12 +31,18 @@ $string['attforblock:takeattendances'] = 'Отметка посещаемост
$string['attforblock:view'] = 'Просмотр посещаемости';
$string['attforblock:viewreports'] = 'Просмотр отчетов';
$string['attrecords'] = 'Отметок о посещаемости';
$string['calclose'] = 'Закрыть';
$string['calmonths'] = '\"Январь\", \"Февраль\", \"Март\", \"Апрель\", \"Май\", \"Июнь\", \"Июль\", \"Август\", \"Сентябрь\", \"Октябрь\", \"Ноябрь\", \"Декабрь\"';
$string['calshow'] = 'Выбрать дату';
$string['caltoday'] = 'Сегодня';
$string['calweekdays'] = ' \"Вс\", \"Пн\", \"Вт\", \"Ср\", \"Чт\", \"Пт\", \"Сб\"';
$string['changeduration'] = 'Изменить продолжительность';
$string['changesession'] = 'Изменить занятие';
$string['commonsession'] = 'Общее';
$string['countofselected'] = 'Выбрано занятий';
$string['createmultiplesessions'] = 'Создать несколько занятий';
$string['createonesession'] = 'Создать одно занятие для курса';
$string['days'] = 'День';
$string['defaults'] = 'По умолчанию';
$string['delete'] = 'Удалить';
$string['deleteselected'] = 'Удалить выбранные';
@ -61,7 +68,7 @@ $string['indetail'] = 'Подробнее...';
$string['moduledescription'] = 'Вы можете добавить только один данный модуль в каждый курс.<br />Удаление этого модуля не повлечет удаление данных о посещаемости!';
$string['modulename'] = 'Посещаемость';
$string['modulenameplural'] = 'Посещаемость';
$string['months'] = 'По месяцам';
$string['months'] = 'Месяц';
$string['myvariables'] = 'Мои переменные';
$string['newdate'] = 'Новая дата';
$string['newduration'] = 'New duration';
@ -113,7 +120,7 @@ $string['variable'] = 'переменную';
$string['variablesupdated'] = 'Переменные успешно обновлены';
$string['versionforprinting'] = 'версия для печати';
$string['week'] = 'неделя(и)';
$string['weeks'] = 'По неделям';
$string['weeks'] = 'Неделя';
$string['youcantdo'] = 'Вы ничего не можете сделать';
?>

195
locallib.php

@ -184,13 +184,28 @@ function set_current_view($courseid, $view) {
return $SESSION->currentattview[$courseid] = $view;
}
function get_current_view($courseid) {
function get_current_view($courseid, $defaultview='weeks') {
global $SESSION;
if (isset($SESSION->currentattview[$courseid]))
return $SESSION->currentattview[$courseid];
else
return 'all';
return $defaultview;
}
function set_current_date($courseid, $date) {
global $SESSION;
return $SESSION->currentattdate[$courseid] = $date;
}
function get_current_date($courseid) {
global $SESSION;
if (isset($SESSION->currentattdate[$courseid]))
return $SESSION->currentattdate[$courseid];
else
return time();
}
function print_row($left, $right) {
@ -220,7 +235,7 @@ function print_attendance_table($user, $course, $attforblock) {
}
function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing = null) {
global $CFG, $COURSE, $mode;
global $CFG, $COURSE, $mode, $current, $view, $id;
echo '<table class="userinfobox">';
if (!$printing) {
@ -248,7 +263,7 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing
echo get_string('attendancenotstarted','attforblock');
}
} else {
$stqry = "SELECT ats.id,ats.courseid
$stqry = "SELECT ats.id,ats.courseid
FROM {$CFG->prefix}attendance_log al
JOIN {$CFG->prefix}attendance_sessions ats
ON al.sessionid = ats.id
@ -275,44 +290,158 @@ function print_user_attendaces($user, $cm, $attforblock, $course = 0, $printing
if ($course) {
if ($current == 0)
$current = get_current_date($course->id);
else
set_current_date ($course->id, $current);
list($startdate, $enddate) =
print_filter_controls("view.php", $id);
if ($startdate && $enddate) {
$where = "ats.courseid={$course->id} AND al.studentid = {$user->id} AND ats.sessdate >= $startdate AND ats.sessdate < $enddate";
} else {
$where = "ats.courseid={$course->id} AND al.studentid = {$user->id}";
}
$stqry = "SELECT ats.sessdate,ats.description,al.statusid,al.remarks
FROM {$CFG->prefix}attendance_log al
JOIN {$CFG->prefix}attendance_sessions ats
ON al.sessionid = ats.id
WHERE ats.courseid = {$course->id} AND al.studentid = {$user->id}
ORDER BY ats.sessdate asc";
ON al.sessionid = ats.id";
$stqry .= " WHERE " . $where;
$stqry .= " ORDER BY ats.sessdate asc";
if ($sessions = get_records_sql($stqry)) {
$statuses = get_statuses($course->id);
?>
<div id="mod-assignment-submissions">
<table align="left" cellpadding="3" cellspacing="0" class="submissions">
<tr>
<th>#</th>
<th align="center"><?php print_string('date')?></th>
<th align="center"><?php print_string('time')?></th>
<th align="center"><?php print_string('description','attforblock')?></th>
<th align="center"><?php print_string('status','attforblock')?></th>
<th align="center"><?php print_string('remarks','attforblock')?></th>
</tr>
<?php
$i = 1;
foreach($sessions as $key=>$session)
$i = 0;
$table->head = array('#', get_string('date'), get_string('time'), get_string('description','attforblock'), get_string('status','attforblock'), get_string('remarks','attforblock'));
$table->align = array('', '', 'left', 'left', 'center', 'left');
$table->size = array('1px', '1px', '1px', '*', '1px', '1px');
$table->class = 'generaltable attwidth';
foreach($sessions as $key=>$sessdata)
{
?>
<tr>
<td align="center"><?php echo $i++;?></td>
<td><?php echo userdate($session->sessdate, get_string('strftimedmyw', 'attforblock')); //userdate($students->sessdate,'%d.%m.%y&nbsp;(%a)', 99, false);?></td>
<td><?php echo userdate($session->sessdate, get_string('strftimehm', 'attforblock')); ?></td>
<td><?php echo empty($session->description) ? get_string('nodescription', 'attforblock') : $session->description; ?></td>
<td><?php echo $statuses[$session->statusid]->description ?></td>
<td><?php echo $session->remarks;?></td>
</tr>
<?php
}
echo '</table>';
$i++;
$table->data[$sessdata->id][] = $i;
$table->data[$sessdata->id][] = userdate($sessdata->sessdate, get_string('strftimedmyw', 'attforblock'));
$table->data[$sessdata->id][] = userdate($sessdata->sessdate, get_string('strftimehm', 'attforblock'));
$table->data[$sessdata->id][] = empty($sessdata->description) ? get_string('nodescription', 'attforblock') : $sessdata->description;
$table->data[$sessdata->id][] = $statuses[$sessdata->statusid]->description;
$table->data[$sessdata->id][] = $sessdata->remarks;
}
print_table($table);
}
}
echo '</td></tr><tr><td>&nbsp;</td></tr></table></div>';
}
function print_filter_controls($url, $id, $sort=NULL, $printgroupselector=false) {
global $current, $view, $cm;
list(,,,$mday, $wday, $month, $year) = array_values(usergetdate($current));
$currentdatecontrols = '';
switch ($view) {
case 'days':
$format = get_string('strftimedm', 'attforblock');
$startdate = make_timestamp($year, $month, $mday);
$enddate = make_timestamp($year, $month, $mday + 1);
$prevcur = make_timestamp($year, $month, $mday - 1);
$nextcur = make_timestamp($year, $month, $mday + 1);
$curdatetxt = userdate($startdate, $format);
break;
case 'weeks':
$format = get_string('strftimedm', 'attforblock');
$startdate = make_timestamp($year, $month, $mday - $wday + 1);
$enddate = make_timestamp($year, $month, $mday + 7 - $wday);
$prevcur = $startdate - WEEKSECS;
$nextcur = $startdate + WEEKSECS;
$curdatetxt = userdate($startdate, $format)." - ".userdate($enddate, $format);
break;
case 'months':
$format = '%B';
$startdate = make_timestamp($year, $month);
$enddate = make_timestamp($year, $month + 1);
$prevcur = make_timestamp($year, $month - 1);
$nextcur = make_timestamp($year, $month + 1);
$curdatetxt = userdate($startdate, $format);
break;
case 'alltaken':
$startdate = 1;
$enddate = $current;
break;
case 'all':
$startdate = 0;
$enddate = 0;
break;
}
$link = $url . "?id=$id" . ($sort ? "&amp;sort=$sort" : "");
if ($printgroupselector) {
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
$groupselector = '';
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
if ($groupmode == VISIBLEGROUPS ||
($groupmode && has_capability('moodle/site:accessallgroups', $context))) {
$groupselector = groups_print_activity_menu($cm, $link, true);
}
}
$views['all'] = get_string('all','attforblock');
$views['alltaken'] = get_string('alltaken','attforblock');
$views['months'] = get_string('months','attforblock');
$views['weeks'] = get_string('weeks','attforblock');
$views['days'] = get_string('days','attforblock');
$viewcontrols = '<nobr>';
foreach ($views as $key => $sview) {
if ($key != $view)
$viewcontrols .= "<span class=\"attbtn\"><a href=\"{$link}&amp;view={$key}\">$sview</a></span>";
else
$viewcontrols .= "<span class=\"attcurbtn\">$sview</span>";
}
$viewcontrols .= '</nobr>';
echo "<div class=\"attfiltercontrols attwidth\">";
echo "<table width=\"100%\"><tr>";
echo "<td width=\"45%\">$groupselector</td>";
if ($curdatetxt) {
$curdatecontrols = "<a href=\"{$link}&amp;current=$prevcur\"><span class=\"arrow \"></span></a>";
$curdatecontrols .= "<form id =\"currentdate\" action=\"$url\" method=\"get\" style=\"display:inline;\">";
$curdatecontrols .= " <button title=\"" . get_string('calshow','attforblock') . "\" id=\"show\" type=\"button\">$curdatetxt</button> ";
$curdatecontrols .= "<input type=\"hidden\" name=\"id\" value=\"$id\" />";
if ($sort)
$curdatecontrols .= "<input type=\"hidden\" name=\"sort\" value=\"$sort\" />";
$curdatecontrols .= "<input type=\"hidden\" id=\"current\" name=\"current\" value=\"\" />";
$curdatecontrols .= "</form>";
$curdatecontrols .= "<a href=\"{$link}&amp;current=$nextcur\"><span class=\"arrow \"></span></a>";
plug_yui_calendar($current);
}
echo "<td width=\"20%\" align=\"center\">$curdatecontrols</td>";
echo "<td width=\"35%\" align=\"right\">$viewcontrols</td></tr></table>";
echo "</div>";
return array($startdate, $enddate, $currentgroup);
}
function plug_yui_calendar($current) {
global $CFG;
require_js(array('yui_dom-event', 'yui_dragdrop', 'yui_element', 'yui_button', 'yui_container', 'yui_calendar'));
echo "<script type=\"text/javascript\">\n";
echo "var cal_close = \"" . get_string('calclose','attforblock') . "\";";
echo "var cal_today = \"" . get_string('caltoday','attforblock') . "\";";
echo "var cal_months = [" . get_string('calmonths','attforblock') . "];";
echo "var cal_week_days = [" . get_string('calweekdays','attforblock') . "];";
echo "var cal_start_weekday = " . $CFG->calendar_startwday . ";";
echo "var cal_cur_date = " . $current . ";";
echo "</script>\n";
require_js($CFG->wwwroot . '/mod/attforblock/calendar.js');
}
?>

31
manage.php

@ -6,8 +6,10 @@
require_once('../../config.php');
require_once('locallib.php');
$id = required_param('id', PARAM_INT); // Course Module ID, or
$from = optional_param('from', PARAM_ACTION);
$id = required_param('id', PARAM_INT); // Course Module ID, or
$from = optional_param('from', PARAM_ACTION);
$view = optional_param('view', NULL, PARAM_ALPHA); // which page to show
$current = optional_param('current', 0, PARAM_INT);
if (! $cm = get_record('course_modules', 'id', $id)) {
error('Course Module ID was incorrect');
@ -30,6 +32,11 @@
if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
print_error('badcontext');
}
if ($view)
set_current_view($course->id, $_GET['view']);
else
$view = get_current_view($course->id);
if (!has_capability('mod/attforblock:manageattendances', $context) AND
!has_capability('mod/attforblock:takeattendances', $context) AND
@ -78,12 +85,26 @@
function print_sessions_list($course) {
global $CFG, $context, $cm;
global $CFG, $context, $cm, $current, $view, $id;
$strhours = get_string('hours');
$strmins = get_string('min');
$qry = get_records_select('attendance_sessions', "courseid = $course->id AND sessdate >= $course->startdate", 'sessdate asc');
if ($current == 0)
$current = get_current_date($course->id);
else
set_current_date ($course->id, $current);
list($startdate, $enddate) =
print_filter_controls("manage.php", $id);
if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";
} else {
$where = "courseid={$course->id} AND sessdate >= $course->startdate";
}
$qry = get_records_select('attendance_sessions', $where/*"courseid = $course->id AND sessdate >= $course->startdate"*/, 'sessdate asc');
$i = 0;
$table->width = '100%';
//$table->tablealign = 'center';
@ -140,7 +161,7 @@ function print_sessions_list($course) {
$table->data[$sessdata->id][] = '<input type="checkbox" name="sessid['.$sessdata->id.']" />';
unset($desc, $actions);
}
echo '<div align="center"><div class="generalbox boxwidthwide">';
echo '<div align="center"><div class="generalbox attwidth">';
echo "<form method=\"post\" action=\"sessions.php?id={$cm->id}\">"; //&amp;sessionid={$sessdata->id}
print_table($table);
$hiddensess = count_records_select('attendance_sessions', "courseid = $course->id AND sessdate < $course->startdate");

97
report.php

@ -12,7 +12,7 @@
$id = required_param('id', PARAM_INT);
$group = optional_param('group', -1, PARAM_INT); // Group to show
$view = optional_param('view', 'weeks', PARAM_ALPHA); // which page to show
$view = optional_param('view', NULL, PARAM_ALPHA); // which page to show
$current = optional_param('current', 0, PARAM_INT);
$sort = optional_param('sort', 'lastname', PARAM_ALPHA);
@ -37,6 +37,12 @@
if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) {
print_error('badcontext');
}
if ($view)
set_current_view($course->id, $_GET['view']);
else
$view = get_current_view($course->id);
require_capability('mod/attforblock:viewreports', $context);
@ -56,87 +62,32 @@
if(!count_records('attendance_sessions', 'courseid', $course->id)) { // no session exists for this course
redirect("sessions.php?id=$cm->id&amp;action=add");
} else { // display attendance report
/// find out current groups mode
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
if ($groupmode == VISIBLEGROUPS ||
($groupmode && has_capability('moodle/site:accessallgroups', $context))) {
groups_print_activity_menu($cm, "report.php?id=$id&amp;sort=$sort");
}
} else {
if ($current == 0)
$current = get_current_date($course->id);
else
set_current_date ($course->id, $current);
echo '<div align="right">'.helpbutton ('report', get_string('help'), 'attforblock', true, true, '', true).'</div>';
list($startdate, $enddate, $currentgroup) =
print_filter_controls("report.php", $id, $sort, true);
if ($startdate && $enddate) {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $startdate AND sessdate < $enddate";
} else {
$where = "courseid={$course->id} AND sessdate >= $course->startdate";
}
if ($currentgroup) {
$where .= " AND (groupid=0 OR groupid=".$currentgroup.")";
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false);
} else {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', '', '', false);
}
// display date interval selector
$rec = get_record_sql("SELECT MIN(sessdate) AS min, MAX(sessdate) AS max
FROM {$CFG->prefix}attendance_sessions
WHERE courseid=$course->id AND sessdate >= $course->startdate");
$firstdate = $rec->min;
$lastdate = $rec->max;
$now = time();
$current = $current == 0 ? $now : $current;
list(,,,$wday, $syear, $smonth, $sday) = array_values(usergetdate($firstdate));
$wday = $wday == 0 ? 7 : $wday; //////////////////////////////////////////////////// Нужна проверка настройки календаря
$startdate = make_timestamp($syear, $smonth, $sday-$wday+1); //GMT timestamp but for local midnight of monday
$options['all'] = get_string('alltaken','attforblock');
$options['weeks'] = get_string('weeks','attforblock');
$options['months'] = get_string('months','attforblock');
echo '<center>'.helpbutton ('display', get_string('display','attforblock'), 'attforblock', true, false, '', true).get_string('display','attforblock').': ';
if (isset($_GET['view'])) //{
set_current_view($course->id, $_GET['view']);
$view = get_current_view($course->id);
popup_form("report.php?id=$id&amp;sort=$sort&amp;view=", $options, 'viewmenu', $view, '');
$out = '';
$list = array();
if ($view === 'weeks') {
$format = get_string('strftimedm', 'attforblock');
for ($i = 0, $monday = $startdate; $monday <= $lastdate; $i++, $monday += ONE_WEEK) {
if (count_records_select('attendance_sessions', "courseid={$course->id} AND sessdate >= ".$monday." AND sessdate < ".($monday + ONE_WEEK))) {
$list[] = $monday;
}
}
} elseif ($view === 'months') {
$startdate = make_timestamp($syear, $smonth, 1);
$format = '%B';
for ($i = 0, $month = $startdate; $month <= $lastdate; $i++, $month = make_timestamp($syear, $smonth+$i, 1)) {
if (count_records_select('attendance_sessions', "courseid={$course->id} AND sessdate >= ".$month." AND sessdate < ".make_timestamp($syear, $smonth+$i+1, 1))) {
$list[] = $month;
}
}
}
$found = false;
for ($i = count($list)-1; $i >= 0; $i--) {
if ($list[$i] <= $current && !$found) {
$found = true;
$current = $list[$i];
$out = '<b>'.userdate($list[$i], $format).'</b> / '.$out;
} else {
$out = "\n<a href=\"report.php?id=$id&amp;current={$list[$i]}&amp;sort=$sort\">".userdate($list[$i], $format)."</a> / ".$out;
}
}
echo substr($out, 0, -2)."</center>\n";
$statuses = get_statuses($course->id);
$allstatuses = get_statuses($course->id, false);
if ($view === 'weeks') {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $current AND sessdate < ".($current + ONE_WEEK);
} elseif ($view === 'months') {
list(,,,, $syear, $smonth, $sday) = array_values(usergetdate($current));
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate >= $current AND sessdate < ".make_timestamp($syear, $smonth+1, 1);
} else {
$where = "courseid={$course->id} AND sessdate >= $course->startdate AND sessdate <= ".time();
}
if ($currentgroup)
$where .= " AND (groupid=0 OR groupid=".$currentgroup.")";
if ($students and
($course_sess = get_records_select('attendance_sessions', $where, 'sessdate ASC'))) {
@ -154,6 +105,7 @@
$table->head[] = $fullnamehead;
$table->align[] = 'left';
$table->size[] = '';
$table->class = 'generaltable attwidth';
$allowtake = has_capability('mod/attforblock:takeattendances', $context);
$allowchange = has_capability('mod/attforblock:changeattendances', $context);
$groups = groups_get_all_groups($course->id);
@ -225,7 +177,6 @@
$table->data[$student->id][] = get_percent($student->id, $course).'%';
}
}
echo '<br />';
print_table($table);
} else {
print_heading(get_string('nothingtodisplay'), 'center');

2
sessions.php

@ -95,7 +95,7 @@
$rec->duration = $duration;
$rec->description = $fromform->sdescription;
$rec->timemodified = $now;
if ($fromform->sessiontype === COMMONSESSION) {
if ($fromform->sessiontype == COMMONSESSION) {
if(!insert_record('attendance_sessions', $rec))
error(get_string('erroringeneratingsessions','attforblock'), "sessions.php?id=$id&amp;action=add");
} else {

47
styles.php

File diff suppressed because one or more lines are too long

7
view.php

@ -11,6 +11,8 @@
$studentid = optional_param('student', 0, PARAM_INT);
$printing = optional_param('printing');
$mode = optional_param('mode', 'thiscourse');
$view = optional_param('view', NULL, PARAM_ALPHA); // which page to show
$current = optional_param('current', 0, PARAM_INT);
if ($id) {
if (! $cm = get_record("course_modules", "id", $id)) {
@ -57,6 +59,11 @@
error("No such user in this course");
}
if ($view)
set_current_view($course->id, $_GET['view']);
else
$view = get_current_view($course->id, 'months');
require_capability('mod/attforblock:view', $context);
$student = false;

Loading…
Cancel
Save