Commit bee8db63 authored by Aaron Wells's avatar Aaron Wells Committed by Robert Lyon
Browse files

Set progressbar order for core artefacts

Bug 1259538

Change-Id: Iec129bdcd71d9dd48cfbada5cb4b106e9d4a89e3
parent dcd4af9b
......@@ -1918,6 +1918,44 @@ function artefact_get_progressbar_items($onlythese = false) {
}
}
// Put the core artefact types into the order that makes the most sense.
// 3rd party ones will be placed at the end of the list in alphabetical order
uksort($options, function($item1, $item2) {
static $expectedorder = array(
'internal',
'resume',
'plans',
'blog',
'file',
'social'
);
$val1 = array_search($item1, $expectedorder);
$val2 = array_search($item2, $expectedorder);
if ($val1 === false) {
if ($val2 === false) {
// Neither one is core, sort alphabetically
return strcmp($item1, $item2);
}
else {
return 1;
}
}
else {
if ($val2 === false) {
return -1;
}
else {
return ($val1 - $val2);
}
}
});
// An opportunity for users to override this sort order (and maybe accomodate 3rd party plugins)
if (function_exists('local_progressbar_sortorder')) {
$options = local_progressbar_sortorder($options);
}
return $options;
}
......
......@@ -2970,20 +2970,21 @@ function progressbar_sideblock($preview=false) {
$progressbaritems = array_diff($progressbaritems, $locked);
// Get the data link about every item
foreach ($counting as $itemname => $c) {
$parts = explode('_', $itemname);
$pluginname = $parts[1];
$artefactname = $parts[2];
$target = $c->value;
$completed = 0;
$data[$itemname] = array(
'artefact' => $artefactname,
'link' => progressbar_artefact_link($pluginname, $artefactname),
'counting' => $target,
'completed' => $completed,
'display' => ((bool) $c->value),
'label' => progressbar_artefact_task_label($pluginname, $artefactname, $target, $completed),
);
foreach ($progressbaritems as $pluginname => $itemlist) {
foreach ($itemlist as $artefactname => $item) {
$itemname = "progressbaritem_{$pluginname}_{$artefactname}";
$c = $counting[$itemname];
$target = $c->value;
$completed = 0;
$data[$itemname] = array(
'artefact' => $artefactname,
'link' => progressbar_artefact_link($pluginname, $artefactname),
'counting' => $target,
'completed' => $completed,
'display' => ((bool) $c->value),
'label' => progressbar_artefact_task_label($pluginname, $artefactname, $target, $completed),
);
}
}
if ($preview) {
......
......@@ -9,4 +9,5 @@
* - local_main_nav_update($menu): modify the main navigation menu in the header
* - local_xmlrpc_services(): add custom xmlrpc functions
* - local_can_remove_viewtype($viewtype): stop users from deleting views of a particular type
* - local_progressbar_sortorder($options): Change the order of items in the profile completion progress bar
*/
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