Loading module/Mailing/Module.php +10 −3 Changes for module/Mailing/Module.php: 10 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ namespace Mailing; use Zend\Mvc\ModuleRouteListener; use Zend\Mvc\MvcEvent; use Zend\Config\Factory as ConfigFactory; use Zend\Stdlib\ArrayUtils; use Zend\Stdlib\Glob; class Module { Loading @@ -16,10 +18,15 @@ class Module public function getConfig() { $paths = array_merge( [__DIR__ . '/config/module.config.php'] $configInit = [ __DIR__ . '/config/module.config.php' ]; $configFiles = ArrayUtils::merge( $configInit, Glob::glob(__DIR__ . '/config/merged/{,*.}{config}.php', Glob::GLOB_BRACE) ); return ConfigFactory::fromFiles($paths); return ConfigFactory::fromFiles($configFiles); } public function getAutoloaderConfig() Loading module/Mailing/config/merged/mail-type.config.php +177 Changes for module/Mailing/config/merged/mail-type.config.php: 177 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use Mailing\Controller\MailingController; use Mailing\Controller\MailTypeController; use Mailing\Controller\MailTypeControllerFactory; use Mailing\Form\MailContent\MailContentForm; use Mailing\Form\MailContent\MailContentFormFactory; use Mailing\Form\MailType\MailTypeForm; use Mailing\Form\MailType\MailTypeFormFactory; use Mailing\Form\MailType\MailTypeHydrator; use Mailing\Form\MailType\MailTypeHydratorFactory; use Mailing\Provider\Privilege\MailingPrivileges; use Mailing\Service\MailType\MailTypeService; use Mailing\Service\MailType\MailTypeServiceFactory; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; return array( 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => MailTypeController::class, 'action' => [ 'ajouter', 'afficher', 'modifier', 'historiser', 'restaurer', 'detruire', 'modifier-mail', ], 'privileges' => [ MailingPrivileges::MAILING_EFFACER, ], ], ], ], ], 'router' => [ 'routes' => [ 'mailing' => [ 'type' => Literal::class, 'may_terminate' => true, 'options' => [ 'route' => '/mailing', 'defaults' => [ 'controller' => MailingController::class, 'action' => 'index', ], ], 'child_routes' => [ 'type' => [ 'type' => Literal::class, 'may_terminate' => false, 'options' => [ 'route' => '/type', ], 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'may_terminate' => true, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'ajouter', ], ], ], 'afficher' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/afficher/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'afficher', ], ], ], 'modifier' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/modifier/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'modifier', ], ], ], 'historiser' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/historiser/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'historiser', ], ], ], 'restaurer' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/restaurer/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'restaurer', ], ], ], 'detruire' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/detruire/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'detruire', ], ], ], 'modifier-mail' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/modifier-mail/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'modifier-mail', ], ], ], ], ], ], ], ], ], 'form_elements' => [ 'factories' => [ MailContentForm::class => MailContentFormFactory::class, MailTypeForm::class => MailTypeFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ MailTypeHydrator::class => MailTypeHydratorFactory::class, ], ], 'service_manager' => [ 'factories' => [ MailTypeService::class => MailTypeServiceFactory::class, ], ], 'controllers' => [ 'factories' => [ MailTypeController::class => MailTypeControllerFactory::class, ], ], 'view_helpers' => [ 'invokables' => [ ], ], 'view_manager' => [ 'template_path_stack' => [ __DIR__ . '/../view', ], ], ); module/Mailing/src/Mailing/Controller/MailTypeController.php +141 Changes for module/Mailing/src/Mailing/Controller/MailTypeController.php: 141 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mailing\Controller; use Mailing\Form\MailContent\MailContentFormAwareTrait; use Mailing\Form\MailType\MailTypeFormAwareTrait; use Mailing\Model\Db\MailType; use Mailing\Service\MailType\MailTypeServiceAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class MailTypeController extends AbstractActionController { use MailTypeServiceAwareTrait; use MailTypeFormAwareTrait; use MailContentFormAwareTrait; public function afficherAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); return new ViewModel([ 'title' => "Affichage d'un mail type", 'type' => $type, ]); } public function ajouterAction() { $type = new MailType(); $form = $this->getMailTypeForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/ajouter', [], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->create($type); } } $vm = new ViewModel(); $vm->setTemplate('mailing/default/default-form'); $vm->setVariables([ 'title' => "Ajout des informations d'un mail type", 'form' => $form, ]); return $vm; } public function modifierAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $form = $this->getMailTypeForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/modifier', ['mail-type' => $type->getId()], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->update($type); } } $vm = new ViewModel(); $vm->setTemplate('mailing/default/default-form'); $vm->setVariables([ 'title' => "Modification des informations d'un mail type", 'form' => $form, ]); return $vm; } public function historiserAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $this->getMailTypeService()->historise($type); return $this->redirect()->toRoute('mailing', [], ["fragment" => "type"]); } public function restaurerAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $this->getMailTypeService()->restore($type); return $this->redirect()->toRoute('mailing', [], ["fragment" => "type"]); } public function detruireAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); if ($data["reponse"] === "oui") { $this->getMailTypeService()->delete($type); } exit(); } $vm = new ViewModel(); if ($type !== null) { $vm->setTemplate('mailing/default/confirmation'); $vm->setVariables([ 'title' => "Suppression du mail type", 'text' => "La suppression du mail type est définitive. <br/>Êtes-vous sûr·e de vouloir continuer ?", 'action' => $this->url()->fromRoute('mailing/type/detruire', ["type" => $type->getId()], [], true), ]); } return $vm; } public function modifierMailAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $form = $this->getMailContentForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/modifier-mail', ['mail-type' => $type->getId()], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->update($type); } } $vm = new ViewModel(); $vm->setVariables([ 'title' => "Modification du conteny d'un mail type", 'form' => $form, ]); return $vm; } } No newline at end of file module/Mailing/src/Mailing/Controller/MailTypeControllerFactory.php +37 Changes for module/Mailing/src/Mailing/Controller/MailTypeControllerFactory.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mailing\Controller; use Interop\Container\ContainerInterface; use Mailing\Form\MailContent\MailContentForm; use Mailing\Form\MailType\MailTypeForm; use Mailing\Service\MailType\MailTypeService; class MailTypeControllerFactory { /** * @param ContainerInterface $container * @return MailTypeController */ public function __invoke(ContainerInterface $container) { /** * @var MailTypeService $mailTypeService */ $mailTypeService = $container->get(MailTypeService::class); /** * @var MailContentForm $mailContentForm * @var MailTypeForm $mailTypeForm */ $mailContentForm = $container->get('FormElementManager')->get(MailContentForm::class); $mailTypeForm = $container->get('FormElementManager')->get(MailTypeForm::class); /** @var MailTypeController $controller */ $controller = new MailTypeController(); $controller->setMailTypeService($mailTypeService); $controller->setMailContentForm($mailContentForm); $controller->setMailTypeForm($mailTypeForm); return $controller; } } No newline at end of file module/Mailing/src/Mailing/Controller/MailingController.php +9 −1 Changes for module/Mailing/src/Mailing/Controller/MailingController.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Mailing\Controller; use Mailing\Model\Db\MailType; use Mailing\Service\MailType\MailTypeServiceAwareTrait; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Mailing\Model\Db\Mail; use Mailing\Service\Mailing\MailingServiceAwareTrait; Loading @@ -10,15 +12,21 @@ use Zend\View\Model\ViewModel; class MailingController extends AbstractActionController { use MailingServiceAwareTrait; use MailTypeServiceAwareTrait; use UserServiceAwareTrait; public function indexAction() { /** @var Mail[] $mails */ /** * @var Mail[] $mails * @var MailType[] $types */ $mails = $this->getMailingService()->getMails(); $types = $this->getMailTypeService()->getMailsTypes(); return new ViewModel([ 'mails' => $mails, 'types' => $types, ]); } Loading Loading
module/Mailing/Module.php +10 −3 Changes for module/Mailing/Module.php: 10 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ namespace Mailing; use Zend\Mvc\ModuleRouteListener; use Zend\Mvc\MvcEvent; use Zend\Config\Factory as ConfigFactory; use Zend\Stdlib\ArrayUtils; use Zend\Stdlib\Glob; class Module { Loading @@ -16,10 +18,15 @@ class Module public function getConfig() { $paths = array_merge( [__DIR__ . '/config/module.config.php'] $configInit = [ __DIR__ . '/config/module.config.php' ]; $configFiles = ArrayUtils::merge( $configInit, Glob::glob(__DIR__ . '/config/merged/{,*.}{config}.php', Glob::GLOB_BRACE) ); return ConfigFactory::fromFiles($paths); return ConfigFactory::fromFiles($configFiles); } public function getAutoloaderConfig() Loading
module/Mailing/config/merged/mail-type.config.php +177 Changes for module/Mailing/config/merged/mail-type.config.php: 177 added lines, 0 removed lines. Original line number Diff line number Diff line <?php use Mailing\Controller\MailingController; use Mailing\Controller\MailTypeController; use Mailing\Controller\MailTypeControllerFactory; use Mailing\Form\MailContent\MailContentForm; use Mailing\Form\MailContent\MailContentFormFactory; use Mailing\Form\MailType\MailTypeForm; use Mailing\Form\MailType\MailTypeFormFactory; use Mailing\Form\MailType\MailTypeHydrator; use Mailing\Form\MailType\MailTypeHydratorFactory; use Mailing\Provider\Privilege\MailingPrivileges; use Mailing\Service\MailType\MailTypeService; use Mailing\Service\MailType\MailTypeServiceFactory; use UnicaenPrivilege\Guard\PrivilegeController; use Zend\Router\Http\Literal; use Zend\Router\Http\Segment; return array( 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => MailTypeController::class, 'action' => [ 'ajouter', 'afficher', 'modifier', 'historiser', 'restaurer', 'detruire', 'modifier-mail', ], 'privileges' => [ MailingPrivileges::MAILING_EFFACER, ], ], ], ], ], 'router' => [ 'routes' => [ 'mailing' => [ 'type' => Literal::class, 'may_terminate' => true, 'options' => [ 'route' => '/mailing', 'defaults' => [ 'controller' => MailingController::class, 'action' => 'index', ], ], 'child_routes' => [ 'type' => [ 'type' => Literal::class, 'may_terminate' => false, 'options' => [ 'route' => '/type', ], 'child_routes' => [ 'ajouter' => [ 'type' => Literal::class, 'may_terminate' => true, 'options' => [ 'route' => '/ajouter', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'ajouter', ], ], ], 'afficher' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/afficher/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'afficher', ], ], ], 'modifier' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/modifier/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'modifier', ], ], ], 'historiser' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/historiser/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'historiser', ], ], ], 'restaurer' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/restaurer/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'restaurer', ], ], ], 'detruire' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/detruire/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'detruire', ], ], ], 'modifier-mail' => [ 'type' => Segment::class, 'may_terminate' => true, 'options' => [ 'route' => '/modifier-mail/:mail-type', 'defaults' => [ 'controller' => MailTypeController::class, 'action' => 'modifier-mail', ], ], ], ], ], ], ], ], ], 'form_elements' => [ 'factories' => [ MailContentForm::class => MailContentFormFactory::class, MailTypeForm::class => MailTypeFormFactory::class, ], ], 'hydrators' => [ 'factories' => [ MailTypeHydrator::class => MailTypeHydratorFactory::class, ], ], 'service_manager' => [ 'factories' => [ MailTypeService::class => MailTypeServiceFactory::class, ], ], 'controllers' => [ 'factories' => [ MailTypeController::class => MailTypeControllerFactory::class, ], ], 'view_helpers' => [ 'invokables' => [ ], ], 'view_manager' => [ 'template_path_stack' => [ __DIR__ . '/../view', ], ], );
module/Mailing/src/Mailing/Controller/MailTypeController.php +141 Changes for module/Mailing/src/Mailing/Controller/MailTypeController.php: 141 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mailing\Controller; use Mailing\Form\MailContent\MailContentFormAwareTrait; use Mailing\Form\MailType\MailTypeFormAwareTrait; use Mailing\Model\Db\MailType; use Mailing\Service\MailType\MailTypeServiceAwareTrait; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; class MailTypeController extends AbstractActionController { use MailTypeServiceAwareTrait; use MailTypeFormAwareTrait; use MailContentFormAwareTrait; public function afficherAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); return new ViewModel([ 'title' => "Affichage d'un mail type", 'type' => $type, ]); } public function ajouterAction() { $type = new MailType(); $form = $this->getMailTypeForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/ajouter', [], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->create($type); } } $vm = new ViewModel(); $vm->setTemplate('mailing/default/default-form'); $vm->setVariables([ 'title' => "Ajout des informations d'un mail type", 'form' => $form, ]); return $vm; } public function modifierAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $form = $this->getMailTypeForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/modifier', ['mail-type' => $type->getId()], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->update($type); } } $vm = new ViewModel(); $vm->setTemplate('mailing/default/default-form'); $vm->setVariables([ 'title' => "Modification des informations d'un mail type", 'form' => $form, ]); return $vm; } public function historiserAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $this->getMailTypeService()->historise($type); return $this->redirect()->toRoute('mailing', [], ["fragment" => "type"]); } public function restaurerAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $this->getMailTypeService()->restore($type); return $this->redirect()->toRoute('mailing', [], ["fragment" => "type"]); } public function detruireAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); if ($data["reponse"] === "oui") { $this->getMailTypeService()->delete($type); } exit(); } $vm = new ViewModel(); if ($type !== null) { $vm->setTemplate('mailing/default/confirmation'); $vm->setVariables([ 'title' => "Suppression du mail type", 'text' => "La suppression du mail type est définitive. <br/>Êtes-vous sûr·e de vouloir continuer ?", 'action' => $this->url()->fromRoute('mailing/type/detruire', ["type" => $type->getId()], [], true), ]); } return $vm; } public function modifierMailAction() { $type = $this->getMailTypeService()->getRequestedMailType($this); $form = $this->getMailContentForm(); $form->setAttribute('action', $this->url()->fromRoute('mailing/type/modifier-mail', ['mail-type' => $type->getId()], [], true)); $form->bind($type); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); $form->setData($data); if ($form->isValid()) { $this->getMailTypeService()->update($type); } } $vm = new ViewModel(); $vm->setVariables([ 'title' => "Modification du conteny d'un mail type", 'form' => $form, ]); return $vm; } } No newline at end of file
module/Mailing/src/Mailing/Controller/MailTypeControllerFactory.php +37 Changes for module/Mailing/src/Mailing/Controller/MailTypeControllerFactory.php: 37 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace Mailing\Controller; use Interop\Container\ContainerInterface; use Mailing\Form\MailContent\MailContentForm; use Mailing\Form\MailType\MailTypeForm; use Mailing\Service\MailType\MailTypeService; class MailTypeControllerFactory { /** * @param ContainerInterface $container * @return MailTypeController */ public function __invoke(ContainerInterface $container) { /** * @var MailTypeService $mailTypeService */ $mailTypeService = $container->get(MailTypeService::class); /** * @var MailContentForm $mailContentForm * @var MailTypeForm $mailTypeForm */ $mailContentForm = $container->get('FormElementManager')->get(MailContentForm::class); $mailTypeForm = $container->get('FormElementManager')->get(MailTypeForm::class); /** @var MailTypeController $controller */ $controller = new MailTypeController(); $controller->setMailTypeService($mailTypeService); $controller->setMailContentForm($mailContentForm); $controller->setMailTypeForm($mailTypeForm); return $controller; } } No newline at end of file
module/Mailing/src/Mailing/Controller/MailingController.php +9 −1 Changes for module/Mailing/src/Mailing/Controller/MailingController.php: 9 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Mailing\Controller; use Mailing\Model\Db\MailType; use Mailing\Service\MailType\MailTypeServiceAwareTrait; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; use Mailing\Model\Db\Mail; use Mailing\Service\Mailing\MailingServiceAwareTrait; Loading @@ -10,15 +12,21 @@ use Zend\View\Model\ViewModel; class MailingController extends AbstractActionController { use MailingServiceAwareTrait; use MailTypeServiceAwareTrait; use UserServiceAwareTrait; public function indexAction() { /** @var Mail[] $mails */ /** * @var Mail[] $mails * @var MailType[] $types */ $mails = $this->getMailingService()->getMails(); $types = $this->getMailTypeService()->getMailsTypes(); return new ViewModel([ 'mails' => $mails, 'types' => $types, ]); } Loading