Skip to content
Snippets Groups Projects
Verified Commit ed30029c authored by Damien's avatar Damien
Browse files

FEAT #55 reorder actions n2

parent 8a0a3419
No related branches found
No related tags found
No related merge requests found
......@@ -282,10 +282,23 @@ class BasketController
$allActions = ActionModel::get();
$allActionsPrepared = [];
foreach ($allActions as $allAction) {
if (empty($allActionsPrepared[$allAction['origin']])) {
$allActionsPrepared[$allAction['origin']] = [];
$found = null;
foreach ($allActionsPrepared as $key => $allActionPrepared) {
if (!empty($allActionPrepared[$allAction['origin']])) {
$found = $key;
}
}
if ($found === null) {
$allActionsPrepared[] = [
'origin' => $allAction['origin'],
$allAction['origin'] => []
];
}
foreach ($allActionsPrepared as $key => $allActionPrepared) {
if ($allActionPrepared['origin'] == $allAction['origin']) {
$allActionsPrepared[$key][$allAction['origin']][] = $allAction;
}
}
$allActionsPrepared[$allAction['origin']][] = $allAction;
}
return $response->withJson(['groups' => $groups, 'allGroups' => $allGroups, 'pages' => $basketPages, 'actions' => $allActionsPrepared]);
......
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