I was going through some old bugs and came across MDL-1915, which is basically about not loosing location in pagination/sortorder of user browse list when using it. Which is really one of those small things which would make the list feel much more usable - (I know i've got irritated by before).
The sort orders and pageination on these kinda of pages are usually GET params which could be cached to make things much more usable, so I quickly hacked up a wrapper function to optional_param which caches the value in our session:
function caching_optional_param($paramname, $default, $type, $cachename){
global $SESSION;
if( isset($SESSION->{$cachename}) ){
$default = clean_param($SESSION->{$cachename}, $type);
}
$SESSION->{$cachename} = optional_param($paramname, $default, $type);
return $SESSION->{$cachename};
}
Slightly modify the param defintions and it works as planned, we can browse through users with filters, edit our user and return where we left off:
$sort = caching_optional_param('sort', 'name', PARAM_ALPHA, 'userlist_sort');
$dir = caching_optional_param('dir', 'ASC', PARAM_ALPHA, 'userlist_dir');
$page = caching_optional_param('page', 0, PARAM_INT, 'userlist_page' );
So what do you think about that?
Presumably the new gradeboook has faced lots of issues like this for improving the usability, how has it been achieved there?
I know MartinL is going to mention about the performance problems of serialize with lots of $SESSION abuse. So how should we improve things like this without polluting $SESSSION?