Browse Source

Page "Update attendance" (attendances.php) considers two types of sessions

MOODLE_23_STABLE
Artem Andreev 15 years ago
parent
commit
5d5d6fb1f7
  1. 18
      attendances.php
  2. 3
      lib.php
  3. 3
      locallib.php
  4. 4
      manage.php

18
attendances.php

@ -13,6 +13,7 @@
$id = required_param('id', PARAM_INT);
$sessionid = required_param('sessionid', PARAM_INT);
$grouptype = required_param('grouptype', PARAM_INT);
$group = optional_param('group', -1, PARAM_INT); // Group to show
$sort = optional_param('sort','lastname', PARAM_ALPHA);
@ -102,17 +103,22 @@
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
if ($currentgroup) {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false);
if ($grouptype === 0) {
if ($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);
}
} else {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', '', '', false);
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $grouptype, '', false);
}
$sort = $sort == 'firstname' ? 'firstname' : 'lastname';
/// Now we need a menu for separategroups as well!
if ($groupmode == VISIBLEGROUPS ||
($groupmode && has_capability('moodle/site:accessallgroups', $context))) {
groups_print_activity_menu($cm, "attendances.php?id=$id&sessionid=$sessionid&sort=$sort");
if ($grouptype === 0 &&
($groupmode == VISIBLEGROUPS ||
($groupmode && has_capability('moodle/site:accessallgroups', $context)))) {
groups_print_activity_menu($cm, "attendances.php?id=$id&sessionid=$sessionid&grouptype=$grouptype&sort=$sort");
}
$table->data[][] = '<b>'.get_string('sessiondate','attforblock').': '.userdate($sessdata->sessdate, get_string('strftimedate').', '.get_string('strftimehm', 'attforblock')).

3
lib.php

@ -4,9 +4,6 @@
$attforblock_CONSTANT = 7; /// for example
define('COMMONSESSION', 0);
define('GROUPSESSION', 1);
function attforblock_install() {
$result = true;

3
locallib.php

@ -5,6 +5,9 @@ require_once($CFG->libdir.'/gradelib.php');
define('ONE_DAY', 86400); // Seconds in one day
define('ONE_WEEK', 604800); // Seconds in one week
define('COMMONSESSION', 0);
define('GROUPSESSION', 1);
function show_tabs($cm, $context, $currenttab='sessions')
{
$toprow = array();

4
manage.php

@ -102,7 +102,7 @@ function print_sessions_list($course) {
if($sessdata->lasttaken > 0) //attendance has taken
{
if ($allowchange) {
$desc = "<a href=\"attendances.php?id=$cm->id&amp;sessionid={$sessdata->id}\">".
$desc = "<a href=\"attendances.php?id=$cm->id&amp;sessionid={$sessdata->id}&amp;grouptype={$sessdata->groupid}\">".
($sessdata->description ? $sessdata->description : get_string('nodescription', 'attforblock')).
'</a>';
} else {
@ -112,7 +112,7 @@ function print_sessions_list($course) {
$desc = empty($sessdata->description) ? get_string('nodescription', 'attforblock') : $sessdata->description;
if ($allowtake) {
$title = get_string('takeattendance','attforblock');
$actions = "<a title=\"$title\" href=\"attendances.php?id=$cm->id&amp;sessionid={$sessdata->id}\">".
$actions = "<a title=\"$title\" href=\"attendances.php?id=$cm->id&amp;sessionid={$sessdata->id}&amp;grouptype={$sessdata->groupid}\">".
"<img src=\"{$CFG->pixpath}/t/go.gif\" alt=\"$title\" /></a>&nbsp;";
}
}

Loading…
Cancel
Save