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

FEAT #101 Group services order

parent 0b54404f
No related branches found
No related tags found
No related merge requests found
......@@ -136,7 +136,6 @@ class GroupController
$group['users'] = GroupModel::getUsersByGroupId(['groupId' => $group['group_id'], 'select' => ['users.id', 'users.user_id', 'users.firstname', 'users.lastname']]);
$group['security'] = GroupModel::getSecurityByGroupId(['groupId' => $group['group_id']]);
$group['services'] = GroupModel::getAllServicesByGroupId(['groupId' => $group['group_id']]);
$group['services']['administration'] = GroupController::arraySort(['data' => $group['services']['administration'], 'on' => 'name']);
return $response->withJson(['group' => $group]);
}
......@@ -183,7 +182,7 @@ class GroupController
return $response->withJson(['success' => 'success']);
}
private static function arraySort($aArgs)
public static function arraySort($aArgs)
{
ValidatorModel::notEmpty($aArgs, ['data', 'on']);
ValidatorModel::arrayType($aArgs, ['data']);
......
......@@ -16,6 +16,7 @@ namespace Group\models;
use Core\Models\ServiceModel;
use Core\Models\UserModel;
use Group\controllers\GroupController;
use SrcCore\models\DatabaseModel;
use SrcCore\models\ValidatorModel;
......@@ -273,7 +274,6 @@ class GroupModelAbstract
$services = [];
foreach ($allServices as $key => $value) {
$menu = [];
$administration = [];
$use = [];
foreach ($value as $value2) {
if (!$value2['system_service']) {
......@@ -295,14 +295,19 @@ class GroupModelAbstract
if (!empty($menu)) {
$services['menu'][] = $menu;
}
// if (!empty($administration)) {
// $services['administration'][] = $administration;
// }
if (!empty($use)) {
$services['use'][] = $use;
}
}
foreach ($services['menu'] as $key => $menu) {
$services['menu'][$key] = GroupController::arraySort(['data' => $menu, 'on' => 'name']);
}
foreach ($services['use'] as $key => $use) {
$services['use'][$key] = GroupController::arraySort(['data' => $use, 'on' => 'name']);
}
$services['administration'] = GroupController::arraySort(['data' => $services['administration'], 'on' => 'name']);
return $services;
}
......
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