Skip to content
Snippets Groups Projects
Commit bce831ad authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Adapatation a l'affichage par 'module'

parent 207e40f4
No related branches found
No related tags found
No related merge requests found
Pipeline #18048 passed
......@@ -66,10 +66,10 @@ class IndicateurController extends AbstractActionController {
public function creerAction() : ViewModel
{
$indicateur = new Indicateur();
$namespace = $this->params()->fromQuery('namespace');
$form = $this->getIndicateurForm();
$form->setAttribute('action', $this->url()->fromRoute('indicateur/creer', [], ['query' => ['namespace' => $namespace]], true));
$namespace = $this->params()->fromQuery('namespace');
if ($namespace) {
$indicateur->setNamespace($namespace);
$form->get('namespace')->setAttribute('readonly', true);
......@@ -100,9 +100,10 @@ class IndicateurController extends AbstractActionController {
public function modifierAction(): ViewModel
{
$indicateur = $this->getIndicateurService()->getRequestedIndicateur($this);
$form = $this->getIndicateurForm();
$form->setAttribute('action', $this->url()->fromRoute('indicateur/modifier', [], [], true));
$namespace = $this->params()->fromQuery('namespace');
$form = $this->getIndicateurForm();
$form->setAttribute('action', $this->url()->fromRoute('indicateur/modifier', ['indicateur' => $indicateur], ['query' => ['namespace' => $namespace]], true));
if ($namespace) {
$indicateur->setNamespace($namespace);
$form->get('namespace')->setAttribute('readonly', true);
......
......@@ -28,22 +28,26 @@ class TableauDeBordController extends AbstractActionController
public function afficherAction() : ViewModel
{
$tableau = $this->getTableauDeBordService()->getRequestedTableauDeBord($this);
$retour = $this->params()->fromQuery('retour');
return new ViewModel([
'tableau' => $tableau,
'indicateurService' => $this->getIndicateurService(),
'retour' => $retour,
]);
}
public function ajouterAction() : ViewModel
{
$tableau = new TableauDeBord();
$namespace = $this->params()->fromQuery('namespace');
if ($namespace) $tableau->setNamespace($namespace);
$form = $this->getTableauDeBordForm();
$form->setAttribute('action', $this->url()->fromRoute('tableau-de-bord/ajouter', [], [], true));
$form->setAttribute('action', $this->url()->fromRoute('tableau-de-bord/ajouter', [], ['query' => ['namespace' => $namespace]], true));
if ($namespace) {
$tableau->setNamespace($namespace);
$form->get('namespace')->setAttribute('readonly', true);
}
$form->bind($tableau);
$request = $this->getRequest();
......@@ -67,9 +71,14 @@ class TableauDeBordController extends AbstractActionController
public function modifierAction() : ViewModel
{
$tableau = $this->getTableauDeBordService()->getRequestedTableauDeBord($this);
$namespace = $this->params()->fromQuery('namespace');
$form = $this->getTableauDeBordForm();
$form->setAttribute('action', $this->url()->fromRoute('tableau-de-bord/modifier', ['tableau-de-bord' => $tableau->getId()], [], true));
$form->setAttribute('action', $this->url()->fromRoute('tableau-de-bord/modifier', ['tableau-de-bord' => $tableau->getId()], ['query' => ['namespace' => $namespace]], true));
if ($namespace) {
$tableau->setNamespace($namespace);
$form->get('namespace')->setAttribute('readonly', true);
}
$form->bind($tableau);
$request = $this->getRequest();
......
......@@ -16,7 +16,7 @@ class TableauDeBordHydrator implements HydratorInterface {
$data = [
'libelle' => $object->getTitre(),
'description' => $object->getDescription(),
'namespance' => $object->getNamespace(),
'namespace' => $object->getNamespace(),
'nb_colonne' => $object->getNbColumn(),
];
return $data;
......
......@@ -9,6 +9,7 @@ use UnicaenIndicateur\Service\Indicateur\IndicateurService;
* @see \UnicaenIndicateur\Controller\TableauDeBordController::afficherAction()
* @var TableauDeBord $tableau
* @var IndicateurService $indicateurService
* @var ?string $retour
*/
$this->headTitle($tableau?$tableau->getTitre():"Tableau de bord supprimé");
......@@ -40,7 +41,7 @@ $width = 12 / ((int) ($tableau?$tableau->getNbColumn():1));
<div class="col-md-3">
<?php if ($canIndex) : ?>
<?php /** @see \UnicaenIndicateur\Controller\TableauDeBordController::indexAction() */ ?>
<a href="<?php echo $this->url('tableau-de-bord', [], [], true); ?>"
<a href="<?php echo $retour??$this->url('tableau-de-bord', [], [], true); ?>"
class="btn btn-secondary">
<span class="icon icon-lister"></span>
Accéder aux tableaux de bord
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment