Commit 20274822 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1072 Step into matched folders outside the main loop.

Released under the Affero GNU General Public License (AGPL) version 3.
parent 9d44e7ce
......@@ -1093,19 +1093,23 @@ class ASDevice extends StateObject {
* @param string $parentid the parentid to start with, if not set '0' (main folders) is used.
*/
private function orderAdditionalFoldersHierarchically(&$toOrderFolders, &$orderedFolders, $parentid = '0') {
$stepInto = array();
// loop through the remaining folders that need to be ordered
foreach($toOrderFolders as $folder) {
// move folders with the matching parentid to the ordered array
if ($folder['parentid'] == $parentid) {
echo "found.. \n";
$fid = $folder['folderid'];
$orderedFolders[$fid] = $folder;
unset($toOrderFolders[$fid]);
reset($toOrderFolders);
$stepInto[] = $fid;
}
}
// call recursively to move/order the leaves as well
foreach($stepInto as $fid) {
$this->orderAdditionalFoldersHierarchically($toOrderFolders, $orderedFolders, $fid);
}
}
}
/**
* Generates the AS folder hash from the backend folder id, type and name.
......
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