diff --git a/CHANGES b/CHANGES index 44ca102..18b2e0f 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,14 @@ +2011-01-15 lrlopez + + * db/install.xml: + + Bugs fixed. + + * attendances.php: locallib.php: manage.php: + + Fixed some minor bugs and code readibility issues. Now, in grid view + mode, statuses are always next to their radio buttons. + 2010-12-30 - 2011-01-04 lrlopez * lang/: es_utf8/attforblock.php: diff --git a/attendances.php b/attendances.php index 9f04b38..ee62c22 100644 --- a/attendances.php +++ b/attendances.php @@ -58,7 +58,7 @@ $i++; } } - $attforblockrecord = get_record('attforblock', 'course', $course->id); + $attforblockrecord = get_record('attforblock', 'id', $cm->instance);//'course', $course->id); foreach($students as $student) { if ($log = get_record('attendance_log', 'sessionid', $sessionid, 'studentid', $student->studentid)) { @@ -104,17 +104,17 @@ $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', get_user_preferences("attforblock_viewmode",0), PARAM_INT); + $attforblockrecord = get_record('attforblock', 'id', $cm->instance);//'course', $course->id);'course', $course->id); + $view = optional_param('view', get_user_preferences("attforblock_viewmode", SORTEDLISTVIEW), PARAM_INT); $gridcols = optional_param('gridcols', get_user_preferences("attforblock_gridcolumns",5), PARAM_INT); echo '
'; - $options = array (0 => get_string('sortedlist','attforblock'), 1 => get_string('sortedgrid','attforblock')); + $options = array (SORTEDLISTVIEW => get_string('sortedlist','attforblock'), SORTEDGRIDVIEW => get_string('sortedgrid','attforblock')); $data = "attendances.php?id=$id&sessionid=$sessionid&grouptype=$grouptype&gridcols=$gridcols"; if ($group!=-1) { $data = $data . "&group=$group"; } popup_form("$data&view=", $options, 'viewmenu', $view, ''); - if ($view==1) { + if ($view == SORTEDGRIDVIEW) { set_user_preference("attforblock_viewmode", $view); set_user_preference("attforblock_gridcolumns", $gridcols); $options = array (1 => '1 '.get_string('column','attforblock'),'2 '.get_string('columns','attforblock'),'3 '.get_string('columns','attforblock'), @@ -154,10 +154,10 @@ $i = 3; foreach($statuses as $st) { switch($view) { - case 0: + case SORTEDLISTVIEW: $tabhead[] = "$st->acronym"; break; - case 1: + case SORTEDGRIDVIEW: $tabhead[] = "acronym . "', null);\">$st->acronym"; break; } @@ -179,7 +179,7 @@ unset($table); switch($view) { - case 0: // sorted list + case SORTEDLISTVIEW: // sorted list $table->width = '0%'; $table->head[] = '#'; $table->align[] = 'center'; @@ -212,7 +212,7 @@ $table->data[$student->id][] = ''; } break; - case 1: // sorted grid + case SORTEDGRIDVIEW: // sorted grid $table->width = '0%'; $data = ''; @@ -237,7 +237,7 @@ $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; + $data = $data . 'id == $att->statusid ? 'checked' : '').'>' . $st->acronym . " "; } $table->data[($i-1) / ($gridcols)][] = $data; } diff --git a/db/install.xml b/db/install.xml index e7f83e0..c1d3578 100644 --- a/db/install.xml +++ b/db/install.xml @@ -24,7 +24,7 @@ - + @@ -38,7 +38,7 @@ - + @@ -64,7 +64,8 @@
- + + @@ -75,7 +76,8 @@ - + + diff --git a/locallib.php b/locallib.php index 9114c09..1c0495a 100644 --- a/locallib.php +++ b/locallib.php @@ -12,6 +12,9 @@ define('WITHOUT_SELECTOR', 0); define('GROUP_SELECTOR', 1); define('SESSION_TYPE_SELECTOR', 2); +define('SORTEDLISTVIEW', 0); +define('SORTEDGRIDVIEW', 1); + function show_tabs($cm, $context, $currenttab='sessions') { $toprow = array(); diff --git a/manage.php b/manage.php index e9acf72..e0dc5b2 100644 --- a/manage.php +++ b/manage.php @@ -95,7 +95,7 @@ function print_sessions_list($course, $attforblock) { - global $CFG, $context, $cm, $current, $view, $id; + global $CFG, $context, $cm, $current, $view, $id, $showendtime; $strhours = get_string('hours'); $strmins = get_string('min');