Loading module/Formation/config/merged/agent.config.php +37 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ namespace Formation; use Application\Controller\AgentController; use Formation\Controller\AgentController; use Formation\Controller\AgentControllerFactory; use Formation\Provider\Privilege\FormationagentPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; use Laminas\Router\Http\Literal; Loading @@ -12,7 +13,33 @@ return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => AgentController::class, 'action' => [ 'index', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_INDEX), ], ], [ 'controller' => AgentController::class, 'action' => [ 'afficher', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER), ], ], [ 'controller' => AgentController::class, 'action' => [ 'mes-agents', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_MESAGENTS), ], ], ], ], ], Loading @@ -34,7 +61,7 @@ return [ 'agent' => [ 'order' => 420, 'label' => 'Agent', 'route' => 'formation/agent', 'route' => 'formation/agent-index', 'resource' => FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER), 'icon' => 'fas fa-angle-right', ], Loading @@ -52,6 +79,7 @@ return [ 'agent-index' => [ 'type' => Literal::class, 'options' => [ /** @see AgentController::indexAction() */ 'route' => '/agent-index', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -63,6 +91,7 @@ return [ 'agent' => [ 'type' => Segment::class, 'options' => [ /** @see AgentController::afficherAction() */ 'route' => '/agent[/:agent]', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -74,6 +103,7 @@ return [ 'mes-agents' => [ 'type' => Literal::class, 'options' => [ /** @see AgentController::mesAgentsAction() */ 'route' => '/mes-agents', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -90,7 +120,10 @@ return [ 'factories' => [], ], 'controllers' => [ 'factories' => [], 'factories' => [ AgentController::class => AgentControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [], Loading module/Formation/src/Formation/Controller/AgentController.php 0 → 100644 +45 −0 Original line number Diff line number Diff line <?php namespace Formation\Controller; use Application\Service\Agent\AgentServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; class AgentController extends AbstractActionController { use AgentServiceAwareTrait; use UserServiceAwareTrait; public function indexAction() : ViewModel { $params = $this->params()->fromQuery(); $agents = $this->getAgentService()->getAgentsWithFiltre($params); return new ViewModel([ 'agents' => $agents, 'params' => $params, ]); } public function afficherAction() : ViewModel { $agent = $this->getAgentService()->getRequestedAgent($this); return new ViewModel([ 'agent' => $agent, ]); } public function mesAgentsAction() : ViewModel { $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); $agents = []; //$this->getAgentService()->getAgentsByResponsabilite($user, $role); return new ViewModel([ 'user' => $user, 'role' => $role, 'agents' => $agents, ]); } } No newline at end of file module/Formation/src/Formation/Controller/AgentControllerFactory.php 0 → 100644 +31 −0 Original line number Diff line number Diff line <?php namespace Formation\Controller; use Application\Service\Agent\AgentService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Service\User\UserService; class AgentControllerFactory { /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : AgentController { /** * @var AgentService $agentService * @var UserService $userService */ $agentService = $container->get(AgentService::class); $userService = $container->get(UserService::class); $controller = new AgentController(); $controller->setAgentService($agentService); $controller->setUserService($userService); return $controller; } } No newline at end of file module/Formation/view/formation/agent/afficher.phtml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php /** * @see \Formation\Controller\AgentController::afficherAction() * @var Agent $agent */ use Application\Entity\Db\Agent; $this->headTitle("Afficher l'agent " . $agent->getDenomination()); ?> <h1 class="page-header"> Agent : <span class="highlight agent"> <?php echo $agent->getDenomination(); ?> </span> </h1> <h2> Information sur l'agent </h2> <div class="row"> <div class="col-md-6">INFO</div> <div class="col-md-6">AFFECTATION</div> </div> module/Formation/view/formation/agent/index.phtml 0 → 100644 +113 −0 Original line number Diff line number Diff line <?php use Application\Entity\Db\Agent; use Formation\Provider\Privilege\FormationagentPrivileges; /** * @see \Formation\Controller\AgentController::indexAction() * @var array $params * @var Agent[] $agents */ $this->headTitle('Agents'); $nbAgent = count($agents); $canAfficher = $this->isAllowed(FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER)); ?> <h1 class="page-header"> Agents </h1> <?php echo $this->partial('partial/filtre', ['params' => $params]); ?> <?php if ($params === null or $params === []) : ?> <div class="alert alert-info"> <span class="icon icon-information"></span> Aucun critère de recherche. </div> <?php else : ?> <?php if ($nbAgent > 0 AND $nbAgent < 500) : ?> <table id="agents" class="datatable table table-condensed table-hover"> <thead> <tr> <th> Source Id </th> <th> Dénomination </th> <th> Affectations </th> <th> <span title="Lié à un utilisateur de l'application">Lié</span> </th> <th class="action"> Action </th> </tr> </thead> <tbody> <?php foreach ($agents as $agent) : ?> <tr> <td> <span class="badge"><?php echo $agent->getId(); ?> </td> <td> <?php echo $agent->getDenomination(); ?> </td> <td> <?php $affectations = $agent->getAffectationsActifs(); ?> <ul> <?php foreach ($affectations as $affectation) : ?> <li> <?php if ($affectation->isPrincipale()) { echo "<strong>"; } ?> <?php echo $affectation->getStructure()->getLibelleCourt(); ?> <?php if ($affectation->isPrincipale()) { echo "</strong>"; } ?> </li> <?php endforeach; ?> </ul> </td> <td> <?php if ($agent->getUtilisateur() !== null) : ?> <span class="icon icon-checked" style="color:darkgreen;" title="<?php echo $agent->getUtilisateur()->getDisplayName(); ?>"></span> <?php echo $agent->getUtilisateur()->getUsername(); ?> <?php else: ?> <span class="icon icon-retirer" style="color:darkred;"></span> <?php endif; ?> </td> <td class="action"> <?php if ($canAfficher) : ?> <a <?php /** @see \Application\Controller\AgentController::afficherAction() */?> href="<?php echo $this->url('formation/agent', ['agent' => $agent->getId()], [], true); ?>" > <span class="icon icon-voir"></span> Afficher </a> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php else : ?> <?php if ($nbAgent === 0) : ?> <div class="alert alert-warning"> <span class="icon icon-information"></span> Aucun résultat pour votre réquête </div> <?php endif; ?> <?php if ($nbAgent > 500) : ?> <div class="alert alert-warning"> <span class="icon icon-attention"></span> Plus de 500 agents de remontés. Pas d'affichage sous formes de tableaux </div> <?php endif; ?> <?php endif; ?> <?php endif; ?> <script> $(document).ready(function() { $('#agents').DataTable( { "sorting": false, language: { url: '/localisation/fr_FR.json' } } ); } ); </script> Loading
module/Formation/config/merged/agent.config.php +37 −4 Original line number Diff line number Diff line Loading @@ -2,7 +2,8 @@ namespace Formation; use Application\Controller\AgentController; use Formation\Controller\AgentController; use Formation\Controller\AgentControllerFactory; use Formation\Provider\Privilege\FormationagentPrivileges; use UnicaenPrivilege\Guard\PrivilegeController; use Laminas\Router\Http\Literal; Loading @@ -12,7 +13,33 @@ return [ 'bjyauthorize' => [ 'guards' => [ PrivilegeController::class => [ [ 'controller' => AgentController::class, 'action' => [ 'index', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_INDEX), ], ], [ 'controller' => AgentController::class, 'action' => [ 'afficher', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER), ], ], [ 'controller' => AgentController::class, 'action' => [ 'mes-agents', ], 'privilege' => [ FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_MESAGENTS), ], ], ], ], ], Loading @@ -34,7 +61,7 @@ return [ 'agent' => [ 'order' => 420, 'label' => 'Agent', 'route' => 'formation/agent', 'route' => 'formation/agent-index', 'resource' => FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER), 'icon' => 'fas fa-angle-right', ], Loading @@ -52,6 +79,7 @@ return [ 'agent-index' => [ 'type' => Literal::class, 'options' => [ /** @see AgentController::indexAction() */ 'route' => '/agent-index', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -63,6 +91,7 @@ return [ 'agent' => [ 'type' => Segment::class, 'options' => [ /** @see AgentController::afficherAction() */ 'route' => '/agent[/:agent]', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -74,6 +103,7 @@ return [ 'mes-agents' => [ 'type' => Literal::class, 'options' => [ /** @see AgentController::mesAgentsAction() */ 'route' => '/mes-agents', 'defaults' => [ 'controller' => AgentController::class, Loading @@ -90,7 +120,10 @@ return [ 'factories' => [], ], 'controllers' => [ 'factories' => [], 'factories' => [ AgentController::class => AgentControllerFactory::class, ], ], 'form_elements' => [ 'factories' => [], Loading
module/Formation/src/Formation/Controller/AgentController.php 0 → 100644 +45 −0 Original line number Diff line number Diff line <?php namespace Formation\Controller; use Application\Service\Agent\AgentServiceAwareTrait; use Laminas\Mvc\Controller\AbstractActionController; use Laminas\View\Model\ViewModel; use UnicaenUtilisateur\Service\User\UserServiceAwareTrait; class AgentController extends AbstractActionController { use AgentServiceAwareTrait; use UserServiceAwareTrait; public function indexAction() : ViewModel { $params = $this->params()->fromQuery(); $agents = $this->getAgentService()->getAgentsWithFiltre($params); return new ViewModel([ 'agents' => $agents, 'params' => $params, ]); } public function afficherAction() : ViewModel { $agent = $this->getAgentService()->getRequestedAgent($this); return new ViewModel([ 'agent' => $agent, ]); } public function mesAgentsAction() : ViewModel { $user = $this->getUserService()->getConnectedUser(); $role = $this->getUserService()->getConnectedRole(); $agents = []; //$this->getAgentService()->getAgentsByResponsabilite($user, $role); return new ViewModel([ 'user' => $user, 'role' => $role, 'agents' => $agents, ]); } } No newline at end of file
module/Formation/src/Formation/Controller/AgentControllerFactory.php 0 → 100644 +31 −0 Original line number Diff line number Diff line <?php namespace Formation\Controller; use Application\Service\Agent\AgentService; use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerInterface; use Psr\Container\NotFoundExceptionInterface; use UnicaenUtilisateur\Service\User\UserService; class AgentControllerFactory { /** * @throws ContainerExceptionInterface * @throws NotFoundExceptionInterface */ public function __invoke(ContainerInterface $container) : AgentController { /** * @var AgentService $agentService * @var UserService $userService */ $agentService = $container->get(AgentService::class); $userService = $container->get(UserService::class); $controller = new AgentController(); $controller->setAgentService($agentService); $controller->setUserService($userService); return $controller; } } No newline at end of file
module/Formation/view/formation/agent/afficher.phtml 0 → 100644 +27 −0 Original line number Diff line number Diff line <?php /** * @see \Formation\Controller\AgentController::afficherAction() * @var Agent $agent */ use Application\Entity\Db\Agent; $this->headTitle("Afficher l'agent " . $agent->getDenomination()); ?> <h1 class="page-header"> Agent : <span class="highlight agent"> <?php echo $agent->getDenomination(); ?> </span> </h1> <h2> Information sur l'agent </h2> <div class="row"> <div class="col-md-6">INFO</div> <div class="col-md-6">AFFECTATION</div> </div>
module/Formation/view/formation/agent/index.phtml 0 → 100644 +113 −0 Original line number Diff line number Diff line <?php use Application\Entity\Db\Agent; use Formation\Provider\Privilege\FormationagentPrivileges; /** * @see \Formation\Controller\AgentController::indexAction() * @var array $params * @var Agent[] $agents */ $this->headTitle('Agents'); $nbAgent = count($agents); $canAfficher = $this->isAllowed(FormationagentPrivileges::getResourceId(FormationagentPrivileges::FORMATIONAGENT_AFFICHER)); ?> <h1 class="page-header"> Agents </h1> <?php echo $this->partial('partial/filtre', ['params' => $params]); ?> <?php if ($params === null or $params === []) : ?> <div class="alert alert-info"> <span class="icon icon-information"></span> Aucun critère de recherche. </div> <?php else : ?> <?php if ($nbAgent > 0 AND $nbAgent < 500) : ?> <table id="agents" class="datatable table table-condensed table-hover"> <thead> <tr> <th> Source Id </th> <th> Dénomination </th> <th> Affectations </th> <th> <span title="Lié à un utilisateur de l'application">Lié</span> </th> <th class="action"> Action </th> </tr> </thead> <tbody> <?php foreach ($agents as $agent) : ?> <tr> <td> <span class="badge"><?php echo $agent->getId(); ?> </td> <td> <?php echo $agent->getDenomination(); ?> </td> <td> <?php $affectations = $agent->getAffectationsActifs(); ?> <ul> <?php foreach ($affectations as $affectation) : ?> <li> <?php if ($affectation->isPrincipale()) { echo "<strong>"; } ?> <?php echo $affectation->getStructure()->getLibelleCourt(); ?> <?php if ($affectation->isPrincipale()) { echo "</strong>"; } ?> </li> <?php endforeach; ?> </ul> </td> <td> <?php if ($agent->getUtilisateur() !== null) : ?> <span class="icon icon-checked" style="color:darkgreen;" title="<?php echo $agent->getUtilisateur()->getDisplayName(); ?>"></span> <?php echo $agent->getUtilisateur()->getUsername(); ?> <?php else: ?> <span class="icon icon-retirer" style="color:darkred;"></span> <?php endif; ?> </td> <td class="action"> <?php if ($canAfficher) : ?> <a <?php /** @see \Application\Controller\AgentController::afficherAction() */?> href="<?php echo $this->url('formation/agent', ['agent' => $agent->getId()], [], true); ?>" > <span class="icon icon-voir"></span> Afficher </a> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> <?php else : ?> <?php if ($nbAgent === 0) : ?> <div class="alert alert-warning"> <span class="icon icon-information"></span> Aucun résultat pour votre réquête </div> <?php endif; ?> <?php if ($nbAgent > 500) : ?> <div class="alert alert-warning"> <span class="icon icon-attention"></span> Plus de 500 agents de remontés. Pas d'affichage sous formes de tableaux </div> <?php endif; ?> <?php endif; ?> <?php endif; ?> <script> $(document).ready(function() { $('#agents').DataTable( { "sorting": false, language: { url: '/localisation/fr_FR.json' } } ); } ); </script>