MDL-42299 course: management category expansion improvements

This commit is contained in:
Sam Hemelryk 2013-10-17 12:11:31 +13:00
parent d5de874727
commit df460b5a23
6 changed files with 73 additions and 8 deletions

View file

@ -823,8 +823,8 @@ class helper {
$categoryid = $coursecat->id;
$path = $coursecat->get_parents();
/* @var \cache_session $cache */
$cache = \cache::make('core', 'coursecat');
$categories = $cache->get('managementexpanded');
$cache = \cache::make('core', 'userselections');
$categories = $cache->get('categorymanagementexpanded');
if (!is_array($categories)) {
if (!$expanded) {
// No categories recorded, nothing to remove.
@ -858,7 +858,7 @@ class helper {
unset($ref[$categoryid]);
}
}
$cache->set('managementexpanded', $categories);
$cache->set('categorymanagementexpanded', $categories);
}
/**
@ -870,8 +870,8 @@ class helper {
public static function get_expanded_categories($withpath = null) {
if (self::$expandedcategories === null) {
/* @var \cache_session $cache */
$cache = \cache::make('core', 'coursecat');
self::$expandedcategories = $cache->get('managementexpanded');
$cache = \cache::make('core', 'userselections');
self::$expandedcategories = $cache->get('categorymanagementexpanded');
if (self::$expandedcategories === false) {
self::$expandedcategories = array();
}