Commit 03ed6005 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Debut de la gestion des fiches métiers

parent ea4d2ebc
Loading
Loading
Loading
Loading
+2 −1
Changes for composer.json: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -9,7 +9,8 @@
    ],
    "require": {
        "unicaen/app":                  "^1.2",
        "unicaen/auth":                 "^1.2"
        "unicaen/auth":                 "^1.2",
        "unicaen/ldap": "^2.2"
    },
    "require-dev": {
        "unicaen/code":                         "^1.0",
+40 −1
Changes for composer.lock: 40 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
        "This file is @generated automatically"
    ],
    "content-hash": "bcb9208b9be4b8501ca2523e38beb559",
    "content-hash": "bfc07f403e04b3d5970f0443758676ac",
    "packages": [
        {
            "name": "bjyoungblood/bjy-authorize",
@@ -74,6 +74,7 @@
                "zf2",
                "zfc-user"
            ],
            "abandoned": true,
            "time": "2013-07-05T11:59:46+00:00"
        },
        {
@@ -1481,6 +1482,43 @@
            "description": "Module d'authentification pour les applications Unicaen",
            "time": "2018-03-28T08:19:16+00:00"
        },
        {
            "name": "unicaen/ldap",
            "version": "2.2.2",
            "source": {
                "type": "git",
                "url": "https://git.unicaen.fr/lib/unicaen/ldap.git",
                "reference": "4e981c60db598168c9f8a5d916d01af4bf9b0581"
            },
            "require": {
                "php": "^5.6 || ^7.0",
                "zendframework/zend-config": "~2.4 || ^2.7",
                "zendframework/zend-i18n": "~2.4 || ^2.7",
                "zendframework/zend-ldap": "~2.4 || ^2.7",
                "zendframework/zend-log": "~2.4 || ^2.7",
                "zendframework/zend-modulemanager": "~2.4 || ^2.7",
                "zendframework/zend-serializer": "~2.4 || ^2.7",
                "zendframework/zend-servicemanager": "~2.4 || ^2.7",
                "zendframework/zend-stdlib": "~2.4 || ^2.7"
            },
            "require-dev": {
                "phpunit/phpunit": ">=3.7",
                "zendframework/zend-test": ">=2.2"
            },
            "type": "library",
            "autoload": {
                "psr-0": {
                    "UnicaenLdap": "src/",
                    "UnicaenLdapUnitTest": "tests/unit/",
                    "UnicaenLdapFuncTest": "tests/func/"
                },
                "classmap": [
                    "./Module.php"
                ]
            },
            "description": "Module Ldap des applications Unicaen",
            "time": "2018-02-26T08:32:18+00:00"
        },
        {
            "name": "zendframework/zend-authentication",
            "version": "2.4.13",
@@ -3265,6 +3303,7 @@
                "version",
                "zf2"
            ],
            "abandoned": "ocramius/package-versions",
            "time": "2017-07-13T17:22:10+00:00"
        },
        {
+1 −1
Changes for config/application.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -3,7 +3,7 @@
$modules = [
    'ZfcBase', 'DoctrineModule', 'DoctrineORMModule', 'ZfcUser', 'ZfcUserDoctrineORM',
    'BjyAuthorize', 'AssetManager',
    'UnicaenApp', 'UnicaenAuth',
    'UnicaenApp', 'UnicaenAuth', 'UnicaenLdap',
    'Application',
];

+58 −2
Changes for module/Application/config/module.config.php: 58 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -3,7 +3,13 @@
namespace Application;

use Application\Controller\FicheMetier\FicheMetierController;
use Application\Controller\FicheMetier\FicheMetierControllerFactory;
use Application\Controller\Utilisateur\UtilisateurController;
use Application\Controller\Utilisateur\UtilisateurControllerFactory;
use Application\Service\FicheMetier\FicheMetierService;
use Application\Service\FicheMetier\FicheMetierServiceFactory;
use Application\Service\User\UserService;
use Application\Service\User\UserServiceFactory;
use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain;
use Doctrine\ORM\Mapping\Driver\XmlDriver;
use UnicaenAuth\Guard\PrivilegeController;
@@ -19,6 +25,8 @@ return [
                    'action' => [
                        'index',
                        'afficher',
                        'historiser',
                        'restaurer',
                    ],
                    'roles' => [
                    ],
@@ -27,6 +35,7 @@ return [
                    'controller' => UtilisateurController::class,
                    'action' => [
                        'index',
                        'rechercher-utilisateur'
                    ],
                    'roles' => [
                    ],
@@ -93,6 +102,26 @@ return [
                        ],
                        'may_terminate' => true,
                    ],
                    'historiser' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/historiser/:id',
                            'defaults' => [
                                'controller' => FicheMetierController::class,
                                'action'     => 'historiser',
                            ],
                        ],
                    ],
                    'restaurer' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/restaurer/:id',
                            'defaults' => [
                                'controller' => FicheMetierController::class,
                                'action'     => 'restaurer',
                            ],
                        ],
                    ],
                ],
            ],
            'utilisateur-preecog' => [
@@ -104,11 +133,36 @@ return [
                        'action' => 'index',
                    ],
                ],
                'may_terminate' => true,
                'child_routes' => [
                    'rechercher-utilisateur' => [
                        'type'          => Literal::class,
                        'options'       => [
                            'route'       => '/rechercher-utilisateur',
                            'defaults'    => [
                                'controller' => UtilisateurController::class,
                                'action' => 'rechercher-utilisateur',
                            ],
                        ],
                    ],
                    'rechercher-people' => [
                        'type'          => Literal::class,
                        'options'       => [
                            'route'       => '/rechercher-people',
                            'defaults'    => [
                                'controller' => UtilisateurController::class,
                                'action' => 'rechercher-people',
                            ],
                        ],
                    ],
                ],
            ],
        ],
    ],
    'service_manager' => [
        'factories' => [
            UserService::class => UserServiceFactory::class,
            FicheMetierService::class => FicheMetierServiceFactory::class,

        ],
    ],
