Skip to content
Snippets Groups Projects
Commit b98609ee authored by David Siegfried's avatar David Siegfried
Browse files

fix sorting, refs #358

Merge request studip/studip!882
parent c7f864df
No related branches found
No related tags found
No related merge requests found
...@@ -233,12 +233,13 @@ class Resources_RoomController extends AuthenticatedController ...@@ -233,12 +233,13 @@ class Resources_RoomController extends AuthenticatedController
//We must convert the buildings to a hierarchy since rooms can be //We must convert the buildings to a hierarchy since rooms can be
//placed multiple layers below a building: //placed multiple layers below a building:
$this->building_hierarchies = []; $building_hierarchies = [];
foreach ($buildings as $building) { foreach ($buildings as $building) {
//Build the complete hierarchy from the root resource to //Build the complete hierarchy from the root resource to
//the building: //the building:
$this->building_hierarchies[$building->id] = '/' . implode('/', ResourceManager::getHierarchyNames($building)); $building_hierarchies[$building->parent->id][$building->id] = '/' . implode('/', ResourceManager::getHierarchyNames($building));
} }
$this->building_hierarchies = array_reduce($building_hierarchies, 'array_merge', []);
//In add-mode the category must be set before calling this method. //In add-mode the category must be set before calling this method.
if ($mode == 'edit') { if ($mode == 'edit') {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment