mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-07-22 12:58:45 +02:00
fix a few things
This commit is contained in:
parent
be194a06a8
commit
8f9bf0a729
11 changed files with 53 additions and 103 deletions
|
@ -50,7 +50,7 @@ namespace controllers\publics;
|
|||
|
||||
foreach ($groups as $key => $group)
|
||||
{
|
||||
$contacts = $this->internal_group->get_contact($group['id']);
|
||||
$contacts = $this->internal_group->get_contacts($group['id']);
|
||||
$groups[$key]['nb_contacts'] = \count($contacts);
|
||||
}
|
||||
|
||||
|
@ -70,17 +70,13 @@ namespace controllers\publics;
|
|||
if (!$this->verify_csrf($csrf))
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
$this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
|
||||
return false;
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
$ids = $_GET['ids'] ?? [];
|
||||
$this->internal_group->delete($ids);
|
||||
|
||||
$this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
|
||||
return true;
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -104,7 +100,7 @@ namespace controllers\publics;
|
|||
|
||||
foreach ($groups as $key => $group)
|
||||
{
|
||||
$groups[$key]['contacts'] = $this->internal_group->get_contact($group['id']);
|
||||
$groups[$key]['contacts'] = $this->internal_group->get_contacts($group['id']);
|
||||
}
|
||||
|
||||
$this->render('group/edit', [
|
||||
|
@ -124,7 +120,6 @@ namespace controllers\publics;
|
|||
if (!$this->verify_csrf($csrf))
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
|
||||
return $this->redirect(\descartes\Router::url('Group', 'add'));
|
||||
}
|
||||
|
||||
|
@ -134,20 +129,17 @@ namespace controllers\publics;
|
|||
if (!$name || !$contacts_ids)
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Des champs sont manquants !');
|
||||
|
||||
return $this->redirect(\descartes\Router::url('Group', 'add'));
|
||||
}
|
||||
|
||||
$id_group = $this->internal_group->create($name, $contacts_ids);
|
||||
if (!$id_group)
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Impossible de créer ce group.');
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Impossible de créer ce groupe.');
|
||||
return $this->redirect(\descartes\Router::url('Group', 'add'));
|
||||
}
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Le group a bien été créé.');
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Le groupe a bien été créé.');
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
|
@ -164,9 +156,7 @@ namespace controllers\publics;
|
|||
if (!$this->verify_csrf($csrf))
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Jeton CSRF invalid !');
|
||||
$this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
|
||||
return false;
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
$groups = $_POST['groups'] ?? [];
|
||||
|
@ -179,13 +169,11 @@ namespace controllers\publics;
|
|||
|
||||
if ($nb_groups_update !== \count($groups))
|
||||
{
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Certains groups n\'ont pas pu êtres mis à jour.');
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('danger', 'Certains groupes n\'ont pas pu êtres mis à jour.');
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Tous les groups ont été modifiés avec succès.');
|
||||
|
||||
\modules\DescartesSessionMessages\internals\DescartesSessionMessages::push('success', 'Tous les groupes ont été modifiés avec succès.');
|
||||
return $this->redirect(\descartes\Router::url('Group', 'list'));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue