Commit 114edb2f authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

dernière modification avant changement import

parent 2d1f50a6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Application\Controller\Agent\AgentControllerFactory;
use Application\Controller\AgentFichier\AgentFichierController;
use Application\Controller\AgentFichier\AgentFichierControllerFactory;
use Application\Controller\EntretienProfessionnel\EntretienProfessionnelController;
use Application\Entity\Db\AgentStatut;
use Application\Form\Agent\AgentForm;
use Application\Form\Agent\AgentFormFactory;
use Application\Form\Agent\AgentHydrator;
@@ -16,6 +17,7 @@ use Application\Form\Agent\AgentImportFormFactory;
use Application\Provider\Privilege\AgentPrivileges;
use Application\Service\Agent\AgentService;
use Application\Service\Agent\AgentServiceFactory;
use Application\View\Helper\AgentStatutViewHelper;
use Application\View\Helper\AgentViewHelper;
use UnicaenAuth\Guard\PrivilegeController;
use Zend\Mvc\Router\Http\Literal;
@@ -222,6 +224,7 @@ return [
    'view_helpers' => [
        'invokables' => [
            'agent' => AgentViewHelper::class,
            'agentStatut' => AgentStatutViewHelper::class,
        ],
    ],

+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ return [
                                'route' => 'activite',
                                'privileges' => ActivitePrivileges::AFFICHER,
                                'dropdown-header' => true,
                                'icon' => 'fas fa-angle-right'
                                'icon' => 'fas fa-angle-right',
                            ],
                            [
                                'label' => 'Les agents',
+11 −0
Original line number Diff line number Diff line
@@ -106,6 +106,17 @@ class AgentController extends AbstractActionController
        return $this->redirect()->toRoute('agent', [], [], true);
    }

    public function afficherStatutsAction()
    {
        $agent   = $this->getAgentService()->getRequestedAgent($this, 'agent');
        $statuts = $agent->getStatuts();

        return new ViewModel([
            'title' => 'Statuts de l\'agent '.$agent->getDenomination(),
            'status' => $statuts,
        ]);
    }

    public function importerAction()
    {
        $form = $this->getAgentImportForm();
+2 −0
Original line number Diff line number Diff line
@@ -41,6 +41,8 @@ class IndexController extends AbstractActionController
        }

        $identity = $this->getUserService()->getConnectedUser();
        if ($identity) {
        }

        // !TODO bouger cela pour faire plus propre ...
        $agent = $this->getAgentService()->getAgentByUser($identity);
+46 −0
Original line number Diff line number Diff line
@@ -29,6 +29,8 @@ class Agent {
    private $quotite;
    /** @var AgentStatus */
    private $status;
    /** @var ArrayCollection (AgentStatut)*/
    private $statuts;
    /** @var Correspondance */
    private $correspondance;
    /** @var Corps */
@@ -47,6 +49,7 @@ class Agent {

    public function __construct()
    {
        $this->statuts  = new ArrayCollection();
        $this->fichiers = new ArrayCollection();
    }
    /**
@@ -170,6 +173,34 @@ class Agent {
        return $this;
    }

    /**
     * @return AgentStatut[]
     */
    public function getStatuts()
    {
        return $this->statuts->toArray();
    }

    /**
     * @param AgentStatut $statut
     * @return Agent
     */
    public function addStatut($statut)
    {
        $this->statuts->add($statut);
        return $this;
    }

    /**
     * @param AgentStatut $statut
     * @return Agent
     */
    public function removeStatut($statut)
    {
        $this->statuts->removeElement($statut);
        return $this;
    }

    /**
     * @return Correspondance
     */
@@ -336,4 +367,19 @@ class Agent {
        }
        return $result;
    }

    /**
     * @return AgentStatut[]
     */
    public function getStatutsActifs()
    {
        $statutsActifs = [];
        foreach ($this->statuts as $statut) {
            if ($statut->isActif()) {
                $statutsActifs[] = $statut;
            }
        }

        return $statutsActifs;
    }
}
 No newline at end of file
Loading