Commit 22661edc authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Add max tags in cloud option to user account prefs

parent 184c2766
......@@ -142,6 +142,16 @@ $elements['addremovecolumns'] = array(
'separator' => '<br>',
'help' => 'true'
);
if (get_config('showtagssideblock')) {
$elements['tagssideblockmaxtags'] = array(
'type' => 'text',
'size' => 4,
'title' => get_string('tagssideblockmaxtags', 'account'),
'description' => get_string('tagssideblockmaxtagsdescription', 'account'),
'defaultvalue' => isset($prefs->tagssideblockmaxtags) ? $prefs->tagssideblockmaxtags : get_config('tagssideblockmaxtags'),
'rules' => array('integer' => true, 'minvalue' => 0, 'maxvalue' => 1000),
);
}
$elements['submit'] = array(
'type' => 'submit',
'value' => get_string('save')
......
......@@ -54,6 +54,9 @@ $string['language'] = 'Language';
$string['showviewcolumns'] = 'Show controls to add and remove columns when editing a view';
$string['tagssideblockmaxtags'] = 'Maximum tags in cloud';
$string['tagssideblockmaxtagsdescription'] = 'Maximum number of tags to display in your Tag Cloud';
$string['prefssaved'] = 'Preferences saved';
$string['prefsnotsaved'] = 'Failed to save your Preferences!';
......
......@@ -2087,7 +2087,10 @@ function get_my_tags($limit=null, $cloud=true, $sort='freq') {
}
function tags_sideblock() {
if ($tagrecords = get_my_tags(get_config('tagssideblockmaxtags'))) {
global $USER;
$maxtags = $USER->get_account_preference('tagssideblockmaxtags');
$maxtags = is_null($maxtags) ? get_config('tagssideblockmaxtags') : $maxtags;
if ($tagrecords = get_my_tags($maxtags)) {
return array('tags' => $tagrecords);
}
return null;
......
......@@ -200,6 +200,7 @@ function expected_account_preferences() {
'messages' => 'allow',
'lang' => 'default',
'addremovecolumns' => 0,
'tagssideblockmaxtags' => get_config('tagssideblockmaxtags'),
);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment