Loading module/Application/config/merged/formation.config.php 0 → 100644 +156 −0 Changes for module/Application/config/merged/formation.config.php: 156 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application; use Application\Controller\Formation\FormationController; use Application\Controller\Formation\FormationControllerFactory; use Application\Form\Formation\FormationForm; use Application\Form\Formation\FormationFormFactory; use Application\Form\Formation\FormationHydrator; use Application\Form\Formation\FormationHydratorFactory; use Application\Provider\Privilege\FormationPrivileges; use Application\Service\Formation\FormationService; use Application\Service\Formation\FormationServiceFactory; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Literal; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => FormationController::class, 'action' => [ 'index', 'afficher', ], 'privileges' => [ FormationPrivileges::AFFICHER, ], ], [ 'controller' => FormationController::class, 'action' => [ 'ajouter', 'editer', 'historiser', 'restaurer', ], 'privileges' => [ FormationPrivileges::EDITER, ], ], [ 'controller' => FormationController::class, 'action' => [ 'detruire', ], 'privileges' => [ FormationPrivileges::DETRUIRE, ], ], ], ], ], 'router' => [ 'routes' => [ 'formation' => [ 'type' => Literal::class, 'options' => [ 'route' => '/formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'ajouter', ], ], ], 'afficher' => [ 'type' => Segment::class, 'options' => [ 'route' => '/afficher/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'afficher', ], ], ], 'editer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/editer/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'editer', ], ], ], 'historiser' => [ 'type' => Segment::class, 'options' => [ 'route' => '/historiser/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'historiser', ], ], ], 'restaurer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/restaurer/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'restaurer', ], ], ], 'detruire' => [ 'type' => Segment::class, 'options' => [ 'route' => '/detruire/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'detruire', ], ], ], ], ], ], ], 'service_manager' => [ 'factories' => [ FormationService::class => FormationServiceFactory::class, ], ], 'controllers' => [ 'factories' => [ FormationController::class => FormationControllerFactory::class ], ], 'form_elements' => [ 'factories' => [ FormationForm::class => FormationFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ FormationHydrator::class => FormationHydratorFactory::class, ], ] ]; No newline at end of file module/Application/config/merged/menu.config.php +9 −0 Changes for module/Application/config/merged/menu.config.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Application\Provider\Privilege\ActivitePrivileges; use Application\Provider\Privilege\AdministrationPrivileges; use Application\Provider\Privilege\ApplicationPrivileges; use Application\Provider\Privilege\FicheMetierPrivileges; use Application\Provider\Privilege\FormationPrivileges; use Application\Provider\Privilege\PersoPrivileges; use Application\Provider\Privilege\PostePrivileges; use Application\Provider\Privilege\RessourceRhPrivileges; Loading Loading @@ -224,6 +225,14 @@ return [ 'dropdown-header' => true, 'icon' => 'fas fa-angle-right' ], [ 'order' => 4, 'label' => 'Les formations', 'route' => 'formation', 'privileges' => FormationPrivileges::AFFICHER, 'dropdown-header' => true, 'icon' => 'fas fa-angle-right' ], // [ // 'order' => 4, // 'label' => 'Les formations', Loading module/Application/src/Application/Controller/Formation/FormationController.php 0 → 100644 +111 −0 Changes for module/Application/src/Application/Controller/Formation/FormationController.php: 111 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Controller\Formation; use Application\Entity\Db\Formation; use Application\Form\Formation\FormationFormAwareTrait; use Application\Service\Formation\FormationServiceAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class FormationController extends AbstractActionController { use FormationServiceAwareTrait; use FormationFormAwareTrait; public function indexAction() { $formations = $this->getFormationService()->getFormations('libelle'); return new ViewModel([ 'formations' => $formations, ]); } public function afficherAction() { $formation = $this->getFormationService()->getRequestedFormation($this); return new ViewModel([ 'title' => 'Affichage de la formation ['.$formation->getLibelle().']', 'formation' => $formation, ]); } public function ajouterAction() { $formation = new Formation(); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/ajouter', [], [], true)); $form->bind($formation); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getFormationService()->create($formation); exit; } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Ajouter une formation', 'form' => $form, ]); return $vm; } public function editerAction() { $formation = $this->getFormationService()->getRequestedFormation($this); // if ($formation === null) $formation = $this->getFormationService()->getLastFormation(); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/editer', ['formation' => $formation->getId()], [], true)); $form->bind($formation); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getFormationService()->update($formation); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Edition d\'une formation', 'form' => $form, ]); return $vm; } public function historiserAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->historise($formation); return $this->redirect()->toRoute('formation', [], [], true); } public function restaurerAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->restore($formation); return $this->redirect()->toRoute('formation', [], [], true); } public function detruireAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->delete($formation); return $this->redirect()->toRoute('formation', [], [], true); } } No newline at end of file module/Application/src/Application/Controller/Formation/FormationControllerFactory.php 0 → 100644 +27 −0 Changes for module/Application/src/Application/Controller/Formation/FormationControllerFactory.php: 27 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Controller\Formation; use Application\Form\Formation\FormationForm; use Application\Service\Formation\FormationService; use Zend\Mvc\Controller\ControllerManager; class FormationControllerFactory { public function __invoke(ControllerManager $manager) { /** * @var FormationService $formationService * @var FormationForm $formationForm */ $formationService = $manager->getServiceLocator()->get(FormationService::class); $formationForm = $manager->getServiceLocator()->get('FormElementManager')->get(FormationForm::class); /** @var FormationController $controller */ $controller = new FormationController(); $controller->setFormationService($formationService); $controller->setFormationForm($formationForm); return $controller; } } No newline at end of file module/Application/src/Application/Entity/Db/Formation.php 0 → 100644 +81 −0 Changes for module/Application/src/Application/Entity/Db/Formation.php: 81 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareTrait; class Formation { use HistoriqueAwareTrait; /** @var integer */ private $id; /** @var string */ private $libelle; /** @var string */ private $description; /** @var string */ private $lien; /** * @return int */ public function getId() { return $this->id; } /** * @return string */ public function getLibelle() { return $this->libelle; } /** * @param string $libelle * @return Formation */ public function setLibelle($libelle) { $this->libelle = $libelle; return $this; } /** * @return string */ public function getDescription() { return $this->description; } /** * @param string $description * @return Formation */ public function setDescription($description) { $this->description = $description; return $this; } /** * @return string */ public function getLien() { return $this->lien; } /** * @param string $lien * @return Formation */ public function setLien($lien) { $this->lien = $lien; return $this; } } No newline at end of file Loading
module/Application/config/merged/formation.config.php 0 → 100644 +156 −0 Changes for module/Application/config/merged/formation.config.php: 156 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application; use Application\Controller\Formation\FormationController; use Application\Controller\Formation\FormationControllerFactory; use Application\Form\Formation\FormationForm; use Application\Form\Formation\FormationFormFactory; use Application\Form\Formation\FormationHydrator; use Application\Form\Formation\FormationHydratorFactory; use Application\Provider\Privilege\FormationPrivileges; use Application\Service\Formation\FormationService; use Application\Service\Formation\FormationServiceFactory; use UnicaenAuth\Guard\PrivilegeController; use Zend\Mvc\Router\Http\Literal; use Zend\Mvc\Router\Http\Segment; return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => FormationController::class, 'action' => [ 'index', 'afficher', ], 'privileges' => [ FormationPrivileges::AFFICHER, ], ], [ 'controller' => FormationController::class, 'action' => [ 'ajouter', 'editer', 'historiser', 'restaurer', ], 'privileges' => [ FormationPrivileges::EDITER, ], ], [ 'controller' => FormationController::class, 'action' => [ 'detruire', ], 'privileges' => [ FormationPrivileges::DETRUIRE, ], ], ], ], ], 'router' => [ 'routes' => [ 'formation' => [ 'type' => Literal::class, 'options' => [ 'route' => '/formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'index', ], ], 'may_terminate' => true, 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'ajouter', ], ], ], 'afficher' => [ 'type' => Segment::class, 'options' => [ 'route' => '/afficher/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'afficher', ], ], ], 'editer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/editer/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'editer', ], ], ], 'historiser' => [ 'type' => Segment::class, 'options' => [ 'route' => '/historiser/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'historiser', ], ], ], 'restaurer' => [ 'type' => Segment::class, 'options' => [ 'route' => '/restaurer/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'restaurer', ], ], ], 'detruire' => [ 'type' => Segment::class, 'options' => [ 'route' => '/detruire/:formation', 'defaults' => [ 'controller' => FormationController::class, 'action' => 'detruire', ], ], ], ], ], ], ], 'service_manager' => [ 'factories' => [ FormationService::class => FormationServiceFactory::class, ], ], 'controllers' => [ 'factories' => [ FormationController::class => FormationControllerFactory::class ], ], 'form_elements' => [ 'factories' => [ FormationForm::class => FormationFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ FormationHydrator::class => FormationHydratorFactory::class, ], ] ]; No newline at end of file
module/Application/config/merged/menu.config.php +9 −0 Changes for module/Application/config/merged/menu.config.php: 9 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -6,6 +6,7 @@ use Application\Provider\Privilege\ActivitePrivileges; use Application\Provider\Privilege\AdministrationPrivileges; use Application\Provider\Privilege\ApplicationPrivileges; use Application\Provider\Privilege\FicheMetierPrivileges; use Application\Provider\Privilege\FormationPrivileges; use Application\Provider\Privilege\PersoPrivileges; use Application\Provider\Privilege\PostePrivileges; use Application\Provider\Privilege\RessourceRhPrivileges; Loading Loading @@ -224,6 +225,14 @@ return [ 'dropdown-header' => true, 'icon' => 'fas fa-angle-right' ], [ 'order' => 4, 'label' => 'Les formations', 'route' => 'formation', 'privileges' => FormationPrivileges::AFFICHER, 'dropdown-header' => true, 'icon' => 'fas fa-angle-right' ], // [ // 'order' => 4, // 'label' => 'Les formations', Loading
module/Application/src/Application/Controller/Formation/FormationController.php 0 → 100644 +111 −0 Changes for module/Application/src/Application/Controller/Formation/FormationController.php: 111 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Controller\Formation; use Application\Entity\Db\Formation; use Application\Form\Formation\FormationFormAwareTrait; use Application\Service\Formation\FormationServiceAwareTrait; use Zend\Http\Request; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class FormationController extends AbstractActionController { use FormationServiceAwareTrait; use FormationFormAwareTrait; public function indexAction() { $formations = $this->getFormationService()->getFormations('libelle'); return new ViewModel([ 'formations' => $formations, ]); } public function afficherAction() { $formation = $this->getFormationService()->getRequestedFormation($this); return new ViewModel([ 'title' => 'Affichage de la formation ['.$formation->getLibelle().']', 'formation' => $formation, ]); } public function ajouterAction() { $formation = new Formation(); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/ajouter', [], [], true)); $form->bind($formation); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getFormationService()->create($formation); exit; } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Ajouter une formation', 'form' => $form, ]); return $vm; } public function editerAction() { $formation = $this->getFormationService()->getRequestedFormation($this); // if ($formation === null) $formation = $this->getFormationService()->getLastFormation(); $form = $this->getFormationForm(); $form->setAttribute('action', $this->url()->fromRoute('formation/editer', ['formation' => $formation->getId()], [], true)); $form->bind($formation); /** @var Request $request */ $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getFormationService()->update($formation); } } $vm = new ViewModel(); $vm->setTemplate('application/default/default-form'); $vm->setVariables([ 'title' => 'Edition d\'une formation', 'form' => $form, ]); return $vm; } public function historiserAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->historise($formation); return $this->redirect()->toRoute('formation', [], [], true); } public function restaurerAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->restore($formation); return $this->redirect()->toRoute('formation', [], [], true); } public function detruireAction() { $formation = $this->getFormationService()->getRequestedFormation($this); $this->getFormationService()->delete($formation); return $this->redirect()->toRoute('formation', [], [], true); } } No newline at end of file
module/Application/src/Application/Controller/Formation/FormationControllerFactory.php 0 → 100644 +27 −0 Changes for module/Application/src/Application/Controller/Formation/FormationControllerFactory.php: 27 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Controller\Formation; use Application\Form\Formation\FormationForm; use Application\Service\Formation\FormationService; use Zend\Mvc\Controller\ControllerManager; class FormationControllerFactory { public function __invoke(ControllerManager $manager) { /** * @var FormationService $formationService * @var FormationForm $formationForm */ $formationService = $manager->getServiceLocator()->get(FormationService::class); $formationForm = $manager->getServiceLocator()->get('FormElementManager')->get(FormationForm::class); /** @var FormationController $controller */ $controller = new FormationController(); $controller->setFormationService($formationService); $controller->setFormationForm($formationForm); return $controller; } } No newline at end of file
module/Application/src/Application/Entity/Db/Formation.php 0 → 100644 +81 −0 Changes for module/Application/src/Application/Entity/Db/Formation.php: 81 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Application\Entity\Db; use UnicaenApp\Entity\HistoriqueAwareTrait; class Formation { use HistoriqueAwareTrait; /** @var integer */ private $id; /** @var string */ private $libelle; /** @var string */ private $description; /** @var string */ private $lien; /** * @return int */ public function getId() { return $this->id; } /** * @return string */ public function getLibelle() { return $this->libelle; } /** * @param string $libelle * @return Formation */ public function setLibelle($libelle) { $this->libelle = $libelle; return $this; } /** * @return string */ public function getDescription() { return $this->description; } /** * @param string $description * @return Formation */ public function setDescription($description) { $this->description = $description; return $this; } /** * @return string */ public function getLien() { return $this->lien; } /** * @param string $lien * @return Formation */ public function setLien($lien) { $this->lien = $lien; return $this; } } No newline at end of file