@@ -125,9 +179,11 @@ return [
    'controllers'     => [
        'invokables' => [
            'Application\Controller\Index' => Controller\IndexController::class,
            FicheMetierController::class => FicheMetierController::class,
            UtilisateurController::class => UtilisateurController::class,
        ],
        'factories' => [
            FicheMetierController::class => FicheMetierControllerFactory::class,
            UtilisateurController::class => UtilisateurControllerFactory::class,
        ]
    ],
    'view_manager'    => [
        'template_path_stack' => [
+33 −2
Changes for module/Application/src/Application/Controller/FicheMetier/FicheMetierController.php: 33 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -2,16 +2,47 @@

namespace Application\Controller\FicheMetier;

use Application\Service\FicheMetier\FicheMetierServiceAwareTrait;
use UnicaenApp\Exception\RuntimeException;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;

class FicheMetierController extends AbstractActionController{
class FicheMetierController extends AbstractActionController
{
    use FicheMetierServiceAwareTrait;

    public function indexAction() {
        return new ViewModel();

        $fichesMetiers = $this->getFicheMetierService()->getFichesMetiers();

        return new ViewModel([
            'fichesMetiers' => $fichesMetiers,
        ]);
    }

    public function afficherAction() {
        return new ViewModel();
    }

    public function historiserAction()
    {
        $ficheId = $this->params()->fromRoute('id');
        $fiche = $this->getFicheMetierService()->getFicheMetier($ficheId);

        if ($fiche === null) throw new RuntimeException("Aucune fiche ne porte l'identifiant [".$ficheId."]");

        $this->getFicheMetierService()->historiser($fiche);
        $this->redirect()->toRoute('fiche-metier',[], [], true);
    }

    public function restaurerAction()
    {
        $ficheId = $this->params()->fromRoute('id');
        $fiche = $this->getFicheMetierService()->getFicheMetier($ficheId);

        if ($fiche === null) throw new RuntimeException("Aucune fiche ne porte l'identifiant [".$ficheId."]");

        $this->getFicheMetierService()->restaurer($fiche);
        $this->redirect()->toRoute('fiche-metier',[], [], true);
    }
}
 No newline at end of file
Loading