diff --git a/CHANGES b/CHANGES
index b4f181c..1c6da13 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,12 @@
+2010-12-29 - 2010-12-30 lrlopez
+
+ * db/install.xml:
+ * db/upgrade.php:
+ Implemented display modes (list and grid)
+
+ * lang/: en_utf8/attforblock.php, es_utf8/attforblock.php:
+ Added new strings for the new display modes
+
2010-07-10 - 2010-09-17 andreev.artem
Implemented ability to add two types of sessions: common and group
diff --git a/attendances.php b/attendances.php
index 237ce6c..7c5aa6d 100644
--- a/attendances.php
+++ b/attendances.php
@@ -103,6 +103,18 @@
$groupmode = groups_get_activity_groupmode($cm);
$currentgroup = groups_get_activity_group($cm, true);
+ // get the viewmode & grid columns (default is set in module settings)
+ $attforblockrecord = get_record('attforblock', 'course', $course->id);
+ $view = optional_param('view', $attforblockrecord->displaymode, PARAM_INT);
+ $gridcols = optional_param('gridcols', $attforblockrecord->gridcolumns, PARAM_INT);
+ echo '
';
+ $options = array (get_string('sortedlist','attforblock'), get_string('sortedgrid','attforblock'));
+ $data = "attendances.php?id=$id&sessionid=$sessionid&grouptype=$grouptype";
+ if ($group!=-1) {
+ $data = $data . "&group=$group";
+ }
+ popup_form("$data&view=", $options, 'viewmenu', $view, '');
+ echo '';
if ($grouptype === 0) {
if ($currentgroup) {
$students = get_users_by_capability($context, 'moodle/legacy:student', '', "u.$sort ASC", '', '', $currentgroup, '', false);
@@ -128,10 +140,19 @@
$statuses = get_statuses($course->id);
$i = 3;
foreach($statuses as $st) {
+ switch($view) {
+ case 0:
$tabhead[] = "$st->acronym";
+ break;
+ case 1:
+ $tabhead[] = "acronym . "', null);\">$st->acronym";
+ break;
+ }
$i++;
}
+ if ($view == 0) {
$tabhead[] = get_string('remarks','attforblock');
+ }
$firstname = "".get_string('firstname').'';
$lastname = "".get_string('lastname').'';
@@ -143,6 +164,9 @@
if ($students) {
unset($table);
+
+ switch($view) {
+ case 0: // sorted list
$table->width = '0%';
$table->head[] = '#';
$table->align[] = 'center';
@@ -174,6 +198,38 @@
}
$table->data[$student->id][] = '';
}
+ break;
+ case 1: // sorted grid
+ $table->width = '0%';
+
+ $data = '';
+ foreach ($tabhead as $hd) {
+ $data = $data . $hd . ' ';
+ }
+ print_heading($data,'center');
+
+ $i = 0;
+ // sanity check
+ $gridcols = $gridcols < 0 ? 0 : $gridcols;
+ for ($i=0; $i<=$gridcols; $i++) {
+ $table->head[] = ' ';
+ $table->align[] = 'center';
+ $table->size[] = '110px';
+ }
+
+ $i = 0;
+ foreach($students as $student) {
+ $i++;
+ $att = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->id);
+
+ $data = "" . print_user_picture($student, $course->id, $student->picture, true, true, '', fullname($student)) . "
" . fullname($student) . "
";//, $returnstring=false, $link=true, $target='');
+ foreach($statuses as $st) {
+ $data = $data . 'id == $att->statusid ? 'checked' : '').'>' . $st->acronym;
+ }
+ $table->data[($i-1) / ($gridcols+1)][] = $data;
+ }
+ break;
+ }
echo '