From 1e1a9f5e09b7d0deaa6afd1b0977ea8e08a0845e Mon Sep 17 00:00:00 2001 From: Artem Andreev Date: Thu, 20 Jan 2011 16:13:40 +0300 Subject: [PATCH] User preferences for attendances.php are now saved. --- attendances.php | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/attendances.php b/attendances.php index 0927945..ba33a59 100644 --- a/attendances.php +++ b/attendances.php @@ -106,8 +106,21 @@ // get the viewmode & grid columns (default is set in module settings) $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); + $view = optional_param('view', -1, PARAM_INT); + if ($view != -1) { + set_user_preference("attforblock_viewmode", $view); + } + else { + $view = get_user_preferences("attforblock_viewmode", SORTEDLISTVIEW); + } + $gridcols = optional_param('gridcols', -1, PARAM_INT); + if ($gridcols != -1) { + set_user_preference("attforblock_gridcolumns", $gridcols); + } + else { + $gridcols = get_user_preferences("attforblock_gridcolumns",5); + } + echo ''; //echo '
'; $options = array (SORTEDLISTVIEW => get_string('sortedlist','attforblock'), SORTEDGRIDVIEW => get_string('sortedgrid','attforblock')); $dataurl = "attendances.php?id=$id&grouptype=$grouptype&gridcols=$gridcols";