diff --git a/composer.lock b/composer.lock
index 47e4ab049c9dc20dfcda039b5838656ed7d25efd..f5a53c8f4ad892451de9d690f0c3a885fe96f259 100644
--- a/composer.lock
+++ b/composer.lock
@@ -3,7 +3,7 @@
         "This file locks the dependencies of your project to a known state",
         "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file"
     ],
-    "hash": "c4b1706ae7945df7afa01fe214591cda",
+    "hash": "da3eba423b417df609189e5af2dfb2ba",
     "packages": [
         {
             "name": "bjyoungblood/bjy-authorize",
@@ -701,7 +701,7 @@
                 {
                     "name": "Johannes Schmitt",
                     "email": "schmittjoh@gmail.com",
-                    "homepage": "https://github.com/schmittjoh",
+                    "homepage": "http://jmsyst.com",
                     "role": "Developer of wrapped JMSSerializerBundle"
                 }
             ],
@@ -1072,7 +1072,7 @@
             "source": {
                 "type": "svn",
                 "url": "https://svn.unicaen.fr/svn/UnicaenApp",
-                "reference": "/trunk/@441"
+                "reference": "/trunk/@474"
             },
             "require": {
                 "doctrine/doctrine-orm-module": ">=0.7",
@@ -1474,17 +1474,17 @@
         },
         {
             "name": "zendframework/zend-db",
-            "version": "2.3.0",
+            "version": "2.3.1",
             "target-dir": "Zend/Db",
             "source": {
                 "type": "git",
                 "url": "https://github.com/zendframework/Component_ZendDb.git",
-                "reference": "37d573ea83b9573e2247c36fac7b370283ca673e"
+                "reference": "29bb7f1ceacb32fa3e1c122bc3d14da6490aba2c"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/zendframework/Component_ZendDb/zipball/37d573ea83b9573e2247c36fac7b370283ca673e",
-                "reference": "37d573ea83b9573e2247c36fac7b370283ca673e",
+                "url": "https://api.github.com/repos/zendframework/Component_ZendDb/zipball/29bb7f1ceacb32fa3e1c122bc3d14da6490aba2c",
+                "reference": "29bb7f1ceacb32fa3e1c122bc3d14da6490aba2c",
                 "shasum": ""
             },
             "require": {
@@ -1503,8 +1503,8 @@
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "2.2-dev",
-                    "dev-develop": "2.3-dev"
+                    "dev-master": "2.3-dev",
+                    "dev-develop": "2.4-dev"
                 }
             },
             "autoload": {
@@ -1520,7 +1520,7 @@
                 "db",
                 "zf2"
             ],
-            "time": "2014-03-12 17:04:30"
+            "time": "2014-04-15 15:29:07"
         },
         {
             "name": "zendframework/zend-escaper",
@@ -2992,16 +2992,16 @@
         },
         {
             "name": "zf-commons/zfc-user",
-            "version": "0.1.2",
+            "version": "0.1.3",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ZF-Commons/ZfcUser.git",
-                "reference": "7425ea50733caeeaeaeaa77ea7e910dab3434493"
+                "reference": "db5b39df5f640c86299c74f46a91869c09c9a3ed"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ZF-Commons/ZfcUser/zipball/7425ea50733caeeaeaeaa77ea7e910dab3434493",
-                "reference": "7425ea50733caeeaeaeaa77ea7e910dab3434493",
+                "url": "https://api.github.com/repos/ZF-Commons/ZfcUser/zipball/db5b39df5f640c86299c74f46a91869c09c9a3ed",
+                "reference": "db5b39df5f640c86299c74f46a91869c09c9a3ed",
                 "shasum": ""
             },
             "require": {
@@ -3009,20 +3009,33 @@
                 "zendframework/zend-authentication": "~2.1",
                 "zendframework/zend-crypt": "~2.1",
                 "zendframework/zend-form": "~2.1",
+                "zendframework/zend-http": "~2.1",
                 "zendframework/zend-inputfilter": "~2.1",
                 "zendframework/zend-loader": "~2.1",
                 "zendframework/zend-modulemanager": "~2.1",
                 "zendframework/zend-mvc": "~2.1",
                 "zendframework/zend-servicemanager": "~2.1",
+                "zendframework/zend-session": "~2.1",
                 "zendframework/zend-stdlib": "~2.1",
                 "zendframework/zend-validator": "~2.1",
                 "zendframework/zend-view": "~2.1",
                 "zf-commons/zfc-base": "0.*"
             },
+            "require-dev": {
+                "phpmd/phpmd": "1.4.*",
+                "phpunit/phpunit": ">=3.7,<4",
+                "squizlabs/php_codesniffer": "1.4.*",
+                "zendframework/zend-captcha": "~2.1"
+            },
             "suggest": {
-                "zendframework/zend-session": "To use the default authentication adapter."
+                "zendframework/zend-captcha": "Zend\\Captcha if you want to use the captcha component"
             },
             "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "0.1.x-dev"
+                }
+            },
             "autoload": {
                 "psr-0": {
                     "ZfcUser": "src/"
@@ -3032,6 +3045,9 @@
                 ]
             },
             "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "BSD-3-Clause"
+            ],
             "authors": [
                 {
                     "name": "Kyle Spraggs",
@@ -3049,20 +3065,20 @@
             "keywords": [
                 "zf2"
             ],
-            "time": "2013-05-02 12:33:31"
+            "time": "2014-04-17 10:31:44"
         },
         {
             "name": "zf-commons/zfc-user-doctrine-orm",
-            "version": "0.1.2",
+            "version": "1.0.0",
             "source": {
                 "type": "git",
                 "url": "https://github.com/ZF-Commons/ZfcUserDoctrineORM.git",
-                "reference": "731e7807857c6fb12f1ad7f37694dea3855a226a"
+                "reference": "17efcb024e8f628ba777b5bbbb6201821ac14dfd"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/ZF-Commons/ZfcUserDoctrineORM/zipball/731e7807857c6fb12f1ad7f37694dea3855a226a",
-                "reference": "731e7807857c6fb12f1ad7f37694dea3855a226a",
+                "url": "https://api.github.com/repos/ZF-Commons/ZfcUserDoctrineORM/zipball/17efcb024e8f628ba777b5bbbb6201821ac14dfd",
+                "reference": "17efcb024e8f628ba777b5bbbb6201821ac14dfd",
                 "shasum": ""
             },
             "require": {
@@ -3105,7 +3121,7 @@
             "keywords": [
                 "zf2"
             ],
-            "time": "2014-04-04 19:57:32"
+            "time": "2014-04-17 19:39:44"
         }
     ],
     "packages-dev": [
@@ -3355,16 +3371,16 @@
         },
         {
             "name": "phpunit/phpunit",
-            "version": "3.7.34",
+            "version": "3.7.35",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "248d6ce95e6ca7f0e3135252c0b984bbe1f52f19"
+                "reference": "83f9537e46346f75ed6925441ac259453213c7cc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/248d6ce95e6ca7f0e3135252c0b984bbe1f52f19",
-                "reference": "248d6ce95e6ca7f0e3135252c0b984bbe1f52f19",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/83f9537e46346f75ed6925441ac259453213c7cc",
+                "reference": "83f9537e46346f75ed6925441ac259453213c7cc",
                 "shasum": ""
             },
             "require": {
@@ -3425,7 +3441,7 @@
                 "testing",
                 "xunit"
             ],
-            "time": "2014-03-28 11:04:36"
+            "time": "2014-04-21 06:25:54"
         },
         {
             "name": "phpunit/phpunit-mock-objects",
diff --git a/doc/profils.ods b/doc/profils.ods
new file mode 100644
index 0000000000000000000000000000000000000000..c6f301515d707741aaeded08c6451c3c54106da1
Binary files /dev/null and b/doc/profils.ods differ
diff --git a/doc/workflow.odp b/doc/workflow.odp
new file mode 100644
index 0000000000000000000000000000000000000000..3d95a4c43ab18fb7c9a73f2e351d2be0250a0cd1
Binary files /dev/null and b/doc/workflow.odp differ
diff --git a/module/Application/Module.php b/module/Application/Module.php
index 650c67cdaa3f47e4fe2b53916e5090ce9283efb6..1a23103b5e9d89bca62af39eb9fa130a64b31d5f 100755
--- a/module/Application/Module.php
+++ b/module/Application/Module.php
@@ -98,19 +98,4 @@ class Module implements ControllerPluginProviderInterface, ViewHelperProviderInt
             ),
         );
     }
-
-    /**
-     *
-     * @return array
-     * @see ServiceProviderInterface
-     */
-    public function getServiceConfig()
-    {
-         return array(
-            'invokables' => array(
-                'ApplicationOffreFormation' => 'Application\\Service\\OffreFormation',
-                'ApplicationIntervenant' => 'Application\\Service\\Intervenant',
-            ),
-        );
-    }
 }
diff --git a/module/Application/config/intervenant.config.php b/module/Application/config/intervenant.config.php
index f06352328a266396978a1de1d07d9f206d208397..c684a189a0529787a1f5e476fd3409fad003e2bd 100644
--- a/module/Application/config/intervenant.config.php
+++ b/module/Application/config/intervenant.config.php
@@ -105,7 +105,10 @@ return array(
     ),
     'service_manager' => array(
         'invokables' => array(
-            'ApplicationIntervenant'        => 'Application\\Service\\Intervenant',
+            'ApplicationOffreFormation' => 'Application\\Service\\OffreFormation',
+        ),
+        'factories' => array(
+            'ApplicationIntervenant' => 'Application\\Service\\IntervenantFactory',
         ),
     ),
 );
\ No newline at end of file
diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php
index 0035747fc91b1735665cd697c66f73b6a7973533..a72e13bb829ee1ca3369c84c401733c288df7f33 100755
--- a/module/Application/config/module.config.php
+++ b/module/Application/config/module.config.php
@@ -108,7 +108,7 @@ $main =  array(
         'identity_providers' => array(
 //            200 => 'UnicaenAuth\Provider\Identity\Db',
 //            100 => 'UnicaenAuth\Provider\Identity\Ldap',
-            50  => 'IdentityProvider'
+            50  => 'ApplicationIdentityProvider'
         ),
     ),
     'bjyauthorize' => array(
@@ -121,32 +121,32 @@ $main =  array(
             /**
              * Rôles issus de l'annuaire LDAP
              */
-            'UnicaenAuth\Provider\Role\Config' => array(
-                // intervant = rôle de base
-                'intervenant' => array('name' => "Intervenant", 'children' => array(
-                    // gestionnaires de composantes
-                    'cn=ucbn_composantes_responsables,ou=groups,dc=unicaen,dc=fr' => array('name' => "Responsable de composante", 'children' => array(
-                        // directeurs de composantes
-                        'cn=ucbn_composantes_directeurs,ou=groups,dc=unicaen,dc=fr' => array('name' => "Directeur de composante", 'children' => array(
-                            // administrateur de l'appli
-                            'cn=admin_cartagen,ou=groups,dc=unicaen,dc=fr',
-                        )),
-                    )),
-                )),
-            ),
+//            'UnicaenAuth\Provider\Role\Config' => array(
+//                // intervant = rôle de base
+//                'intervenant' => array('name' => "Intervenant", 'children' => array(
+//                    // gestionnaires de composantes
+//                    'cn=ucbn_composantes_responsables,ou=groups,dc=unicaen,dc=fr' => array('name' => "Responsable de composante", 'children' => array(
+//                        // directeurs de composantes
+//                        'cn=ucbn_composantes_directeurs,ou=groups,dc=unicaen,dc=fr' => array('name' => "Directeur de composante", 'children' => array(
+//                            // administrateur de l'appli
+////                            'cn=admin_cartagen,ou=groups,dc=unicaen,dc=fr',
+//                        )),
+//                    )),
+//                )),
+//            ),
         ),
     ),
     'service_manager' => array(
         'invokables' => array(
             'Common\ORM\Event\Listeners\HistoriqueListener'  => 'Common\ORM\Event\Listeners\HistoriqueListener',
             'Common\ORM\Event\Listeners\ValiditeListener'    => 'Common\ORM\Event\Listeners\ValiditeListener',
-            'ApplicationContext'                             => 'Application\\Service\\Context',
+            'ApplicationContextProvider'                     => 'Application\\Service\\ContextProvider',
             'ApplicationParametres'                          => 'Application\\Service\\Parametres',
             'ApplicationTypeIntervention'                    => 'Application\\Service\\TypeIntervention',
-            'IdentityProvider'                               => 'Application\Provider\Identity\IdentityProvider',
         ),
         'factories' => array(
-            'ApplicationRoleProvider' => 'Application\Provider\Role\RoleProviderFactory',
+            'ApplicationRoleProvider'     => 'Application\Provider\Role\RoleProviderFactory',
+            'ApplicationIdentityProvider' => 'Application\Provider\Identity\IdentityProviderFactory',
         ),
     ),
     'view_helpers' => array(
diff --git a/module/Application/config/service.config.php b/module/Application/config/service.config.php
index 232cb2a390014c437e65f1c07ea3487c04c63704..89c8b52152cbc9056f83a6a78220ba199de6c24e 100644
--- a/module/Application/config/service.config.php
+++ b/module/Application/config/service.config.php
@@ -164,10 +164,13 @@ return array(
     'service_manager' => array(
         'invokables' => array(
             'ApplicationService'            => 'Application\\Service\\Service',
-            'ApplicationServiceReferentiel' => 'Application\\Service\\ServiceReferentiel',
+            'ApplicationServiceValidation'  => 'Application\\Service\\ServiceValidation',
             'ApplicationPeriode'            => 'Application\\Service\\Periode',
             'ApplicationMotifNonPaiement'   => 'Application\\Service\\MotifNonPaiement',
-            'FormServiceRechercheHydrator'  => 'Application\Form\Service\RechercheHydrator'
+            'FormServiceRechercheHydrator'  => 'Application\Form\Service\RechercheHydrator',
+        ),
+        'factories' => array(
+            'ApplicationServiceReferentiel' => 'Application\\Service\\ServiceReferentielFactory',
         ),
     ),
     'form_elements' => array(
@@ -178,11 +181,13 @@ return array(
     'view_helpers' => array(
         'invokables' => array(
             'serviceDl'               => 'Application\View\Helper\Service\Dl',
-            'serviceListe'            => 'Application\View\Helper\Service\Liste',
-            'serviceLigne'            => 'Application\View\Helper\Service\Ligne',
             'serviceReferentielDl'    => 'Application\View\Helper\ServiceReferentiel\Dl',
-            'serviceReferentielListe' => 'Application\View\Helper\ServiceReferentiel\Liste',
-            'serviceReferentielLigne' => 'Application\View\Helper\ServiceReferentiel\Ligne',
+        ),
+        'factories' => array(
+            'serviceListe'            => 'Application\View\Helper\Service\ListeFactory',
+            'serviceLigne'            => 'Application\View\Helper\Service\LigneFactory',
+            'serviceReferentielListe' => 'Application\View\Helper\ServiceReferentiel\ListeFactory',
+            'serviceReferentielLigne' => 'Application\View\Helper\ServiceReferentiel\LigneFactory',
         ),
     ),
 );
diff --git a/module/Application/src/Application/Acl/DbRole.php b/module/Application/src/Application/Acl/DbRole.php
new file mode 100644
index 0000000000000000000000000000000000000000..2fd70bae821feab234c515f43fa733a9851c08ef
--- /dev/null
+++ b/module/Application/src/Application/Acl/DbRole.php
@@ -0,0 +1,129 @@
+<?php
+
+namespace Application\Acl;
+
+use Zend\Permissions\Acl\Role\RoleInterface;
+use BjyAuthorize\Acl\HierarchicalRoleInterface;
+use Application\Entity\Db\TypeRole;
+use Application\Entity\Db\Structure;
+
+class DbRole implements RoleInterface, HierarchicalRoleInterface
+{    
+    /**
+     * @var TypeRole
+     */
+    protected $typeRole;
+    
+    /**
+     * @var Structure
+     */
+    protected $structure;
+    
+    /**
+     * @var string
+     */
+    protected $roleId;
+    
+    /**
+     * @var DbRole
+     */
+    protected $parent;
+    
+    /**
+     * Constructeur.
+     * 
+     * @param TypeRole $typeRole
+     * @param Structure $structure
+     */
+    public function __construct(TypeRole $typeRole, Structure $structure, DbRole $parent = null)
+    {
+        $this->typeRole  = $typeRole;
+        $this->structure = $structure;
+        $this->parent    = $parent;
+    }
+    
+    /**
+     * Retourne la représentation littérale de cet objet.
+     * 
+     * @return string
+     */
+    public function __toString()
+    {
+        return sprintf("%s (%s)", $this->getTypeRole(), $this->getStructure());
+    }
+    
+    /**
+     * Returns the string identifier of the Role
+     *
+     * @return string
+     */
+    public function getRoleId()
+    {
+        if (null === $this->roleId) {
+            $this->roleId = static::createRoleId($this->getTypeRole(), $this->getStructure());
+        }
+        return $this->roleId;
+    }
+    
+    /**
+     * Fabrique un id de rôle au format utilisé par cette classe de rôle.
+     * 
+     * @param \Application\Entity\Db\TypeRole $typeRole
+     * @param \Application\Entity\Db\Structure $structure
+     * @return string
+     */
+    static public function createRoleId(TypeRole $typeRole, Structure $structure)
+    {
+        return sprintf("%s_%s", $typeRole->getCode(), $structure->getSourceCode());
+    }
+    
+    /**
+     * Get the parent role
+     *
+     * @return \Zend\Permissions\Acl\Role\RoleInterface|null
+     */
+    public function getParent()
+    {
+        return $this->parent;
+    }
+    
+    /**
+     * 
+     * @return TypeRole
+     */
+    public function getTypeRole()
+    {
+        return $this->typeRole;
+    }
+
+    /**
+     * 
+     * @return Structure
+     */
+    public function getStructure()
+    {
+        return $this->structure;
+    }
+
+    /**
+     * 
+     * @param \Application\Entity\Db\TypeRole $typeRole
+     * @return \Application\Provider\Role\DbRole
+     */
+    public function setTypeRole(TypeRole $typeRole)
+    {
+        $this->typeRole = $typeRole;
+        return $this;
+    }
+
+    /**
+     * 
+     * @param \Application\Entity\Db\Structure $structure
+     * @return \Application\Provider\Role\DbRole
+     */
+    public function setStructure(Structure $structure)
+    {
+        $this->structure = $structure;
+        return $this;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/IntervenantRole.php b/module/Application/src/Application/Acl/IntervenantRole.php
new file mode 100644
index 0000000000000000000000000000000000000000..f172978655387f2194e8a36e270bdd20bf391cd0
--- /dev/null
+++ b/module/Application/src/Application/Acl/IntervenantRole.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Application\Acl;
+
+use UnicaenAuth\Acl\NamedRole;
+
+/**
+ * Description of IntervenantRole
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class IntervenantRole extends NamedRole
+{
+    const ROLE_ID = "intervenant";
+    
+    /**
+     * Constructeur.
+     * 
+     * @param string|null               $id
+     * @param RoleInterface|string|null $parent
+     * @param string                    $name
+     * @param string                    $description
+     * @param bool                      $selectable
+     */
+    public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true)
+    {
+        parent::__construct($id = self::ROLE_ID, $parent = 'user', $name = "Intervenant", $description, $selectable);
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Controller/DemoController.php b/module/Application/src/Application/Controller/DemoController.php
index 8fc8ebdd4025d55e47dd4b256cb810b716bf8ebe..be0417a17d0eabcf2968a80c69679221d98eb246 100755
--- a/module/Application/src/Application/Controller/DemoController.php
+++ b/module/Application/src/Application/Controller/DemoController.php
@@ -44,7 +44,7 @@ class DemoController extends AbstractActionController
         
         return array('fs' => $fs);
     }
-
+    
     /**
      * 
      * @return \Zend\View\Model\ViewModel
diff --git a/module/Application/src/Application/Controller/IntervenantController.php b/module/Application/src/Application/Controller/IntervenantController.php
index fefcd2a8d0447bded884c95dcaaf4b7726d38659..fcc028638e5e74829444dbac80ac2d9466fe978c 100644
--- a/module/Application/src/Application/Controller/IntervenantController.php
+++ b/module/Application/src/Application/Controller/IntervenantController.php
@@ -61,7 +61,9 @@ class IntervenantController extends AbstractActionController
             $interv->setValue($f->filter($intervenant));
         }
         $form = new \Zend\Form\Form('search');
-        $form->setAttributes(array('class' => 'intervenant-rech'));
+        $form->setAttributes(array(
+            'action' => $this->getRequest()->getRequestUri(),
+            'class'  => 'intervenant-rech'));
         $form->add($interv);
         
         if ($this->getRequest()->isPost()) {
@@ -88,16 +90,8 @@ class IntervenantController extends AbstractActionController
         if (!($sourceCode = $this->params()->fromQuery('sourceCode', $this->params()->fromPost('sourceCode')))) {
             throw new LogicException("Aucun code source d'intervenant spécifié.");
         }
-        if (($intervenant = $this->intervenant()->getRepo()->findBySourceCode($sourceCode))) {
-            throw new RuntimeException("L'intervenant spécifié a déjà été importé : sourceCode = $sourceCode.");
-        }
         
-        $import = $this->getServiceLocator()->get('importProcessusImport'); /* @var $import \Import\Processus\Import */
-        $import->intervenant($sourceCode);
-
-        if (!($intervenant = $this->intervenant()->getRepo()->findOneBySourceCode($sourceCode))) {
-            throw new RuntimeException("L'intervenant suivant est introuvable après import : sourceCode = $sourceCode.");
-        }
+        $intervenant = $this->getServiceLocator()->get('ApplicationIntervenant')->importer($sourceCode);
         
         $view = new \Zend\View\Model\ViewModel();
         $view->setVariables(array('intervenant' => $intervenant));
diff --git a/module/Application/src/Application/Controller/Plugin/Context.php b/module/Application/src/Application/Controller/Plugin/Context.php
index 2327f44ce6444ac6a498e300f2a5fd336229c0b1..82481a1eae9f898428029974bb12292f4c34984d 100644
--- a/module/Application/src/Application/Controller/Plugin/Context.php
+++ b/module/Application/src/Application/Controller/Plugin/Context.php
@@ -222,12 +222,12 @@ class Context extends \Zend\Mvc\Controller\Plugin\Params implements ServiceLocat
     }
     
     /**
-     * @return \Application\Service\Context
+     * @return \Application\Service\GlobalContext
      */
     public function getGlobalContext()
     {
         if (null === $this->context) {
-            $this->context = $this->sl->get('ApplicationContext');
+            $this->context = $this->sl->get('ApplicationContextProvider')->getGlobalContext();
         }
         return $this->context;
     }
diff --git a/module/Application/src/Application/Controller/ServiceReferentielController.php b/module/Application/src/Application/Controller/ServiceReferentielController.php
index c8779b0602ce5b571ff8885fd236664f95de7e8f..587ab7fb6e6c854b46304ce4a1b717c5005faa9d 100644
--- a/module/Application/src/Application/Controller/ServiceReferentielController.php
+++ b/module/Application/src/Application/Controller/ServiceReferentielController.php
@@ -7,6 +7,8 @@ use Doctrine\Common\Collections\ArrayCollection;
 use Common\Exception\MessageException;
 use Common\Exception\RuntimeException;
 use Common\Exception\LogicException;
+use Application\Service\ContextProviderAwareInterface;
+use Application\Service\ContextProviderAwareTrait;
 use Application\Form\Service\Saisie;
 use Application\Entity\Db\ServiceReferentiel;
 use Application\Exception\DbException;
@@ -21,28 +23,49 @@ use Application\Form\ServiceReferentiel\FonctionServiceReferentielFieldset;
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class ServiceReferentielController extends AbstractActionController
+class ServiceReferentielController extends AbstractActionController implements ContextProviderAwareInterface
 {
+    use ContextProviderAwareTrait;
+    
+    /**
+     * @return \Application\Service\ServiceReferentiel
+     */
+    public function getContextProvider()
+    {
+        return $this->getServiceLocator()->get('ApplicationContextProvider');
+    }
+    
     /**
-     * @return \Application\Service\Service
+     * @return \Application\Service\ServiceReferentiel
      */
-    public function getServiceReferentielService()
+    public function getServiceServiceReferentiel()
     {
         return $this->getServiceLocator()->get('ApplicationServiceReferentiel');
     }
+    
+    /**
+     * @return \Application\Service\Intervenant
+     */
+    public function getServiceIntervenant()
+    {
+        return $this->getServiceLocator()->get('ApplicationIntervenant');
+    }
 
     public function indexAction()
     {
-        $service  = $this->getServiceReferentielService();
-        $context  = $this->context()->getGlobalContext();
-        $qb       = $service->finderByContext($context);
-        $annee    = $context->getAnnee();
-        $services = $qb->getQuery()->execute();
+        $service  = $this->getServiceServiceReferentiel();
+        $cp       = $this->getContextProvider();
+        $annee    = $cp->getGlobalContext()->getAnnee();
+        $criteria = array();
+//        $criteria = array('structure' => $this->em()->find('Application\Entity\Db\Structure', 8494));
+        $services = $service->getFinder($criteria)
+                ->orderBy("i.nomUsuel, s.libelleCourt")
+                ->getQuery()->execute();
         
         $listeViewModel = new \Zend\View\Model\ViewModel();
         $listeViewModel
                 ->setTemplate('application/service-referentiel/voir-liste')
-                ->setVariables(compact('services', 'context'));
+                ->setVariables(compact('services'));
         
         $viewModel = new \Zend\View\Model\ViewModel();
         $viewModel
@@ -54,7 +77,7 @@ class ServiceReferentielController extends AbstractActionController
 
     public function voirAction()
     {
-        $service = $this->getServiceReferentielService();
+        $service = $this->getServiceServiceReferentiel();
         if (!($id = $this->params()->fromRoute('id', $this->params()->fromPost('id')))) {
             throw new LogicException("Aucun identifiant de service spécifié.");
         }
@@ -67,13 +90,14 @@ class ServiceReferentielController extends AbstractActionController
 
     public function voirListeAction()
     {
-        $service  = $this->getServiceReferentielService();
-        $context  = $this->context()->getGlobalContext();
-        $qb       = $service->finderByContext($context);
-        $annee    = $context->getAnnee();
-        $services = $qb->getQuery()->execute();
+        $service  = $this->getServiceServiceReferentiel();
+        $criteria = array();
+//        $criteria = array('structure' => $this->em()->find('Application\Entity\Db\Structure', 8474));
+        $services = $service->getFinder($criteria)
+                ->orderBy("i.nomUsuel, s.libelleCourt")
+                ->getQuery()->execute();
         
-        return compact('annee', 'services', 'context');
+        return compact('services');
     }
 
     public function voirLigneAction()
@@ -81,7 +105,7 @@ class ServiceReferentielController extends AbstractActionController
         $id      = (int)$this->params()->fromRoute('id',0);
         $details = 1 == (int)$this->params()->fromQuery('details',0);
         $onlyContent = 1 == (int)$this->params()->fromQuery('only-content',0);
-        $service = $this->getServiceReferentielService();
+        $service = $this->getServiceServiceReferentiel();
         $entity  = $service->getRepo()->find($id);
         $context = $service->getGlobalContext();
         $details = false;
@@ -89,27 +113,30 @@ class ServiceReferentielController extends AbstractActionController
         return compact('entity', 'context', 'details', 'onlyContent');
     }
 
-    public function suppressionAction()
+    public function supprimerAction()
     {
-        $id      = (int)$this->params()->fromRoute('id',0);
-        $service = $this->getServiceReferentielService();
-        $entity  = $service->getRepo()->find($id);
-        $errors  = array();
+        $id        = $this->params()->fromRoute('id');
+        $entity    = $this->em()->find('Application\Entity\Db\ServiceReferentiel', $id);
+        $title     = "Suppression de service référentiel";
+        $form      = new \Application\Form\Supprimer('suppr');
+        $viewModel = new \Zend\View\Model\ViewModel();
 
-        try{
-            $entity->setHistoDestruction(new \DateTime);
-            $this->em()->flush();
-        }catch(\Exception $e){
-            $e = DbException::translate($e);
-            $errors[] = $e->getMessage();
+        $form->setAttribute('action', $this->getRequest()->getRequestUri());
+
+        if ($this->getRequest()->isPost()) {
+            $errors = array();
+            try {
+                $this->getServiceServiceReferentiel()->delete($entity);
+            }
+            catch (\Exception $e){
+                $e = DbException::translate($e);
+                $errors[] = $e->getMessage();
+            }
+            $viewModel->setVariable('errors', $errors);
         }
 
-        $terminal = $this->getRequest()->isXmlHttpRequest();
-        $viewModel = new \Zend\View\Model\ViewModel();
-        $viewModel
-                ->setTemplate('application/service/suppression')
-                ->setVariables(compact('entity', 'context','errors'));
-        
+        $viewModel->setVariables(compact('entity', 'title', 'form'));
+
         return $viewModel;
     }
 
@@ -121,7 +148,8 @@ class ServiceReferentielController extends AbstractActionController
      */
     protected function getIntervenant($import = true)
     {
-        $sourceCode = $this->params()->fromQuery('sourceCode');
+        $sourceCode  = $this->params()->fromQuery('sourceCode');
+        $intervenant = null;
         
         if ($sourceCode) {
             // test d'existence de l'intervenant et import éventuel
@@ -131,72 +159,86 @@ class ServiceReferentielController extends AbstractActionController
                     throw new RuntimeException("Intervenant spécifié introuvable (sourceCode = $sourceCode).");
                 }
                 // import de l'intervenant
-                $viewModel   = $this->importerAction(); /* @var $viewModel \Zend\View\Model\ViewModel */
-                $intervenant = $viewModel->getVariable('intervenant');
+                $intervenant = $this->getServiceLocator()->get('ApplicationIntervenant')->importer($sourceCode);
             }
             
             return $intervenant;
         }
         
-        $context = $this->context()->getGlobalContext();
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
         
-        if (!($intervenant = $context->getIntervenant())) {
-            throw new RuntimeException("Aucun intervenant spécifié dans le contexte.");
+        if ($role instanceof \Application\Acl\IntervenantRole) {
+            $intervenant = $context->getIntervenant();
         }
         
         return $intervenant;
     }
     
+    /**
+     * Redirection vers le choix d'un intervenant (action qui redirigera vers l'action 
+     * courante une fois l'intervenant choisi).
+     * 
+     * @param \Application\Entity\Db\Intervenant $intervenant Intervenant pré-choisi
+     * @return \Zend\Http\Response
+     */
+    protected function redirectToChoisirIntervenant(\Application\Entity\Db\Intervenant $intervenant = null)
+    {
+        $modal    = $this->params()->fromQuery('modal');
+        $redirect = $this->url()->fromRoute(
+                null, 
+                array(), 
+                array('query' => array('sourceCode' => '__sourceCode__', 'modal' => $modal)), 
+                true);
+        
+        if ($intervenant) {
+           $intervenant = $intervenant->getSourceCode();
+        }
+        
+        return $this->redirect()->toRoute(
+                'intervenant/default', 
+                array('action' => 'choisir'), 
+                array('query' => array('intervenant' => $intervenant, 'redirect' => $redirect, 'modal' => $modal)));
+    }
+    
     /**
      * 
      * @return \Zend\View\Model\ViewModel
      */
     public function saisirAction()
     {
-        $sourceCode  = $this->params()->fromQuery('sourceCode');
         $import      = $this->params()->fromQuery('import', true);
-        $service     = $this->getServiceReferentielService();
-        $context     = $this->context()->getGlobalContext();
+        $context     = $this->getContextProvider()->getGlobalContext();
         $isAjax      = $this->getRequest()->isXmlHttpRequest();
         $intervenant = $this->getIntervenant($import);
         
         // si aucun intervenant spécifié, redirection vers le choix d'un intervenant (action qui redirigera ici une fois l'intervenant choisi)
         if (!$intervenant) {
-            if ($isAjax) {
-                throw new RuntimeException("Aucun intervenant spécifié.");
-            }
-            $redirect = $this->url()->fromRoute('intervenant/default', array(), array('query' => array('sourceCode' => '__sourceCode__')), true);
-            return $this->redirect()->toRoute(
-                    'intervenant/default', array('action' => 'choisir'), array('query' => array('redirect' => $redirect)));
+            return $this->redirectToChoisirIntervenant();
         }
         
-        // verif type d'intervenant
-        if (!$intervenant instanceof IntervenantPermanent) {
-            $message = "La saisie de service référentiel n'est possible que pour les intervenants permanents.";
-            if ($isAjax) {
-                throw new MessageException($message);
-            }
+        // verifications concernant l'intervenant
+        try {
+            $this->getServiceIntervenant()->checkIntervenantForServiceReferentiel($intervenant);
+        }
+        catch (\Common\Exception\DomainException $exc) {
+            $message = $exc->getMessage();
             $this->flashMessenger()->addErrorMessage($message);
-            $redirect = $this->url()->fromRoute('intervenant/default', array(), array('query' => array('sourceCode' => '__sourceCode__')), true);
-            return $this->redirect()->toRoute('intervenant/default', 
-                    array('action' => 'choisir'), 
-                    array('query' => array('intervenant' => $intervenant->getId(), 'redirect' => $redirect)));
+            
+            return $this->redirectToChoisirIntervenant($intervenant);
         }
         
-        // fetch avec jointures
-        $qb = $this->em()->getRepository('Application\Entity\Db\IntervenantPermanent')->createQueryBuilder('ip');
-        $qb
-                ->leftJoin('ip.serviceReferentiel', 'sr')
-                ->leftJoin('sr.fonction', 'fr')
-                ->where('ip.id = :id')
-                ->orderBy('sr.id')
-                ->setParameter('id', $intervenant->getId()); /* @var $intervenant IntervenantPermanent */
-        $intervenant = $qb->getQuery()->getOneOrNullResult();
-        
         $this->em()->getFilters()->enable("historique");
+//        var_dump(get_class($intervenant));
+        
+        // fetch intervenant avec jointures
+        $qb = $this->getServiceIntervenant()->getFinderIntervenantPermanentWithServiceReferentiel();
+        $qb->setIntervenant($intervenant);
+        $intervenant = $qb->getQuery()->getOneOrNullResult();
+//                var_dump($qb->getQuery()->getDQL(), $qb->getQuery()->getParameters());
         
         $repoFonctionReferentiel = $this->em()->getRepository('Application\Entity\Db\FonctionReferentiel'); /* @var $repoFonctionReferentiel \Doctrine\ORM\EntityRepository */
-        $repoElementPedagogique  = $this->em()->getRepository('Application\Entity\Db\ElementPedagogique'); /* @var $repoElementPedagogique \Application\Entity\Db\Repository\ElementPedagogiqueRepository */
+        $repoElementPedagogique  = $this->em()->getRepository('Application\Entity\Db\ElementPedagogique');  /* @var $repoElementPedagogique \Application\Entity\Db\Repository\ElementPedagogiqueRepository */
 
         $annee = $context->getAnnee();
 
@@ -219,7 +261,7 @@ class ServiceReferentielController extends AbstractActionController
         }
         
         $form = new \Application\Form\ServiceReferentiel\AjouterModifier();
-        $form->setAttribute('action', $this->url()->fromRoute(null, array(), array(), true));
+        $form->setAttribute('action', $this->getRequest()->getRequestUri());
         $form->getBaseFieldset()->getHydrator()->setAnnee($annee);
         $form->bind($intervenant);
         
diff --git a/module/Application/src/Application/Entity/Db/Finder/AbstractFinder.php b/module/Application/src/Application/Entity/Db/Finder/AbstractFinder.php
new file mode 100644
index 0000000000000000000000000000000000000000..97991c80d071865751335f49ccbf92b0f26f04c6
--- /dev/null
+++ b/module/Application/src/Application/Entity/Db/Finder/AbstractFinder.php
@@ -0,0 +1,64 @@
+<?php
+
+namespace Application\Entity\Db\Finder;
+
+use Doctrine\ORM\EntityManager;
+use Doctrine\ORM\Query;
+use Doctrine\ORM\QueryBuilder;
+use Application\Service\ContextProviderAwareTrait;
+use Application\Service\ContextProvider;
+
+/**
+ * Description of Intervenant
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+abstract class AbstractFinder extends QueryBuilder
+{
+    use ContextProviderAwareTrait;
+    
+    protected $queryCreated         = false;
+    protected $globalContextApplied = false;
+    
+    /**
+     * 
+     * @param EntityManager $em
+     * @param ContextProvider $contextProvider
+     */
+    public function __construct(EntityManager $em, ContextProvider $contextProvider = null)
+    {
+        parent::__construct($em);
+        
+        $this->setContextProvider($contextProvider);
+    }
+    
+    /**
+     * 
+     * @return self
+     */
+    abstract protected function createQuery();
+    
+    /**
+     * 
+     * @return self
+     */
+    abstract protected function applyGlobalContext();
+    
+    /**
+     * 
+     * @return Query
+     */
+    public function getQuery()
+    {
+        if (!$this->queryCreated) {
+            $this->createQuery();
+            $this->queryCreated = true;
+        }
+        if (!$this->globalContextApplied) {
+            $this->applyGlobalContext();
+            $this->globalContextApplied = true;
+        }
+        
+        return parent::getQuery();
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php b/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php
new file mode 100644
index 0000000000000000000000000000000000000000..8866cd5c0775bd8195d0e8b0d4874e0ba776fa03
--- /dev/null
+++ b/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php
@@ -0,0 +1,84 @@
+<?php
+
+namespace Application\Entity\Db\Finder;
+
+use Application\Acl\DbRole;
+use Application\Acl\IntervenantRole;
+use Application\Entity\Db\IntervenantPermanent;
+
+/**
+ * Requêteur contextualisé d'intervenants permanents.
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ * @see \Application\Service\ContextProvider
+ */
+class FinderIntervenantPermanentWithServiceReferentiel extends AbstractFinder
+{
+    /**
+     * 
+     * @param int|IntervenantPermanent $intervenant
+     * @return self
+     */
+    public function setIntervenant($intervenant)
+    {
+        if ($intervenant instanceof IntervenantPermanent) {
+            $intervenant = $intervenant->getId();
+        }
+        
+        $this
+                ->andWhere('i.id = :id')
+                ->setParameter('id', $intervenant);
+        
+        return $this;
+    }
+    
+    /**
+     * 
+     * @return self
+     */
+    protected function createQuery()
+    {
+        $this
+                ->select('i')
+                ->from('Application\Entity\Db\IntervenantPermanent', 'i')
+                ->leftJoin('i.serviceReferentiel', 'sr')
+                ->leftJoin('sr.fonction', 'fr')
+                ->leftJoin('sr.structure', 's')
+                ->orderBy('s.libelleCourt');
+        
+        return $this;
+    }
+    
+    /**
+     * 
+     * @return self
+     */
+    protected function applyGlobalContext()
+    {
+        if (!$this->getContextProvider()) {
+            return $this;
+        }
+        
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
+        if ($role instanceof IntervenantRole) {
+//            $this
+//                    ->andWhere("sr.intervenant = :intervenant")
+//                    ->setParameter('intervenant', $context->getIntervenant());
+        }
+        elseif ($role instanceof DbRole) {
+            $this
+                    ->andWhere("sr.structure = :structureResp")
+                    ->setParameter('structureResp', $role->getStructure());
+        }
+        
+        if (($annee = $context->getAnnee())) {
+            $this
+                    ->andWhere("sr.annee = :annee or sr.annee is null") // because left join
+                    ->setParameter('annee', $annee);
+        }
+        
+        return $this;
+    }   
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php b/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php
new file mode 100644
index 0000000000000000000000000000000000000000..4ea18772ea2c814ab7fea9c7d0292d038b4cc7a4
--- /dev/null
+++ b/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php
@@ -0,0 +1,66 @@
+<?php
+
+namespace Application\Entity\Db\Finder;
+
+use Application\Acl\DbRole;
+use Application\Acl\IntervenantRole;
+
+/**
+ * Requêteur contextualisé de services référentiels.
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ * @see \Application\Service\ContextProvider
+ */
+class FinderServiceReferentiel extends AbstractFinder
+{
+    /**
+     * 
+     * @return self
+     */
+    protected function createQuery()
+    {
+        $this
+                ->select('sr')
+                ->from("Application\Entity\Db\ServiceReferentiel", 'sr')
+                ->join("sr.structure", 's')
+                ->join("sr.intervenant", 'i')
+                ->join("sr.fonction", 'f')
+                ->orderBy("i.nomUsuel, s.libelleCourt");
+        
+        return $this;
+    }
+    
+    /**
+     * 
+     * @return self
+     */
+    protected function applyGlobalContext()
+    {
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
+        if ($role instanceof IntervenantRole) {
+            $this
+                    ->andWhere("sr.intervenant = :intervenant")
+                    ->setParameter('intervenant', $context->getIntervenant());
+        }
+        elseif ($role instanceof DbRole) {
+            $e = $this->expr()->orX(
+                    "sr.structure     = :structureResp", 
+                    "s2.structureNiv2 = :structureResp"
+            );
+            $this
+                    ->join("i.structure", 's2')
+                    ->andWhere($e)
+                    ->setParameter('structureResp', $role->getStructure());
+        }
+        
+        if (($annee = $context->getAnnee())) {
+            $this
+                    ->andWhere("sr.annee = :annee")
+                    ->setParameter('annee', $annee);
+        }
+        
+        return $this;
+    }   
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml
index 35af21769b83b91770cfceba7f4290050d83fb7f..7cfc603d4a37f7d6548e5c03cf51c9c0955e3e5d 100644
--- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml
+++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Personnel.dcm.xml
@@ -55,5 +55,6 @@
         <join-column name="CIVILITE_ID" referenced-column-name="ID"/>
       </join-columns>
     </many-to-one>
+    <one-to-many field="role" target-entity="Application\Entity\Db\Role" mapped-by="personnel" />
   </entity>
 </doctrine-mapping>
diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Service.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Service.dcm.xml
index 45aba4759c74d1a52ecf589585a2fe59408db70d..8bca68ed4620e760f3057d3dbcef592dec5c8be9 100644
--- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Service.dcm.xml
+++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Service.dcm.xml
@@ -68,7 +68,8 @@
         <join-column name="ANNEE_ID" referenced-column-name="ID"/>
       </join-columns>
     </many-to-one>
-    <!-- NB: Ajout de la relation Volume horaire à la main -->
+    <!-- NB: Ajout de relations à la main -->
     <one-to-many field="volumeHoraire" target-entity="Application\Entity\Db\VolumeHoraire" mapped-by="service" />
+    <one-to-many field="validationService" target-entity="Application\Entity\Db\ValidationService" mapped-by="service" />
   </entity>
 </doctrine-mapping>
diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeRole.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeRole.dcm.xml
index 24a23156ca75a771457ad1e8b1b93c585b565eed..1b60f5aeedc3481834675859d1013f8e8c523176 100644
--- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeRole.dcm.xml
+++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.TypeRole.dcm.xml
@@ -34,5 +34,6 @@
         <join-column name="HISTO_CREATEUR_ID" referenced-column-name="ID"/>
       </join-columns>
     </many-to-one>
+    <one-to-many field="role" target-entity="Application\Entity\Db\Role" mapped-by="type" />
   </entity>
 </doctrine-mapping>
diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ValidationService.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ValidationService.dcm.xml
new file mode 100644
index 0000000000000000000000000000000000000000..e20024de0372861c48586398c1d40c9449b87e8f
--- /dev/null
+++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.ValidationService.dcm.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
+  <entity name="Application\Entity\Db\ValidationService" table="VALIDATION_SERVICE">
+    <indexes>
+      <index name="IDX_E59109EDE8EF239" columns="SERVICE_ID"/>
+      <index name="IDX_E59109E59860CDC" columns="HISTO_CREATEUR_ID"/>
+      <index name="IDX_E59109E7E9E2204" columns="HISTO_DESTRUCTEUR_ID"/>
+      <index name="IDX_E59109E63F06898" columns="HISTO_MODIFICATEUR_ID"/>
+    </indexes>
+    <id name="id" type="integer" column="ID">
+      <generator strategy="SEQUENCE"/>
+    </id>
+    <field name="commentaires" type="string" column="COMMENTAIRES" length="200" nullable="true"/>
+    <field name="dateConseil" type="datetime" column="DATE_CONSEIL" nullable="true"/>
+    <field name="description" type="string" column="DESCRIPTION" length="200" nullable="false"/>
+    <field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/>
+    <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/>
+    <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>
+    <field name="ordre" type="integer" column="ORDRE" nullable="true"/>
+    <many-to-one field="histoModificateur" target-entity="Application\Entity\Db\Utilisateur">
+      <join-columns>
+        <join-column name="HISTO_MODIFICATEUR_ID" referenced-column-name="ID"/>
+      </join-columns>
+    </many-to-one>
+    <many-to-one field="histoDestructeur" target-entity="Application\Entity\Db\Utilisateur">
+      <join-columns>
+        <join-column name="HISTO_DESTRUCTEUR_ID" referenced-column-name="ID"/>
+      </join-columns>
+    </many-to-one>
+    <many-to-one field="histoCreateur" target-entity="Application\Entity\Db\Utilisateur">
+      <join-columns>
+        <join-column name="HISTO_CREATEUR_ID" referenced-column-name="ID"/>
+      </join-columns>
+    </many-to-one>
+    <many-to-one field="service" target-entity="Application\Entity\Db\Service">
+      <join-columns>
+        <join-column name="SERVICE_ID" referenced-column-name="ID"/>
+      </join-columns>
+    </many-to-one>
+  </entity>
+</doctrine-mapping>
diff --git a/module/Application/src/Application/Entity/Db/Personnel.php b/module/Application/src/Application/Entity/Db/Personnel.php
index da80cf30822d4c4599b8f01422c7027009fc944f..59f9e11f7974dc02c3bf805cb01adde70060cc3b 100644
--- a/module/Application/src/Application/Entity/Db/Personnel.php
+++ b/module/Application/src/Application/Entity/Db/Personnel.php
@@ -2,33 +2,18 @@
 
 namespace Application\Entity\Db;
 
-use Doctrine\ORM\Mapping as ORM;
-
 /**
  * Personnel
  */
-class Personnel
+class Personnel implements HistoriqueAwareInterface
 {
+    use HistoriqueAwareTrait;
+    
     /**
      * @var string
      */
     protected $email;
 
-    /**
-     * @var \DateTime
-     */
-    protected $histoCreation;
-
-    /**
-     * @var \DateTime
-     */
-    protected $histoDestruction;
-
-    /**
-     * @var \DateTime
-     */
-    protected $histoModification;
-
     /**
      * @var string
      */
@@ -75,25 +60,22 @@ class Personnel
     protected $structure;
 
     /**
-     * @var \Application\Entity\Db\Utilisateur
-     */
-    protected $histoModificateur;
-
-    /**
-     * @var \Application\Entity\Db\Utilisateur
+     * @var \Application\Entity\Db\Civilite
      */
-    protected $histoDestructeur;
+    protected $civilite;
 
     /**
-     * @var \Application\Entity\Db\Utilisateur
+     * @var \Doctrine\Common\Collections\Collection
      */
-    protected $histoCreateur;
+    protected $role;
 
     /**
-     * @var \Application\Entity\Db\Civilite
+     * 
      */
-    protected $civilite;
-
+    public function __construct()
+    {
+        $this->role = new \Doctrine\Common\Collections\ArrayCollection();
+    }
 
     /**
      * Set email
@@ -118,75 +100,6 @@ class Personnel
         return $this->email;
     }
 
-    /**
-     * Set histoCreation
-     *
-     * @param \DateTime $histoCreation
-     * @return Personnel
-     */
-    public function setHistoCreation($histoCreation)
-    {
-        $this->histoCreation = $histoCreation;
-
-        return $this;
-    }
-
-    /**
-     * Get histoCreation
-     *
-     * @return \DateTime 
-     */
-    public function getHistoCreation()
-    {
-        return $this->histoCreation;
-    }
-
-    /**
-     * Set histoDestruction
-     *
-     * @param \DateTime $histoDestruction
-     * @return Personnel
-     */
-    public function setHistoDestruction($histoDestruction)
-    {
-        $this->histoDestruction = $histoDestruction;
-
-        return $this;
-    }
-
-    /**
-     * Get histoDestruction
-     *
-     * @return \DateTime 
-     */
-    public function getHistoDestruction()
-    {
-        return $this->histoDestruction;
-    }
-
-    /**
-     * Set histoModification
-     *
-     * @param \DateTime $histoModification
-     * @return Personnel
-     */
-    public function setHistoModification($histoModification)
-    {
-        $this->histoModification = $histoModification;
-
-        return $this;
-    }
-
-    /**
-     * Get histoModification
-     *
-     * @return \DateTime 
-     */
-    public function getHistoModification()
-    {
-        return $this->histoModification;
-    }
-
     /**
      * Set nomPatronymique
      *
@@ -382,94 +295,58 @@ class Personnel
     }
 
     /**
-     * Set histoModificateur
-     *
-     * @param \Application\Entity\Db\Utilisateur $histoModificateur
-     * @return Personnel
-     */
-    public function setHistoModificateur(\Application\Entity\Db\Utilisateur $histoModificateur = null)
-    {
-        $this->histoModificateur = $histoModificateur;
-
-        return $this;
-    }
-
-    /**
-     * Get histoModificateur
-     *
-     * @return \Application\Entity\Db\Utilisateur 
-     */
-    public function getHistoModificateur()
-    {
-        return $this->histoModificateur;
-    }
-
-    /**
-     * Set histoDestructeur
+     * Set civilite
      *
-     * @param \Application\Entity\Db\Utilisateur $histoDestructeur
+     * @param \Application\Entity\Db\Civilite $civilite
      * @return Personnel
      */
-    public function setHistoDestructeur(\Application\Entity\Db\Utilisateur $histoDestructeur = null)
+    public function setCivilite(\Application\Entity\Db\Civilite $civilite = null)
     {
-        $this->histoDestructeur = $histoDestructeur;
+        $this->civilite = $civilite;
 
         return $this;
     }
 
     /**
-     * Get histoDestructeur
+     * Get civilite
      *
-     * @return \Application\Entity\Db\Utilisateur 
+     * @return \Application\Entity\Db\Civilite 
      */
-    public function getHistoDestructeur()
+    public function getCivilite()
     {
-        return $this->histoDestructeur;
+        return $this->civilite;
     }
 
     /**
-     * Set histoCreateur
+     * Add role
      *
-     * @param \Application\Entity\Db\Utilisateur $histoCreateur
-     * @return Personnel
+     * @param \Application\Entity\Db\Role $role
+     * @return TypeRole
      */
-    public function setHistoCreateur(\Application\Entity\Db\Utilisateur $histoCreateur = null)
+    public function addRole(\Application\Entity\Db\Role $role)
     {
-        $this->histoCreateur = $histoCreateur;
+        $this->role[] = $role;
 
         return $this;
     }
 
     /**
-     * Get histoCreateur
-     *
-     * @return \Application\Entity\Db\Utilisateur 
-     */
-    public function getHistoCreateur()
-    {
-        return $this->histoCreateur;
-    }
-
-    /**
-     * Set civilite
+     * Remove role
      *
-     * @param \Application\Entity\Db\Civilite $civilite
-     * @return Personnel
+     * @param \Application\Entity\Db\Role $role
      */
-    public function setCivilite(\Application\Entity\Db\Civilite $civilite = null)
+    public function removeRole(\Application\Entity\Db\Role $role)
     {
-        $this->civilite = $civilite;
-
-        return $this;
+        $this->role->removeElement($role);
     }
 
     /**
-     * Get civilite
+     * Get role
      *
-     * @return \Application\Entity\Db\Civilite 
+     * @return \Doctrine\Common\Collections\Collection 
      */
-    public function getCivilite()
+    public function getRole()
     {
-        return $this->civilite;
+        return $this->role;
     }
 }
diff --git a/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php b/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php
index 9f0701b55c9dc04ae8e6c7735665db4fb86c38db..b5b3c1aef88e163792b6930581679d96f4e08ed5 100644
--- a/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php
+++ b/module/Application/src/Application/Entity/Db/Repository/IntervenantRepository.php
@@ -12,20 +12,6 @@ use Doctrine\ORM\EntityRepository;
  */
 class IntervenantRepository extends EntityRepository
 {
-    /**
-     * Recherche par :
-     * - id source exact (numéro Harpege ou autre), 
-     * - ou nom usuel (et prénom), 
-     * - ou nom patronymique (et prénom).
-     * 
-     * @param string $term
-     * @return \Application\Entity\Db\Intervenant[]
-     */
-    public function findByNomPrenomIdQueryBuilder($term)
-    {
-        
-    }
-    
     /**
      * Recherche par :
      * - id source exact (numéro Harpege ou autre), 
@@ -69,4 +55,4 @@ class IntervenantRepository extends EntityRepository
         
         return $qb->getQuery()->execute();
     }
-}
\ No newline at end of file
+}
diff --git a/module/Application/src/Application/Entity/Db/Repository/ServiceReferentielRepository.php b/module/Application/src/Application/Entity/Db/Repository/ServiceReferentielRepository.php
index ab9eefaf519790224eb836f88097b6c0a59a0191..a16dc1c36d465784b16f69b7b5b29a220546b804 100644
--- a/module/Application/src/Application/Entity/Db/Repository/ServiceReferentielRepository.php
+++ b/module/Application/src/Application/Entity/Db/Repository/ServiceReferentielRepository.php
@@ -3,11 +3,6 @@
 namespace Application\Entity\Db\Repository;
 
 use Doctrine\ORM\EntityRepository;
-use Common\Exception\RuntimeException;
-use Common\Exception\InvalidArgumentException;
-use Application\Entity\Db\Intervenant;
-use Application\Entity\Db\IntervenantPermanent;
-use Application\Entity\Db\Annee;
 
 /**
  * ServiceReferentielRepository
@@ -17,101 +12,5 @@ use Application\Entity\Db\Annee;
  */
 class ServiceReferentielRepository extends EntityRepository
 {
-    /**
-     * 
-     * @param \Application\Entity\Db\Intervenant $intervenant
-     * @param \Application\Entity\Db\Annee $annee
-     * @param type $data
-     * @return \Application\Entity\Db\Repository\ServiceReferentielRepository
-     */
-    public function createServiceReferentiel(Intervenant $intervenant, Annee $annee, $data)
-    {
-        $data = $this->normalizeServiceReferentielUpdateData($data);
-        
-        $sr = new \Application\Entity\Db\ServiceReferentiel();
-        $sr
-                ->setAnnee($annee)
-                ->setFonction($data['fonction'])
-                ->setHeures($data['heures'])
-                ->setIntervenant($intervenant);
-        
-        $intervenant->addServiceReferentiel($sr);
-        
-        $this->getEntityManager()->persist($sr);
-        
-        return $this;
-    }
     
-    /**
-     * 
-     * @param \Application\Entity\Db\Intervenant $intervenant
-     * @param \Application\Entity\Db\Annee $annee
-     * @return \Application\Entity\Db\Repository\ServiceReferentielRepository
-     * @throws InvalidArgumentException
-     */
-    public function updateServicesReferentiel(Intervenant $intervenant, Annee $annee, array $data = array())
-    {
-        if (!$intervenant instanceof IntervenantPermanent) {
-            throw new InvalidArgumentException("Impossible de saisir un service référentiel pour un intervenant autre que permanent. " .
-            "Intervenant spécifié : $intervenant (id = {$intervenant->getId()}).");
-        }
-        
-        $em = $this->getEntityManager();
-        
-        $em->getConnection()->beginTransaction();
-        try {
-            foreach ($intervenant->getServiceReferentiel($annee) as $serviceReferentiel) {
-                $intervenant->removeServiceReferentiel($serviceReferentiel);
-                $em->remove($serviceReferentiel);
-            }
-            $em->flush();
-            if ($data) {
-                foreach ($data as $value) {
-                    $this->createServiceReferentiel($intervenant, $annee, $value);
-                }
-                $em->flush();
-            }
-            $em->getConnection()->commit();
-        }
-        catch (\Exception $e) {
-            $em->getConnection()->rollback();
-            $em->close();
-            throw $e;
-        }
-                
-        return $this;
-    }
-    
-    /**
-     * 
-     * @param array $data
-     * @return array
-     * @throws InvalidArgumentException
-     * @throws RuntimeException
-     */
-    protected function normalizeServiceReferentielUpdateData($data)
-    {
-        if (!is_array($data)) {
-            throw new InvalidArgumentException("Un tableau est attendu.");
-        }
-        if (!isset($data[$key = 'fonction'])) {
-            throw new InvalidArgumentException("Clé '$key' introuvable dans les données spécifiées.");
-        }
-        if (!isset($data[$key = 'heures'])) {
-            throw new InvalidArgumentException("Clé '$key' introuvable dans les données spécifiées.");
-        }
-        
-        $fonctionId = $data['fonction'];
-        $heures     = $data['heures'];
-                   
-        $f = $this->getEntityManager()->getRepository('Application\Entity\Db\FonctionReferentiel')->find($fonctionId);
-        if (!$f) {
-            throw new RuntimeException("Fonction référentiel introuvable avec l'id '$fonctionId'.");
-        }
-        
-        return array(
-            'fonction' => $f,
-            'heures'   => (float) $heures,
-        );
-    }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Entity/Db/TypeRole.php b/module/Application/src/Application/Entity/Db/TypeRole.php
index 68103ad7415c0be1c7305a3f3572c276225dae0b..f504d17f8fd69c7ad3d116bfd1333ca5f7a81e29 100644
--- a/module/Application/src/Application/Entity/Db/TypeRole.php
+++ b/module/Application/src/Application/Entity/Db/TypeRole.php
@@ -11,26 +11,6 @@ class TypeRole implements HistoriqueAwareInterface, RoleInterface
 {
     use HistoriqueAwareTrait;
     
-    /**
-     * Returns the string identifier of the Role
-     *
-     * @return string
-     */
-    public function getRoleId()
-    {
-        return $this->getCode();
-    }
-    
-    /**
-     * Retourne la représentation littérale de cet objet.
-     * 
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->getLibelle();
-    }
-    
     /**
      * @var string
      */
@@ -61,6 +41,34 @@ class TypeRole implements HistoriqueAwareInterface, RoleInterface
      */
     protected $role;
 
+    /**
+     * 
+     */
+    public function __construct()
+    {
+        $this->role = new \Doctrine\Common\Collections\ArrayCollection();
+    }
+    
+    /**
+     * Returns the string identifier of the Role
+     *
+     * @return string
+     */
+    public function getRoleId()
+    {
+        return $this->getCode();
+    }
+    
+    /**
+     * Retourne la représentation littérale de cet objet.
+     * 
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->getLibelle();
+    }
+
     /**
      * Set code
      *
diff --git a/module/Application/src/Application/Entity/Db/Utilisateur.php b/module/Application/src/Application/Entity/Db/Utilisateur.php
index 6d381056937a1bf3a518209c1411e5b808749960..7b5c5f65bf621db7586217927b8dd0b805bb91bf 100644
--- a/module/Application/src/Application/Entity/Db/Utilisateur.php
+++ b/module/Application/src/Application/Entity/Db/Utilisateur.php
@@ -2,7 +2,6 @@
 
 namespace Application\Entity\Db;
 
-use Doctrine\ORM\Mapping as ORM;
 use BjyAuthorize\Provider\Role\ProviderInterface;
 use ZfcUser\Entity\UserInterface;
 
diff --git a/module/Application/src/Application/Entity/Db/ValidationService.php b/module/Application/src/Application/Entity/Db/ValidationService.php
new file mode 100644
index 0000000000000000000000000000000000000000..dcdad96193e3ca483d756b4aa93c8495cfeef507
--- /dev/null
+++ b/module/Application/src/Application/Entity/Db/ValidationService.php
@@ -0,0 +1,335 @@
+<?php
+
+namespace Application\Entity\Db;
+
+use Doctrine\ORM\Mapping as ORM;
+
+/**
+ * ValidationService
+ */
+class ValidationService implements HistoriqueAwareInterface
+{
+    /**
+     * @var string
+     */
+    protected $commentaires;
+
+    /**
+     * @var \DateTime
+     */
+    protected $dateConseil;
+
+    /**
+     * @var string
+     */
+    protected $description;
+
+    /**
+     * @var \DateTime
+     */
+    protected $histoCreation;
+
+    /**
+     * @var \DateTime
+     */
+    protected $histoDestruction;
+
+    /**
+     * @var \DateTime
+     */
+    protected $histoModification;
+
+    /**
+     * @var integer
+     */
+    protected $ordre;
+
+    /**
+     * @var integer
+     */
+    protected $id;
+
+    /**
+     * @var \Application\Entity\Db\Utilisateur
+     */
+    protected $histoModificateur;
+
+    /**
+     * @var \Application\Entity\Db\Utilisateur
+     */
+    protected $histoDestructeur;
+
+    /**
+     * @var \Application\Entity\Db\Utilisateur
+     */
+    protected $histoCreateur;
+
+    /**
+     * @var \Application\Entity\Db\Service
+     */
+    protected $service;
+
+
+    /**
+     * Set commentaires
+     *
+     * @param string $commentaires
+     * @return ValidationService
+     */
+    public function setCommentaires($commentaires)
+    {
+        $this->commentaires = $commentaires;
+
+        return $this;
+    }
+
+    /**
+     * Get commentaires
+     *
+     * @return string 
+     */
+    public function getCommentaires()
+    {
+        return $this->commentaires;
+    }
+
+    /**
+     * Set dateConseil
+     *
+     * @param \DateTime $dateConseil
+     * @return ValidationService
+     */
+    public function setDateConseil($dateConseil)
+    {
+        $this->dateConseil = $dateConseil;
+
+        return $this;
+    }
+
+    /**
+     * Get dateConseil
+     *
+     * @return \DateTime 
+     */
+    public function getDateConseil()
+    {
+        return $this->dateConseil;
+    }
+
+    /**
+     * Set description
+     *
+     * @param string $description
+     * @return ValidationService
+     */
+    public function setDescription($description)
+    {
+        $this->description = $description;
+
+        return $this;
+    }
+
+    /**
+     * Get description
+     *
+     * @return string 
+     */
+    public function getDescription()
+    {
+        return $this->description;
+    }
+
+    /**
+     * Set histoCreation
+     *
+     * @param \DateTime $histoCreation
+     * @return ValidationService
+     */
+    public function setHistoCreation($histoCreation)
+    {
+        $this->histoCreation = $histoCreation;
+
+        return $this;
+    }
+
+    /**
+     * Get histoCreation
+     *
+     * @return \DateTime 
+     */
+    public function getHistoCreation()
+    {
+        return $this->histoCreation;
+    }
+
+    /**
+     * Set histoDestruction
+     *
+     * @param \DateTime $histoDestruction
+     * @return ValidationService
+     */
+    public function setHistoDestruction($histoDestruction)
+    {
+        $this->histoDestruction = $histoDestruction;
+
+        return $this;
+    }
+
+    /**
+     * Get histoDestruction
+     *
+     * @return \DateTime 
+     */
+    public function getHistoDestruction()
+    {
+        return $this->histoDestruction;
+    }
+
+    /**
+     * Set histoModification
+     *
+     * @param \DateTime $histoModification
+     * @return ValidationService
+     */
+    public function setHistoModification($histoModification)
+    {
+        $this->histoModification = $histoModification;
+
+        return $this;
+    }
+
+    /**
+     * Get histoModification
+     *
+     * @return \DateTime 
+     */
+    public function getHistoModification()
+    {
+        return $this->histoModification;
+    }
+
+    /**
+     * Set ordre
+     *
+     * @param integer $ordre
+     * @return ValidationService
+     */
+    public function setOrdre($ordre)
+    {
+        $this->ordre = $ordre;
+
+        return $this;
+    }
+
+    /**
+     * Get ordre
+     *
+     * @return integer 
+     */
+    public function getOrdre()
+    {
+        return $this->ordre;
+    }
+
+    /**
+     * Get id
+     *
+     * @return integer 
+     */
+    public function getId()
+    {
+        return $this->id;
+    }
+
+    /**
+     * Set histoModificateur
+     *
+     * @param \Application\Entity\Db\Utilisateur $histoModificateur
+     * @return ValidationService
+     */
+    public function setHistoModificateur(\Application\Entity\Db\Utilisateur $histoModificateur = null)
+    {
+        $this->histoModificateur = $histoModificateur;
+
+        return $this;
+    }
+
+    /**
+     * Get histoModificateur
+     *
+     * @return \Application\Entity\Db\Utilisateur 
+     */
+    public function getHistoModificateur()
+    {
+        return $this->histoModificateur;
+    }
+
+    /**
+     * Set histoDestructeur
+     *
+     * @param \Application\Entity\Db\Utilisateur $histoDestructeur
+     * @return ValidationService
+     */
+    public function setHistoDestructeur(\Application\Entity\Db\Utilisateur $histoDestructeur = null)
+    {
+        $this->histoDestructeur = $histoDestructeur;
+
+        return $this;
+    }
+
+    /**
+     * Get histoDestructeur
+     *
+     * @return \Application\Entity\Db\Utilisateur 
+     */
+    public function getHistoDestructeur()
+    {
+        return $this->histoDestructeur;
+    }
+
+    /**
+     * Set histoCreateur
+     *
+     * @param \Application\Entity\Db\Utilisateur $histoCreateur
+     * @return ValidationService
+     */
+    public function setHistoCreateur(\Application\Entity\Db\Utilisateur $histoCreateur = null)
+    {
+        $this->histoCreateur = $histoCreateur;
+
+        return $this;
+    }
+
+    /**
+     * Get histoCreateur
+     *
+     * @return \Application\Entity\Db\Utilisateur 
+     */
+    public function getHistoCreateur()
+    {
+        return $this->histoCreateur;
+    }
+
+    /**
+     * Set service
+     *
+     * @param \Application\Entity\Db\Service $service
+     * @return ValidationService
+     */
+    public function setService(\Application\Entity\Db\Service $service = null)
+    {
+        $this->service = $service;
+
+        return $this;
+    }
+
+    /**
+     * Get service
+     *
+     * @return \Application\Entity\Db\Service 
+     */
+    public function getService()
+    {
+        return $this->service;
+    }
+}
diff --git a/module/Application/src/Application/Form/Service/Saisie.php b/module/Application/src/Application/Form/Service/Saisie.php
index 01870fa8c7fbc0692039b00b27f83e846503e220..0538ab557b508be5d740f84c4ec4ad707ea0a4f2 100644
--- a/module/Application/src/Application/Form/Service/Saisie.php
+++ b/module/Application/src/Application/Form/Service/Saisie.php
@@ -32,7 +32,9 @@ class Saisie extends Form implements \Zend\InputFilter\InputFilterProviderInterf
     {
         parent::__construct('service');
 
-        $this->etablissement = $serviceLocator->get('applicationContext')->etablissement;
+        $globalContext = $serviceLocator->get('ApplicationContextProvider')->getGlobalContext();
+        
+        $this->etablissement = $globalContext->getEtablissement();
 
         $this   ->setAttribute('method', 'post')
                 ->setAttribute('class', 'service')
diff --git a/module/Application/src/Application/Provider/Identity/IdentityProvider.php b/module/Application/src/Application/Provider/Identity/IdentityProvider.php
index 3e9aeea2ae2894b3238e74676035cdf662ba3448..9266a8602ed589eac7e5349a7b40d56e3b7b8e3b 100644
--- a/module/Application/src/Application/Provider/Identity/IdentityProvider.php
+++ b/module/Application/src/Application/Provider/Identity/IdentityProvider.php
@@ -1,20 +1,41 @@
 <?php
 namespace Application\Provider\Identity;
 
+use Zend\ServiceManager\ServiceLocatorAwareInterface;
+use Zend\ServiceManager\ServiceLocatorAwareTrait;
+use Doctrine\ORM\EntityManager;
 use UnicaenAuth\Provider\Identity\ChainableProvider;
+use UnicaenApp\Service\EntityManagerAwareInterface;
+use Application\Acl\IntervenantRole;
+use Application\Acl\DbRole;
+use UnicaenApp\Service\EntityManagerAwareTrait;
 
 /**
- * Classe de fournisseur d'identité issue de l'annuaire Ldap.
- * 
- * Retourne les rôles correspondant aux groupes LDAP auxquels appartient l'entité LDAP authentifiée.
- * NB : 
- * - Les ACL sont fournies par le service d'authorisation du module BjyAuthorize
- * - L'identité authentifiée est fournie par le service d'authentification.
+ * Classe chargée de fournir les rôles que possède l'identité authentifiée.
  *
  * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
  */
-class IdentityProvider implements ChainableProvider
+class IdentityProvider implements ServiceLocatorAwareInterface, ChainableProvider, EntityManagerAwareInterface
 {
+    use ServiceLocatorAwareTrait;
+    use EntityManagerAwareTrait;
+    
+    /**
+     * @var array
+     */
+    protected $roles;
+    
+    /**
+     * Constructeur.
+     * 
+     * @param EntityManager $entityManager
+     */
+    public function __construct(EntityManager $entityManager)
+    {
+        $this->setEntityManager($entityManager);
+        $this->getEntityManager()->getFilters()->enable('historique');
+    }
+    
     /**
      * {@inheritDoc}
      */
@@ -28,6 +49,47 @@ class IdentityProvider implements ChainableProvider
      */
     public function getIdentityRoles()
     {
-        return array('intervenant');
+        if (null === $this->roles) {
+            $this->roles = array();
+            
+            if (!$this->getServiceLocator()->get('AuthUserContext')->getIdentity()) {
+                return $this->roles;
+            }
+            
+            /**
+             * Rôles que possède l'utilisateur dans la base de données.
+             */
+            $this->roles = array_merge($this->roles, $this->getDbRoles());
+            
+            /**
+             * Tout le monde possède le rôle "intervenant"
+             */
+            $this->roles[] = new IntervenantRole();
+        }
+        
+//        var_dump($this->roles);
+        
+        return $this->roles;
+    }
+    
+    /**
+     * Fetch dans la base de données les rôles que possède l'utilisateur sur une structure précise.
+     * 
+     * @return array Id des rôles trouvés
+     */
+    protected function getDbRoles()
+    {
+        $dbUser = $this->getServiceLocator()->get('AuthUserContext')->getDbUser(); /* @var $dbUser \Application\Entity\Db\Utilisateur */
+        
+        if (!$dbUser) {
+            return array();
+        }
+        
+        $roles = array();
+        foreach ($dbUser->getPersonnel()->getRole() as $role) { /* @var $role \Application\Entity\Db\Role */
+            $roles[] = new DbRole($role->getType(), $role->getStructure());
+        }
+        
+        return $roles;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php b/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..12b1e9f1fab7a461349494a0da86401bad6d65e6
--- /dev/null
+++ b/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Application\Provider\Identity;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * 
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class IdentityProviderFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return Acteur
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $em = $serviceLocator->get('doctrine.entitymanager.orm_default'); /* @var $em \Doctrine\ORM\EntityManager */
+        
+        return new IdentityProvider($em);
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Provider/Role/RoleProvider.php b/module/Application/src/Application/Provider/Role/RoleProvider.php
index 1aac3f33cbcaea0163d75c825bea298936e52a3b..01968063e4db489a82eaa74692334bdf60de5d86 100644
--- a/module/Application/src/Application/Provider/Role/RoleProvider.php
+++ b/module/Application/src/Application/Provider/Role/RoleProvider.php
@@ -4,21 +4,21 @@ namespace Application\Provider\Role;
 
 use BjyAuthorize\Provider\Role\ProviderInterface;
 use Doctrine\ORM\EntityManager;
-use UnicaenAuth\Acl\NamedRole;
+use UnicaenApp\Service\EntityManagerAwareInterface;
+use UnicaenApp\Service\EntityManagerAwareTrait;
+use Application\Acl\IntervenantRole;
+use Application\Acl\DbRole;
 
 /**
- * Fournisseur de tous les rôles utilisateurs existants dans l'application.
+ * Fournisseur des rôles utilisateurs de l'application :
+ * - ceux définis dans la table TYPE_ROLE ;
+ * - rôle "intervenant".
  * 
  * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
  */
-class RoleProvider implements ProviderInterface
+class RoleProvider implements ProviderInterface, EntityManagerAwareInterface
 {
-    const ROLE_ID_INTERVENANT = 'Intervenant';
-    
-    /**
-     * @var EntityManager
-     */
-    protected $entityManager;
+    use EntityManagerAwareTrait;
     
     /**
      * @var array
@@ -31,28 +31,59 @@ class RoleProvider implements ProviderInterface
     protected $roles;
     
     /**
+     * Constructeur.
      * 
      * @param EntityManager $entityManager
      * @param array $config
      */
     public function __construct(EntityManager $entityManager, $config = null)
     {
-        $this->entityManager = $entityManager;
-        $this->config        = $config;
+        $this->setEntityManager($entityManager);
+        $this->getEntityManager()->getFilters()->enable('historique');
+        
+        $this->config = $config;
     }
     
     /**
      * @return \Zend\Permissions\Acl\Role\RoleInterface[]
+     * @see \Application\Entity\Db\TypeRole
      */
     public function getRoles()
     {
-        if (null === $this->roles) {
-            $roleIntervenant = new NamedRole(self::ROLE_ID_INTERVENANT, 'user');
+        if (null === $this->roles) {            
+            /**
+             * Rôle de base "intervenant"
+             */
+            $roleIntervenant = new IntervenantRole();
             
+            /**
+             * Rôles exercés sur une structure de niveau 2 porteuse d'éléments pédagogiques
+             */
+            $qb = $this->getEntityManager()->getRepository('Application\Entity\Db\Role')->createQueryBuilder('r')
+                    ->select('r, tr, s')
+                    ->distinct()
+                    ->innerJoin('r.type', 'tr')
+                    ->innerJoin('r.structure', 's')
+                    ->innerJoin('s.elementPedagogique', 'ep')
+                    ->where('tr.code <> :code')->setParameter('code', 'IND')
+                    ->andWhere('s.niveau = :niv')->setParameter('niv', 2);
+            $dbRoles = $qb->getQuery()->getResult();
+
+            /**
+             * Collecte des rôles
+             */
             $this->roles = array();
-//            $this->roles[] = $roleIntervenant;
+            $this->roles[$roleIntervenant->getRoleId()] = $roleIntervenant;
+            foreach ($dbRoles as $r) { /* @var $r \Application\Entity\Db\Role */
+                $role = new DbRole($r->getType(), $r->getStructure(), null);
+                $this->roles[$role->getRoleId()] = $role;
+            }
         }
         
+//        foreach ($this->roles as $r) { /* @var $r \Zend\Permissions\Acl\Role\RoleInterface */
+//            var_dump($r->getRoleId());
+//        }
+        
         return $this->roles;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/AbstractService.php b/module/Application/src/Application/Service/AbstractService.php
index 015be1e700815b8e353055f334fe8ece70b18aa2..e433406b2e1953916f012a2e3a99fb30a21b0c3f 100644
--- a/module/Application/src/Application/Service/AbstractService.php
+++ b/module/Application/src/Application/Service/AbstractService.php
@@ -3,9 +3,10 @@
 namespace Application\Service;
 
 use Doctrine\ORM\EntityManager;
-use Zend\ServiceManager\ServiceLocatorInterface;
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
+use UnicaenApp\Service\EntityManagerAwareInterface;
+use UnicaenApp\Service\EntityManagerAwareTrait;
 
 /**
  * Service abstrait
@@ -14,28 +15,21 @@ use Zend\ServiceManager\ServiceLocatorAwareTrait;
  *
  * @author Laurent Lécluse <laurent.lecluse at unicaen.fr>
  */
-class AbstractService implements ServiceLocatorAwareInterface {
-
+class AbstractService implements ServiceLocatorAwareInterface, EntityManagerAwareInterface
+{
     use ServiceLocatorAwareTrait;
-
-    /**
-     * @var EntityManager
-     */
-    protected $entityManager;
-
-
-
-
+    use EntityManagerAwareTrait;
 
     /**
      * Retourne le gestionnaire d'entités Doctrine
      *
      * @return EntityManager
      */
-    protected function getEntityManager()
+    public function getEntityManager()
     {
-        if (empty($this->entityManager))
+        if (empty($this->entityManager)) {
             $this->entityManager = $this->getServiceLocator()->get('doctrine.entitymanager.orm_default');
+        }
         return $this->entityManager;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/Context.php b/module/Application/src/Application/Service/Context.php
deleted file mode 100644
index 134a68a94d6860c4929696cc5b6221f7b8561b55..0000000000000000000000000000000000000000
--- a/module/Application/src/Application/Service/Context.php
+++ /dev/null
@@ -1,182 +0,0 @@
-<?php
-
-namespace Application\Service;
-
-use Application\Entity\Db\Annee;
-use Application\Entity\Db\Etablissement as EntityEtablissement;
-use Application\Entity\Db\Intervenant as EntityIntervenant;
-use Application\Entity\Db\Personnel;
-use Application\Entity\Db\Utilisateur;
-use Common\Exception\LogicException;
-use Zend\Stdlib\Hydrator\HydratorAwareInterface;
-use Zend\Stdlib\Hydrator\HydratorAwareTrait;
-use Zend\Stdlib\Hydrator\ClassMethods;
-
-/**
- * Service fournissant le contexte global de fonctionnement de l'application.
- *
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-class Context extends AbstractService implements HydratorAwareInterface
-{
-    use HydratorAwareTrait;
-    
-    /**
-     * @var Parametres
-     */
-    protected $parametres;
-    
-    /**
-     * @var Utilisateur
-     */
-    protected $utilisateur;
-    
-    /**
-     * @var EntityIntervenant
-     */
-    protected $intervenant;
-    
-    /**
-     * @var Personnel
-     */
-    protected $personnel;
-    
-    /**
-     * @var Annee
-     */
-    protected $annee;
-    
-    /**
-     * @var EntityEtablissement
-     */
-    protected $etablissement;
-    
-    /**
-     * Constructeur.
-     */
-    public function __construct()
-    {
-        $this->setHydrator(new ClassMethods(false));
-    }
-    
-//    public function toArray()
-//    {
-//        return array(
-//            'utilisateur'   => $this->getUtilisateur(),
-//            'intervenant'   => $this->getIntervenant(),
-//            'personnel'     => $this->getPersonnel(),
-//            'annee'         => $this->getAnnee(),
-//            'etablissement' => $this->getEtablissement(),
-//        );
-//    }
-    
-    public function set($name, $value)
-    {
-        if (!method_exists($this, $method = 'set' . ucfirst($name))) {
-            throw new LogicException("Méthode $method inexistante.");
-        }
-        
-        $this->$method($value);
-    }
-    
-    public function get($name)
-    {
-        if (method_exists($this, $method = 'get' . ucfirst($name))) {
-            return $this->$method();
-        }
-        
-        return null;
-    }
-    
-    public function __set($name, $value)
-    {
-        $this->set($name, $value);
-    }
-    
-    public function __get($name)
-    {
-        return $this->get($name);
-    }
-    
-    protected function getParametres()
-    {
-        if (null === $this->parametres) {
-            $this->parametres = $this->getServiceLocator()->get('ApplicationParametres');
-        }
-        return $this->parametres;
-    }
-    
-    public function getUtilisateur()
-    {
-        if (null === $this->utilisateur) {
-            $this->utilisateur = $this->getServiceLocator()->get('authUserContext')->getDbUser();
-        }
-        return $this->utilisateur;
-    }
-
-    public function getIntervenant()
-    {
-        if (null === $this->intervenant) {
-            $this->intervenant = $this->getUtilisateur()->getIntervenant();
-        }
-        return $this->intervenant;
-    }
-
-    public function getPersonnel()
-    {
-        if (null === $this->personnel) {
-            $this->personnel = $this->getUtilisateur()->getPersonnel();
-        }
-        return $this->personnel;
-    }
-
-    public function getAnnee()
-    {
-        if (null === $this->annee) {
-            $this->annee = $this->getEntityManager()->find(
-                    'Application\Entity\Db\Annee', 
-                    $this->getParametres()->annee);
-        }
-        return $this->annee;
-    }
-
-    public function getEtablissement()
-    {
-        if (null === $this->etablissement) {
-            $this->etablissement = $this->getEntityManager()->find(
-                    'Application\Entity\Db\Etablissement', 
-                    $this->getParametres()->etablissement);
-        }
-        return $this->etablissement;
-    }
-
-    public function setUtilisateur(Utilisateur $utilisateur)
-    {
-        $this->utilisateur = $utilisateur;
-        return $this;
-    }
-
-    public function setIntervenant(EntityIntervenant $intervenant)
-    {
-        $this->intervenant = $intervenant;
-        return $this;
-    }
-
-    public function setPersonnel(Personnel $personnel)
-    {
-        $this->personnel = $personnel;
-        return $this;
-    }
-
-    public function setAnnee(Annee $annee)
-    {
-        $this->annee = $annee;
-        return $this;
-    }
-
-    public function setEtablissement(EntityEtablissement $etablissement)
-    {
-        $this->etablissement = $etablissement;
-        return $this;
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextAwareInterface.php b/module/Application/src/Application/Service/ContextAwareInterface.php
deleted file mode 100644
index 55878647c150e7cad3bf292c4faf0e447cb42dfd..0000000000000000000000000000000000000000
--- a/module/Application/src/Application/Service/ContextAwareInterface.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<?php
-
-namespace Application\Service;
-
-use Application\Service\Context;
-
-/**
- *
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-interface ContextAwareInterface
-{
-    /**
-     * Retourne le service fournissant le context global de l'application.
-     *
-     * @return Context
-     */
-    public function getContext();
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextAwareTrait.php b/module/Application/src/Application/Service/ContextAwareTrait.php
deleted file mode 100644
index f0d80d97df3357c8ee3e5af1ef297328ea5fe0ba..0000000000000000000000000000000000000000
--- a/module/Application/src/Application/Service/ContextAwareTrait.php
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php
-
-namespace Application\Service;
-
-use Zend\ServiceManager\ServiceLocatorAwareInterface;
-use Zend\ServiceManager\AbstractPluginManager;
-use Application\Service\Context;
-
-/**
- *
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-trait ContextAwareTrait
-{
-    /**
-     * @var Context
-     */
-    protected $context;
-    
-    /**
-     * Retourne le service fournissant le context global de l'application.
-     *
-     * @return Context
-     */
-    public function getContext()
-    {
-        if (null === $this->context && $this instanceof ServiceLocatorAwareInterface) {
-            $sl = $this->getServiceLocator();
-            if ($sl instanceof AbstractPluginManager) {
-                $sl = $sl->getServiceLocator();
-            }
-            $this->context = $sl->get('ApplicationContext');
-        }
-        return $this->context;
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextProvider.php b/module/Application/src/Application/Service/ContextProvider.php
new file mode 100644
index 0000000000000000000000000000000000000000..6ef79f8f920c7dbf952a2dc1b3c5ac4c5915cffa
--- /dev/null
+++ b/module/Application/src/Application/Service/ContextProvider.php
@@ -0,0 +1,80 @@
+<?php
+
+namespace Application\Service;
+
+use Application\Service\Parametres;
+use Application\Acl\IntervenantRole;
+use Application\Acl\DbRole;
+
+/**
+ * Service fournissant les différents contextes de fonctionnement de l'application.
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class ContextProvider extends AbstractService
+{
+    /**
+     * @var Parametres
+     */
+    protected $parametres;
+    
+    /**
+     * @var GlobalContext
+     */
+    protected $globalContext;
+    
+    /**
+     * Retourne le contexte global.
+     * 
+     * @return GlobalContext
+     */
+    public function getGlobalContext()
+    {
+        if (null === $this->globalContext) {
+            $authUserContext = $this->getServiceLocator()->get('authUserContext');
+            
+            $utilisateur = $authUserContext->getDbUser();
+            $intervenant = $utilisateur->getIntervenant();
+            $personnel   = $utilisateur->getPersonnel();
+            $annee       = $this->getEntityManager()->find('Application\Entity\Db\Annee', $this->getParametres()->annee);
+            $etab        = $this->getEntityManager()->find('Application\Entity\Db\Etablissement', $this->getParametres()->etablissement);
+
+            if (null === $intervenant) {
+                $ldapUser = $authUserContext->getLdapUser();
+                $intervenant = $this->getServiceLocator()->get('ApplicationIntervenant')->importer($ldapUser->getSupannEmpId());
+            }
+            
+            $this->globalContext = new GlobalContext();
+            $this->globalContext
+                    ->setUtilisateur($utilisateur)
+                    ->setIntervenant($intervenant)
+                    ->setPersonnel($personnel)
+                    ->setAnnee($annee)
+                    ->setEtablissement($etab);
+        }
+        
+        return $this->globalContext;
+    }
+    
+    /**
+     * 
+     * @return DbRole|IntervenantRole
+     */
+    public function getSelectedIdentityRole()
+    {
+        return $this->getServiceLocator()->get('AuthUserContext')->getSelectedIdentityRole();
+    }
+    
+    /**
+     * 
+     * @return Parametres
+     */
+    protected function getParametres()
+    {
+        if (null === $this->parametres) {
+            $this->parametres = $this->getServiceLocator()->get('ApplicationParametres');
+        }
+        
+        return $this->parametres;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextProviderAwareInterface.php b/module/Application/src/Application/Service/ContextProviderAwareInterface.php
new file mode 100644
index 0000000000000000000000000000000000000000..2ea880f642dea1feb4aa448e7ddeed17caf2d587
--- /dev/null
+++ b/module/Application/src/Application/Service/ContextProviderAwareInterface.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Application\Service;
+
+use Application\Service\ContextProvider;
+
+/**
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+interface ContextProviderAwareInterface
+{
+    /**
+     * Spécifie le service fournissant le context global de l'application.
+     *
+     * @param ContextProvider $contextProvider
+     * @return self
+     */
+    public function setContextProvider(ContextProvider $contextProvider);
+    
+    /**
+     * Retourne le service fournissant le context global de l'application.
+     *
+     * @return ContextProvider
+     */
+    public function getContextProvider();
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextProviderAwareTrait.php b/module/Application/src/Application/Service/ContextProviderAwareTrait.php
new file mode 100644
index 0000000000000000000000000000000000000000..632fa8844134cbd0e533edd05a809cb9555580a8
--- /dev/null
+++ b/module/Application/src/Application/Service/ContextProviderAwareTrait.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Application\Service;
+
+use Application\Service\ContextProvider;
+
+/**
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+trait ContextProviderAwareTrait
+{
+    /**
+     * @var ContextProvider
+     */
+    protected $contextProvider;
+    
+    /**
+     * Spécifie le service fournissant le context global de l'application.
+     *
+     * @param ContextProvider $contextProvider
+     * @return self
+     */
+    public function setContextProvider(ContextProvider $contextProvider = null)
+    {
+        $this->contextProvider = $contextProvider;
+        
+        return $this;
+    }
+    
+    /**
+     * Retourne le service fournissant le context global de l'application.
+     *
+     * @return ContextProvider
+     */
+    public function getContextProvider()
+    {
+        return $this->contextProvider;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/GlobalContext.php b/module/Application/src/Application/Service/GlobalContext.php
new file mode 100644
index 0000000000000000000000000000000000000000..2c9f7f6ed26e1173466698132d7af4e094329b6c
--- /dev/null
+++ b/module/Application/src/Application/Service/GlobalContext.php
@@ -0,0 +1,111 @@
+<?php
+
+namespace Application\Service;
+
+use Application\Entity\Db\Annee;
+use Application\Entity\Db\Etablissement as EntityEtablissement;
+use Application\Entity\Db\Intervenant as EntityIntervenant;
+use Application\Entity\Db\Personnel;
+use Application\Entity\Db\Utilisateur;
+
+/**
+ * Classe regroupant les données globales de fonctionnement de l'application.
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class GlobalContext
+{
+    /**
+     * @var Parametres
+     */
+    protected $parametres;
+    
+    /**
+     * @var Utilisateur
+     */
+    protected $utilisateur;
+    
+    /**
+     * @var EntityIntervenant
+     */
+    protected $intervenant;
+    
+    /**
+     * @var Personnel
+     */
+    protected $personnel;
+    
+    /**
+     * @var Annee
+     */
+    protected $annee;
+    
+    /**
+     * @var EntityEtablissement
+     */
+    protected $etablissement;
+    
+    public function get($name)
+    {
+        if (method_exists($this, $method = 'get' . ucfirst($name))) {
+            return $this->$method();
+        }
+        
+        return null;
+    }
+    
+    public function getUtilisateur()
+    {
+        return $this->utilisateur;
+    }
+
+    public function getIntervenant()
+    {
+        return $this->intervenant;
+    }
+
+    public function getPersonnel()
+    {
+        return $this->personnel;
+    }
+
+    public function getAnnee()
+    {
+        return $this->annee;
+    }
+
+    public function getEtablissement()
+    {
+        return $this->etablissement;
+    }
+
+    public function setUtilisateur(Utilisateur $utilisateur)
+    {
+        $this->utilisateur = $utilisateur;
+        return $this;
+    }
+
+    public function setIntervenant(EntityIntervenant $intervenant)
+    {
+        $this->intervenant = $intervenant;
+        return $this;
+    }
+
+    public function setPersonnel(Personnel $personnel)
+    {
+        $this->personnel = $personnel;
+        return $this;
+    }
+
+    public function setAnnee(Annee $annee)
+    {
+        $this->annee = $annee;
+        return $this;
+    }
+
+    public function setEtablissement(EntityEtablissement $etablissement)
+    {
+        $this->etablissement = $etablissement;
+        return $this;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/Intervenant.php b/module/Application/src/Application/Service/Intervenant.php
index 5d04263e8120d9218ea08104f16d886769209988..eee43031d79b41b6e7c0716863ba8c578f389bcb 100644
--- a/module/Application/src/Application/Service/Intervenant.php
+++ b/module/Application/src/Application/Service/Intervenant.php
@@ -3,6 +3,9 @@
 namespace Application\Service;
 
 use Doctrine\ORM\QueryBuilder;
+use Application\Entity\Db\Intervenant as IntervenantEntity;
+use Application\Entity\Db\IntervenantPermanent;
+use Application\Entity\Db\Finder\FinderIntervenantPermanentWithServiceReferentiel;
 
 /**
  * Description of Intervenant
@@ -11,6 +14,50 @@ use Doctrine\ORM\QueryBuilder;
  */
 class Intervenant extends AbstractEntityService
 {
+    use \Application\Service\ContextProviderAwareTrait;
+    
+    /**
+     * 
+     * @return \Application\Entity\Db\Finder\FinderIntervenantPermanentWithServiceReferentiel
+     */
+    public function getFinderIntervenantPermanentWithServiceReferentiel()
+    {
+        $qb = new FinderIntervenantPermanentWithServiceReferentiel($this->getEntityManager(), $this->getContextProvider());
+
+        return $qb;
+    }
+    
+    /**
+     * 
+     * @param \Application\Entity\Db\Intervenant $intervenant
+     * @return \Application\Service\Intervenant
+     * @throws \Common\Exception\DomainException
+     */
+    public function checkIntervenantForServiceReferentiel(IntervenantEntity $intervenant)
+    {
+        // verif type d'intervenant
+        if (!$intervenant instanceof IntervenantPermanent) {
+            throw new \Common\Exception\DomainException(
+                    "La saisie de service référentiel n'est possible que pour les intervenants permanents.");
+        }
+        
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
+        if ($role instanceof \Application\Acl\DbRole) {
+            if ($intervenant->getStructure() !== $role->getStructure() 
+                    && $intervenant->getStructure()->getParenteNiv2() !== $role->getStructure()->getParenteNiv2()) {
+                throw new \Common\Exception\DomainException(
+                        sprintf("L'intervenant %s n'est pas affecté à votre structure de responsabilité (%s) ni à l'une de ses sous-structures.",
+                                $intervenant,
+                                $role->getStructure()));
+            }
+        }
+        
+        return $this;
+    }
+    
+    
 
     /**
      * retourne la classe des entités
@@ -31,6 +78,31 @@ class Intervenant extends AbstractEntityService
     public function getAlias(){
         return 'int';
     }
+    
+    /**
+     * Importe un intervenant non encore importé.
+     * 
+     * @param string $sourceCode Code source
+     * @return IntervenantEntity
+     * @throws RuntimeException Intervenant déjà importé ou introuvable après import
+     */
+    public function importer($sourceCode)
+    {
+        $repo = $this->getEntityManager()->getRepository($this->getEntityClass());
+        
+        if (($intervenant = $repo->findBySourceCode($sourceCode))) {
+            throw new RuntimeException("L'intervenant spécifié a déjà été importé : sourceCode = $sourceCode.");
+        }
+        
+        $import = $this->getServiceLocator()->get('importProcessusImport'); /* @var $import \Import\Processus\Import */
+        $import->intervenant($sourceCode);
+
+        if (!($intervenant = $repo->findOneBySourceCode($sourceCode))) {
+            throw new RuntimeException("L'intervenant suivant est introuvable après import : sourceCode = $sourceCode.");
+        }
+        
+        return $intervenant;
+    }
 
     /**
      * Retourne la liste des intervenants
@@ -46,4 +118,4 @@ class Intervenant extends AbstractEntityService
         return parent::getList($qb, $alias);
     }
 
-}
\ No newline at end of file
+}
diff --git a/module/Application/src/Application/Service/IntervenantFactory.php b/module/Application/src/Application/Service/IntervenantFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..130cc86bbb45ca3e85028e407cb472596007fa37
--- /dev/null
+++ b/module/Application/src/Application/Service/IntervenantFactory.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Application\Service;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of ServiceReferentielFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class IntervenantFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $service = new Intervenant();
+        $service->setEntityManager($serviceLocator->get('doctrine.entitymanager.orm_default'));
+        $service->setContextProvider($serviceLocator->get('ApplicationContextProvider'));
+        
+        return $service;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ServiceReferentiel.php b/module/Application/src/Application/Service/ServiceReferentiel.php
index 3974c20f4e97366a9bf11ab6558b7e77c722b523..797034b03fcb9f9c7d49d2265dc482e953323047 100644
--- a/module/Application/src/Application/Service/ServiceReferentiel.php
+++ b/module/Application/src/Application/Service/ServiceReferentiel.php
@@ -4,18 +4,93 @@ namespace Application\Service;
 
 use Doctrine\ORM\QueryBuilder;
 use Application\Entity\Db\ServiceReferentiel as ServiceEntity;
-
+use Application\Entity\Db\Finder\FinderServiceReferentiel;
 
 /**
  * Description of ServiceReferentiel
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class ServiceReferentiel extends AbstractEntityService
+class ServiceReferentiel extends AbstractService implements ContextProviderAwareInterface
 {
+    use ContextProviderAwareTrait;
+
+    /**
+     * Supprime (historise par défaut) le service spécifié.
+     *
+     * @param ServiceEntity $entity
+     * @param bool $softDelete 
+     * @return self
+     */
+    public function delete(ServiceEntity $entity, $softDelete = true)
+    {
+        if ($softDelete) {
+            $entity->setHistoDestruction(new \DateTime);
+        }
+        else {
+            $this->getEntityManager()->remove($entity);
+        }
+        
+        $this->getEntityManager()->flush($entity);
+        
+        return $this;
+    } 
+    
+    /**
+     * Retourne le requêteur des services référentiels contraint par les critères spécifiés.
+     *
+     * @param array $criteria
+     * @return FinderServiceReferentiel
+     */
+    public function getFinder(array $criteria = array())
+    {
+        $qb = new FinderServiceReferentiel($this->getEntityManager(), $this->getContextProvider());
+        
+        // application des critères locaux (filtrage par ex)
+        $this->applyLocalContext($qb, $criteria);
 
+        return $qb;
+    } 
+    
+    /**
+     * Applique le contexte local (filtres).
+     * 
+     * @param QueryBuilder $qb
+     * @param array $criteria
+     * @return self
+     */
+    public function applyLocalContext(QueryBuilder $qb, array $criteria = array())
+    {
+        if (isset($criteria['intervenant'])) {
+            $qb->andWhere("sr.intervenant = :intervenant")->setParameter('intervenant', $criteria['intervenant']);
+        }
+        if (isset($criteria['structure'])) {
+            $qb->andWhere("sr.structure = :structure")->setParameter('structure', $criteria['structure']);
+        }
+        
+        return $this;
+    }
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
+    
     /**
-     * retourne la classe des entités
+     * Retourne la classe des entités
      *
      * @return string
      * @throws RuntimeException
@@ -24,7 +99,7 @@ class ServiceReferentiel extends AbstractEntityService
     {
         return 'Application\Entity\Db\ServiceReferentiel';
     }
-
+    
     /**
      * Retourne l'alias d'entité courante
      *
@@ -41,9 +116,9 @@ class ServiceReferentiel extends AbstractEntityService
      * @param QueryBuilder|null $queryBuilder
      * @return QueryBuilder
      */
-    public function finderByContext(Context $context, QueryBuilder $qb = null, $alias=null)
+    public function finderByContext(Context $context, QueryBuilder $qb = null, $alias = null)
     {
-        list($qb,$alias) = $this->initQuery($qb, $alias);
+        list($qb, $alias) = $this->initQuery($qb, $alias);
 
         if (($intervenant = $context->getIntervenant())) {
             $qb->andWhere("$alias.intervenant = :intervenant")->setParameter('intervenant', $intervenant);
diff --git a/module/Application/src/Application/Service/ServiceReferentielFactory.php b/module/Application/src/Application/Service/ServiceReferentielFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..523a3f8c906b029849da009121aa5719315ae0b6
--- /dev/null
+++ b/module/Application/src/Application/Service/ServiceReferentielFactory.php
@@ -0,0 +1,29 @@
+<?php
+
+namespace Application\Service;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of ServiceReferentielFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class ServiceReferentielFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $service = new ServiceReferentiel();
+        $service->setEntityManager($serviceLocator->get('doctrine.entitymanager.orm_default'));
+        $service->setContextProvider($serviceLocator->get('ApplicationContextProvider'));
+        
+        return $service;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ValidationService.php b/module/Application/src/Application/Service/ValidationService.php
new file mode 100644
index 0000000000000000000000000000000000000000..baaac23d1e27ca10d0bfbc1e2e40aaf89e9fc96d
--- /dev/null
+++ b/module/Application/src/Application/Service/ValidationService.php
@@ -0,0 +1,16 @@
+<?php
+
+namespace Application\Service;
+
+/**
+ * Description of ValidationService
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class ValidationService extends AbstractService
+{
+    public function getServicesAValider()
+    {
+        
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/View/Helper/Service/Ligne.php b/module/Application/src/Application/View/Helper/Service/Ligne.php
index de5a4a94c413e92e9ad7def9b4a94852d784ce27..d576a7251a88b79e4f1d94276fd9bbd3e72f3444 100644
--- a/module/Application/src/Application/View/Helper/Service/Ligne.php
+++ b/module/Application/src/Application/View/Helper/Service/Ligne.php
@@ -6,17 +6,19 @@ use Zend\View\Helper\AbstractHelper;
 use Application\Entity\Db\Service;
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
+use Application\Service\ContextProviderAwareInterface;
+use Application\Service\ContextProviderAwareTrait;
 
 /**
  * Aide de vue permettant d'afficher une ligne de service
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface
+class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, ContextProviderAwareInterface
 {
-
     use ServiceLocatorAwareTrait;
-
+    use ContextProviderAwareTrait;
+    
     /**
      * @var Service
      */
@@ -29,10 +31,6 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface
      */
     protected $context;
 
-
-
-
-
     /**
      * Helper entry point.
      *
@@ -62,14 +60,19 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface
      * @param boolean $details
      * @return string
      */
-    public function render( $details=false ){
+    public function render( $details=false )
+    {
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
         $typesIntervention = $this->getServiceLocator()->getServiceLocator()->get('ApplicationTypeIntervention')->getTypesIntervention();
         $heures = $this->getServiceLocator()->getServiceLocator()->get('ApplicationService')->getTotalHeures($this->service);
 
         $sid = $this->service->getId();
 
         $out = '';
-        if (empty($this->context['intervenant'])){
+//        if (empty($this->context['intervenant'])){
+        if (!$role instanceof \Application\Acl\IntervenantRole) {
             $out .= '<td>'.$this->renderIntervenant($this->service->getIntervenant()).'</td>';
             if ($this->service->getIntervenant() instanceof Application\Entity\Db\IntervenantExterieur){
                 $out .= '<td>'.$this->renderStructure( $this->service->getStructureAff() )."</td>\n";
@@ -78,13 +81,15 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface
             }
             
         }
-        if ($this->service->getEtablissement() == $this->context['etablissement']){
+//        if ($this->service->getEtablissement() == $this->context['etablissement']){
+        if ($this->service->getEtablissement() === $context->getEtablissement()) {
             $out .= '<td>'.$this->renderStructure( $this->service->getStructureEns() )."</td>\n";
             $out .= '<td>'.$this->renderElementPedagogique( $this->service->getElementPedagogique() )."</td>\n";
         }else{
             $out .= '<td colspan="2">'.$this->renderEtablissement( $this->service->getEtablissement() )."</td>\n";
         }
-        if (empty($this->context['annee'])){
+//        if (empty($this->context['annee'])){
+        if (!$context->getAnnee()) {
             $out .= '<td>'.$this->renderAnnee( $this->service->getAnnee() )."</td>\n";
         }
         foreach( $typesIntervention as $ti ){
diff --git a/module/Application/src/Application/View/Helper/Service/LigneFactory.php b/module/Application/src/Application/View/Helper/Service/LigneFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..081067562c6b5777cfd266b9ba245bff5293d7ba
--- /dev/null
+++ b/module/Application/src/Application/View/Helper/Service/LigneFactory.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Application\View\Helper\Service;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of LigneFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class LigneFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $helper = new Ligne();
+        $helper->setContextProvider($serviceLocator->getServiceLocator()->get('ApplicationContextProvider'));
+        
+        return $helper;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/View/Helper/Service/Liste.php b/module/Application/src/Application/View/Helper/Service/Liste.php
index 4cf0bd1732ad0635fea96d11a7e61fa59e585a0e..9905a3eacb1241c5092cf00d122617178a36dcfa 100644
--- a/module/Application/src/Application/View/Helper/Service/Liste.php
+++ b/module/Application/src/Application/View/Helper/Service/Liste.php
@@ -6,17 +6,18 @@ use Zend\View\Helper\AbstractHelper;
 use Application\Entity\Db\Service;
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
+use Application\Service\ContextProviderAwareInterface;
+use Application\Service\ContextProviderAwareTrait;
 
 /**
  * Aide de vue permettant d'afficher une liste de services
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class Liste extends AbstractHelper implements ServiceLocatorAwareInterface
+class Liste extends AbstractHelper implements ServiceLocatorAwareInterface, ContextProviderAwareInterface
 {
-
     use ServiceLocatorAwareTrait;
-
+    use ContextProviderAwareTrait;
 
     /**
      * Helper entry point.
@@ -47,21 +48,27 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface
      *
      * @return string
      */
-    public function render( $details = false ){
+    public function render( $details = false )
+    {
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
         $typesIntervention = $this->getServiceLocator()->getServiceLocator()->get('ApplicationTypeIntervention')->getTypesIntervention();
         $colspan = 4;
         $out = $this->renderShowHide();
         $out .= '<table id="services" class="table service">';
         $out .= '<tr>';
 
-        if (empty($this->context['intervenant'])){
+//        if (empty($this->context['intervenant'])){
+        if (!$role instanceof \Application\Acl\IntervenantRole) {
             $out .= "<th>Intervenant</th>\n";
             $out .= "<th title=\"Structure d'appartenance de l'intervenant\">Structure d'affectation</th>\n";
             $colspan += 2;
         }
         $out .= "<th title=\"Structure gestionnaire de l'enseignement\">Structure d'enseignement</th>\n";
         $out .= "<th>Enseignement ou responsabilité</th>\n";
-        if (empty($this->context['annee'])){
+//        if (empty($this->context['annee'])){
+        if (!$context->getAnnee()) {
             $out .= "<th>Année univ.</th>\n";
             $colspan += 1;
         }
diff --git a/module/Application/src/Application/View/Helper/Service/ListeFactory.php b/module/Application/src/Application/View/Helper/Service/ListeFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..9f42fcc87ede3b2fe0b9f9eb6dfe44c94fad1e9b
--- /dev/null
+++ b/module/Application/src/Application/View/Helper/Service/ListeFactory.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Application\View\Helper\Service;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of ListeFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class ListeFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $helper = new Liste();
+        $helper->setContextProvider($serviceLocator->getServiceLocator()->get('ApplicationContextProvider'));
+        
+        return $helper;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/Dl.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/Dl.php
index 1066c5f7c4c45f9efe97c34bcc9716c2765fe316..4242f07e8c59010d6182cb198eef9bbaaa428b5a 100644
--- a/module/Application/src/Application/View/Helper/ServiceReferentiel/Dl.php
+++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/Dl.php
@@ -37,10 +37,12 @@ class Dl extends AbstractDl
 
         $identite = array();
 
-        $identite[] = sprintf($tplDtdd,
-            "Numéro :",
-            $this->entity->getId()
-        );
+        if (!$this->short) {
+            $identite[] = sprintf($tplDtdd,
+                "Numéro :",
+                $this->entity->getId()
+            );
+        }
 
         $identite[] = sprintf($tplDtdd,
             "Intervenant :",
@@ -75,8 +77,10 @@ class Dl extends AbstractDl
          * Historique
          */
 
-        $html .= $this->getView()->historiqueDl($this->entity, $this->horizontal);
-
+        if (!$this->short) {
+            $html .= $this->getView()->historiqueDl($this->entity, $this->horizontal);
+        }
+        
         return $html;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/Ligne.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/Ligne.php
index 74249824fa95d8be056a804e34e3e41a87a095a6..a57a7638d2ba5e00e6988f77b534a255a6280493 100644
--- a/module/Application/src/Application/View/Helper/ServiceReferentiel/Ligne.php
+++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/Ligne.php
@@ -6,19 +6,19 @@ use Zend\View\Helper\AbstractHelper;
 use Application\Entity\Db\ServiceReferentiel;
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
-use Application\Service\Context;
-use Application\Service\ContextAwareInterface;
-use Application\Service\ContextAwareTrait;
+use Application\Service\ContextProviderAwareInterface;
+use Application\Service\ContextProviderAwareTrait;
+use Application\Acl\IntervenantRole;
 
 /**
  * Aide de vue permettant d'afficher une ligne de service
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, ContextAwareInterface
+class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, ContextProviderAwareInterface
 {
     use ServiceLocatorAwareTrait;
-    use ContextAwareTrait;
+    use ContextProviderAwareTrait;
     
     /**
      * @var ServiceReferentiel
@@ -34,6 +34,7 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, Cont
     final public function __invoke(ServiceReferentiel $service)
     {
         $this->service = $service;
+        
         return $this;
     }
 
@@ -55,27 +56,40 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, Cont
      */
     public function render($details = false)
     {
-//        $typesIntervention = $this->getServiceLocator()->getServiceLocator()->get('ApplicationTypeIntervention')->getTypesIntervention();
-//        $heures = $this->getServiceLocator()->getServiceLocator()->get('ApplicationService')->getTotalHeures($this->service);
+        $parts = array();
+        
+        $parts['intervenant'] = '<td>' . $this->service->getIntervenant() . "</td>\n";
+        $parts[]              = '<td>' . $this->renderStructure($this->service->getStructure()) . "</td>\n";
+        $parts['annee']       = '<td>' . $this->renderAnnee($this->service->getAnnee()) . "</td>\n";
+        $parts[]              = '<td>' . $this->renderFonction($this->service->getFonction()) . "</td>\n";
+        $parts[]              = '<td>' . $this->renderHeures($this->service->getHeures()) . "</td>\n";
+
+        $parts[] = $this->renderModifier();
+        $parts[] = $this->renderSupprimer();
+        
+        $this->applyGlobalContext($parts);
+        
+        return implode(PHP_EOL, $parts);
+    }
 
-        $out = '';
-        if (!$this->getContext()->getIntervenant()) {
-            $out .= '<td>' . $this->service->getIntervenant() . "</td>\n";
-        }
-        if (!$this->getContext()->getStructure()) {
-            $out .= '<td>' . $this->renderStructure($this->service->getStructure()) . "</td>\n";
+    /**
+     * 
+     * @param array $parts
+     * @return self
+     */
+    public function applyGlobalContext(array &$parts)
+    {
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
+        if ($role instanceof IntervenantRole) {
+            unset($parts['intervenant']);
         }
-        if (!$this->getContext()->getAnnee()) {
-            $out .= '<td>' . $this->renderAnnee($this->service->getAnnee()) . "</td>\n";
+        if ($context->getAnnee()) {
+            unset($parts['annee']);
         }
-        $out .= '<td>' . $this->renderFonction($this->service->getFonction()) . "</td>\n";
-        $out .= '<td>' . $this->renderHeures($this->service->getHeures()) . "</td>\n";
-
-//        $out .= $this->renderModifier();
-//        $out .= $this->renderSupprimer();
-//        $out .= $this->renderDetails($details);
         
-        return $out;
+        return $this;
     }
 
     protected function renderStructure($structure)
@@ -118,24 +132,15 @@ class Ligne extends AbstractHelper implements ServiceLocatorAwareInterface, Cont
 
     protected function renderModifier()
     {
-        $url = $this->getView()->url('service-ref/default', array('action' => 'saisie', 'id' => $this->service->getId()));
-        return '<td><a class="ajax-modal" data-event="service-modify-message" href="' . $url . '" title="Modifier le service référentiel"><span class="glyphicon glyphicon-edit"></span></a></td>';
+        $query = array('sourceCode' => $this->service->getIntervenant()->getSourceCode());
+        $url = $this->getView()->url('service-ref/default', array('action' => 'saisir'), array('query' => $query));
+        return '<td><a class="ajax-modal" data-event="service-modify-message" href="' . $url . '" title="Modifier le service référentiel de ' . $this->service->getIntervenant() . '"><span class="glyphicon glyphicon-edit"></span></a></td>';
     }
 
     protected function renderSupprimer()
     {
-        $url = $this->getView()->url('service-ref/default', array('action' => 'suppression', 'id' => $this->service->getId())); //onclick="return ServiceReferentiel.get('.$this->service->getId().').delete(this)"
-        return '<td><a class="service-delete" data-id="' . $this->service->getId() . '" href="' . $url . '" title="Supprimer le service référentiel"><span class="glyphicon glyphicon-remove"></span></a></td>';
-    }
-
-    protected function renderDetails($details = false)
-    {
-        $out = '<td>'
-                . '<a class="service-details-button" title="Détails" onclick="ServiceReferentiel.get(' . $this->service->getId() . ').showHideDetails(this)">'
-                . '<span class="glyphicon glyphicon-chevron-' . ($details ? 'up' : 'down') . '"></span>'
-                . '</a>'
-                . "</td>\n";
-        return $out;
+        $url = $this->getView()->url('service-ref/default', array('action' => 'supprimer', 'id' => $this->service->getId()));
+        return '<td><a class="ajax-modal" data-event="service-delete-message" data-id="' . $this->service->getId() . '" href="' . $url . '" title="Supprimer ce service référentiel"><span class="glyphicon glyphicon-remove"></span></a></td>';
     }
 
     /**
diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/LigneFactory.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/LigneFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..6ba305cc013db53052e5a66c1e180ddeff55ed44
--- /dev/null
+++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/LigneFactory.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Application\View\Helper\ServiceReferentiel;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of LigneFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class LigneFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $helper = new Ligne();
+        $helper->setContextProvider($serviceLocator->getServiceLocator()->get('ApplicationContextProvider'));
+        
+        return $helper;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php
index 51bbae23e84177e340dcea31bb6f77a92b0cb5b1..e38dbf8bb12b2a4cfb8c4f39c5a1757a81d0ac8a 100644
--- a/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php
+++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/Liste.php
@@ -6,18 +6,19 @@ use Zend\View\Helper\AbstractHelper;
 use Application\Entity\Db\ServiceReferentiel;
 use Zend\ServiceManager\ServiceLocatorAwareInterface;
 use Zend\ServiceManager\ServiceLocatorAwareTrait;
-use Application\Service\ContextAwareInterface;
-use Application\Service\ContextAwareTrait;
+use Application\Service\ContextProviderAwareInterface;
+use Application\Service\ContextProviderAwareTrait;
+use Application\Acl\IntervenantRole;
 
 /**
  * Aide de vue permettant d'afficher une liste de services referentiels
  *
  * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
  */
-class Liste extends AbstractHelper implements ServiceLocatorAwareInterface, ContextAwareInterface
+class Liste extends AbstractHelper implements ServiceLocatorAwareInterface, ContextProviderAwareInterface
 {
     use ServiceLocatorAwareTrait;
-    use ContextAwareTrait;
+    use ContextProviderAwareTrait;
 
     protected $services;
     
@@ -31,6 +32,7 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface, Cont
     final public function __invoke(array $services)
     {
         $this->services = $services;
+        
         return $this;
     }
 
@@ -51,56 +53,57 @@ class Liste extends AbstractHelper implements ServiceLocatorAwareInterface, Cont
      */
     public function render($details = false)
     {
-//        $typesIntervention = $this->getServiceLocator()->getServiceLocator()->get('ApplicationTypeIntervention')->getTypesIntervention();
-
-        $colspan = 4;
-
-        $out = '';
-//        $out .= $this->renderShowHide();
-        $out .= '<table id="services-ref" class="table service-ref-ref">';
-        $out .= '<tr>';
-
-        if (!$this->getContext()->getIntervenant()) {
-            $out .= "<th colspan=\"2\">Intervenant</th>\n";
-            $colspan += 2;
-        }
-        $out .= "<th>Structure</th>\n";
-        $out .= "<th>Fonction référentielle</th>\n";
-        if (!$this->getContext()->getAnnee()) {
-            $out .= "<th>Année univ.</th>\n";
-            $colspan += 1;
-        }
-        $out .= "<th>Heures</th>\n";
-        $out .= "</tr>\n";
+        $urlSaisir    = $this->getView()->url('service-ref/default', array('action' => 'saisir'));
+        $urlVoirListe = $this->getView()->url('service-ref/default', array('action' => 'voirListe'));
+        $parts        = array();
+        
+        $parts[]              = '<table id="services-ref" class="table service-ref">';
+        $parts[]              = '<tr>';
+        $parts['intervenant'] = "<th>Intervenant</th>";
+        $parts[]              = "<th>Structure</th>";
+        $parts[]              = "<th>Fonction référentielle</th>";
+        $parts['annee']       = "<th>Année univ.</th>";
+        $parts[]              = "<th>Heures</th>";
+        $parts[]              = "<th class=\"action\" colspan=\"2\">&nbsp;</th>";
+        $parts[]              = "</tr>";
 
         foreach ($this->services as $service) {
-            $out .= '<tr id="service-ref-ref-' . $service->getId() . '-ligne">';
-            $out .= $this->getView()->serviceReferentielLigne($service)->render($details);
-            $out .= '</tr>';
-//            $out .= '<tr class="volume-horaire" id="service-ref-' . $service->getId() . '-volume-horaire-tr"' . ($details ? '' : ' style="display:none"') . '>'
-//                    . '<td class="volume-horaire" id="service-ref-' . $service->getId() . '-volume-horaire-td" colspan="' . $colspan . '">'
-//                    . $this->getView()->volumeHoraireListe($service->getVolumeHoraire(), array('service' => $service))->render()
-//                    . '</td>'
-//                    . '</tr>';
+            $parts[] = '<tr id="service-ref-' . $service->getId() . '-ligne">';
+            $parts[] = $this->getView()->serviceReferentielLigne($service)->render($details);
+            $parts[] = '</tr>';
         }
-        $out .= '</table>' . "\n";
-//        $out .= $this->renderShowHide();
+        
+        $parts[] = '</table>';
 
-        $url = $this->getView()->url('service-ref/default', array('action' => 'saisir'));
-        $out .= '<br /><a class="ajax-modal services-ref btn btn-default" data-event="service-ref-add-message" href="' . $url . '" title="Modifier le service référentiel"><span class="glyphicon glyphicon-edit"></span> Modifier le service référentiel</a>';
-        $out .= '<script type="text/javascript">';
-        $out .= '$(function() { ServiceReferentiel.init("' . $this->getView()->url('service-ref/default', array('action' => 'voirListe')) . '"); });';
-        $out .= '</script>';
-        return $out;
+        $parts[] = '<a class="ajax-modal services-ref btn btn-default" data-event="service-ref-add-message" href="' . $urlSaisir . '" title="Ajouter un service référentiel"><span class="glyphicon glyphicon-plus"></span> Saisir un nouveau service</a>';
+        
+        $parts[] = '<script type="text/javascript">';
+        $parts[] = '$(function() { ServiceReferentiel.init("' . $urlVoirListe . '"); });';
+        $parts[] = '</script>';
+        
+        $this->applyGlobalContext($parts);
+        
+        return implode(PHP_EOL, $parts);
     }
 
-    public function renderShowHide()
+    /**
+     * 
+     * @param array $parts
+     * @return self
+     */
+    public function applyGlobalContext(array &$parts)
     {
-        return
-                '<div class="service-ref-show-hide-buttons">'
-                . '<button type="button" class="btn btn-default btn-xs service-ref-show-all-details"><span class="glyphicon glyphicon-chevron-down"></span> Tout déplier</button> '
-                . '<button type="button" class="btn btn-default btn-xs service-ref-hide-all-details"><span class="glyphicon glyphicon-chevron-up"></span> Tout replier</button>'
-                . '</div>';
+        $context = $this->getContextProvider()->getGlobalContext();
+        $role    = $this->getContextProvider()->getSelectedIdentityRole();
+        
+        if ($role instanceof IntervenantRole) {
+            unset($parts['intervenant']);
+        }
+        if ($context->getAnnee()) {
+            unset($parts['annee']);
+        }
+        
+        return $this;
     }
 
     /**
diff --git a/module/Application/src/Application/View/Helper/ServiceReferentiel/ListeFactory.php b/module/Application/src/Application/View/Helper/ServiceReferentiel/ListeFactory.php
new file mode 100644
index 0000000000000000000000000000000000000000..ba6b423fc3571e896c151f78526eddf27db3909c
--- /dev/null
+++ b/module/Application/src/Application/View/Helper/ServiceReferentiel/ListeFactory.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Application\View\Helper\ServiceReferentiel;
+
+use Zend\ServiceManager\FactoryInterface;
+use Zend\ServiceManager\ServiceLocatorInterface;
+
+/**
+ * Description of ListeFactory
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class ListeFactory implements FactoryInterface
+{
+    /**
+     * Create service
+     *
+     * @param ServiceLocatorInterface $serviceLocator
+     * @return mixed
+     */
+    public function createService(ServiceLocatorInterface $serviceLocator)
+    {
+        $helper = new Liste();
+        $helper->setContextProvider($serviceLocator->getServiceLocator()->get('ApplicationContextProvider'));
+        
+        return $helper;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/view/application/intervenant/choisir.phtml b/module/Application/view/application/intervenant/choisir.phtml
index 2979bd8595f43b1969f2d96a1f4a4986825c5909..21b838075c67ed19401f1ab4adf18b370c4d54b1 100644
--- a/module/Application/view/application/intervenant/choisir.phtml
+++ b/module/Application/view/application/intervenant/choisir.phtml
@@ -11,6 +11,7 @@
 
 <script>
     $(function() {
-        $(":input").tooltip({ /*placement: 'left'*/ });
+        $("form.intervenant-rech :input").tooltip({ /*placement: 'left'*/ });
+        $("input[name='interv[label]']").focus();
     });
 </script>
\ No newline at end of file
diff --git a/module/Application/view/application/service-referentiel/index.phtml b/module/Application/view/application/service-referentiel/index.phtml
index 76a61cb70526079d2543d3df7c4e3c4d8cbd87f2..bf0f55f0bdf8a4959febb87e5dc9f617ae931d1a 100644
--- a/module/Application/view/application/service-referentiel/index.phtml
+++ b/module/Application/view/application/service-referentiel/index.phtml
@@ -1,29 +1,4 @@
 <h1>Services référentiels</h1>
 <h2>Année universitaire <?php echo $annee; ?></h2>
 
-<?php echo $this->serviceListe; ?>
-
-<script>
-    $(function() {
-        $("body").tooltip({
-            selector: '[rel=popover]',
-            placement: 'top',
-            title: "Cliquez pour ouvrir/fermer le formulaire de modification..."
-        });
-        $("body").popover({
-            selector: '[rel=popover]',
-            placement: 'bottom',
-            html: true,
-            title: "Modification d'heures ",
-            content: function() {
-                return $.ajax({
-                    url: "<?php echo $this->url('volume_horaire/default', array('action' => 'voir')) ?>/" + $(this).data('vhId'),
-//                    data: { id: $(this).data('vhId') },
-                    async: false,
-                    success: function(data) { }
-                }).responseText;
-            },
-            container: "body",
-        });
-    });
-</script>
+<?php echo $this->serviceListe; ?>
\ No newline at end of file
diff --git a/module/Application/view/application/service-referentiel/saisir.phtml b/module/Application/view/application/service-referentiel/saisir.phtml
index 126c7989f9f6fdc7c0cec4ff39df54b4848dd809..01979cbe9e325d6627ca2e8218b725688d0d4b4b 100644
--- a/module/Application/view/application/service-referentiel/saisir.phtml
+++ b/module/Application/view/application/service-referentiel/saisir.phtml
@@ -87,7 +87,7 @@ echo $this->form()->closeTag();
     {
         var currentCount = getFonctionCurrentCount();
         var template = $('> fieldset > span', form).data('template');
-        var element = $(template.replace(/__index__/g, currentCount));
+        var element = $(template.replace(/__index__/g, currentCount));console.log(template, element, currentCount);
         $('> fieldset', form).append(element.fadeIn());
         $("select.fonction-referentiel-fonction").not($("select", element)).each(function() { applySelectUnicity($(this), $("select", element)); });
         updateFonctionCounter();
diff --git a/module/Application/view/application/service-referentiel/suppression.phtml b/module/Application/view/application/service-referentiel/suppression.phtml
deleted file mode 100644
index b347181c904e61780ac8e164d67d6c59a7a1b960..0000000000000000000000000000000000000000
--- a/module/Application/view/application/service-referentiel/suppression.phtml
+++ /dev/null
@@ -1,7 +0,0 @@
-<input type="hidden" id="service-deleted-id" value="<?php echo $entity->getId() ?>" />
-<?php
-
-    if ($errors)
-        echo $this->messenger()->setMessages(array(UnicaenApp\View\Helper\Messenger::ERROR => array($errors)));
-    else
-        echo 'Le service a été supprimé.';
\ No newline at end of file
diff --git a/module/Application/view/application/service-referentiel/supprimer.phtml b/module/Application/view/application/service-referentiel/supprimer.phtml
new file mode 100644
index 0000000000000000000000000000000000000000..14a5bf46bbe3e47c2a2a406eeab9ffd7512c68dd
--- /dev/null
+++ b/module/Application/view/application/service-referentiel/supprimer.phtml
@@ -0,0 +1,14 @@
+<?php
+if (isset($errors) && $errors) {
+    echo $this->messenger()->setMessages(array(UnicaenApp\View\Helper\Messenger::ERROR => array($errors)));
+}
+else {
+    echo '<p class="lead text-danger"><strong>Attention!</strong> Confirmez-vous la suppression de cet enregistrement ?</p>';
+    echo $this->serviceReferentielDl($entity, true, true);
+    
+    echo $this->form()->openTag($form);
+    echo $this->formHidden($form->get('id'));
+    echo $this->formHidden($form->get('security'));
+    echo $this->formSubmit($form->get('submit')->setAttribute('class', 'btn btn-primary'));
+    echo $this->form()->closeTag();
+}
\ No newline at end of file
diff --git a/module/Common/src/Common/Exception/DomainException.php b/module/Common/src/Common/Exception/DomainException.php
new file mode 100644
index 0000000000000000000000000000000000000000..e28a0f15912c4deb55bc55b0ed035c3c11c57ccf
--- /dev/null
+++ b/module/Common/src/Common/Exception/DomainException.php
@@ -0,0 +1,13 @@
+<?php
+
+namespace Common\Exception;
+
+/**
+ * Exception thrown if a value does not adhere to a defined valid data domain.
+ *
+ * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ */
+class DomainException extends LogicException
+{
+    
+}
\ No newline at end of file
diff --git a/public/js/app.js b/public/js/app.js
index e6fdb4b772e6c823f7d9259b6c5383ca227758ef..7a73337ec77a5a8d70f494fd2707aa5a784e4f78 100755
--- a/public/js/app.js
+++ b/public/js/app.js
@@ -211,60 +211,14 @@ function ServiceReferentiel( id ) {
 
     this.id = id;
 
-//    this.delete = function( url ){
-//        ok = window.confirm('Voulez-vous vraiment supprimer ce service ?');
-//        if (ok){
-//            $('#service-ref-div').modal({remote: url});
-//        }
-//        return false;
-//    }
-//
-//    this.showHideDetails = function( serviceA ){
-//
-//        var state = $.data(serviceA,'state');
-//        var tr = $('#service-ref-' + this.id + '-volume-horaire-tr');
-//
-//        if (('show' == state || 'none' == tr.css('display')) && 'hide' != state ){
-//            $(serviceA).html('<span class="glyphicon glyphicon-chevron-up"></span>');
-//            tr.show(200);
-//        }else{
-//            $(serviceA).html('<span class="glyphicon glyphicon-chevron-down"></span>');
-//            tr.hide(200);
-//        }
-//    }
-//
-//    this.showInterneExterne = function(){
-//        if ('service-ref-interne' == this.id){
-//            $('#element-interne').show();
-//            $('#element-externe').hide();
-//            $("input[name='etablissement\\[label\\]']").val('');
-//            $("input[name='etablissement\\[id\\]']").val('');
-//        }else{
-//            $('#element-interne').hide();
-//            $("input[name='elementPedagogique\\[label\\]']").val('');
-//            $("input[name='elementPedagogique\\[id\\]']").val('');
-//            $('#element-externe').show();
-//        }
-//    }
-
-    this.onAfterAdd = function(){
-//        $.get( ServiceReferentiel.voirLigneUrl+"/"+this.id+'?only-content=0', function( data ) {
-//            $( "#service-ref-"+this.id+"-ligne" ).load( ServiceReferentiel.voirLigneUrl );
-//            $('#services > tbody:last').append(data);
-//        });
+    this.onAfterAdd = function() {
         $.get(ServiceReferentiel.voirLigneUrl, [], function(data) { $("#services-ref").replaceWith($(data).filter("table").fadeIn()); });
     }
 
-//    this.onAfterModify = function(){
-//        var details = $('#service-ref-'+this.id+'-volume-horaire-tr').css('display') == 'none' ? '0' : '1';
-//        $( "#service-ref-"+this.id+"-ligne" ).load( ServiceReferentiel.voirLigneUrl + "/"+this.id+'?only-content=1&details='+details );
-//    }
-//
-//    this.onAfterDelete = function(){
-//        $('#service-ref-'+this.id+'-volume-horaire-tr').remove();
-//        $( "#service-ref-"+this.id+"-ligne" ).remove();
-//    }
-
+    this.onAfterDelete = function() {
+        console.log(this.id);
+        $( "#service-ref-" + this.id + "-ligne" ).fadeOut().remove();
+    }
 }
 
 ServiceReferentiel.get = function( id )
@@ -278,40 +232,15 @@ ServiceReferentiel.init = function( voirLigneUrl )
 {
     ServiceReferentiel.voirLigneUrl = voirLigneUrl;
 
-    $("body").on("service-ref-add-message", function(event, data) {
+    $("body").on("service-ref-add-message service-ref-modify-message", function(event, data) {
         var id = null;
         event.div.modal('hide'); // ferme la fenêtre modale
         ServiceReferentiel.get(id).onAfterAdd();
     });
-
-//    $('#service-ref-div').on('loaded.bs.modal', function (e) {
-//        if (id = $('#service-ref-deleted-id').val()){
-//            ServiceReferentiel.get(id).onAfterDelete();
-//        }
-//    });
-//
-//    $("body").on('change', 'form#service input[name="interne-externe"]', function(){
-//        ServiceReferentiel.get(this.value).showInterneExterne( $( this ).val() );
-//    });
-//
-//    $(".service-ref-show-all-details").on('click', function(){ ServiceReferentiel.showAllDetails(); });
-//    $(".service-ref-hide-all-details").on('click', function(){ ServiceReferentiel.hideAllDetails(); });
-//    $('body').on('click', '.service-ref-delete', function(){
-//        ServiceReferentiel.get( $(this).data('id') ).delete( $(this).attr('href') );
-//        return false;
-//    })
-}
-
-//ServiceReferentiel.showAllDetails = function(){
-//    $('.service-ref-details-button').data('state', 'show');
-//    $('.service-ref-details-button').click();
-//    $('.service-ref-details-button').data('state', '');
-//}
-//
-//ServiceReferentiel.hideAllDetails = function(){
-//    $('.service-ref-details-button').data('state', 'hide');
-//    $('.service-ref-details-button').click();
-//    $('.service-ref-details-button').data('state', '');
-//}
-
-
+    
+    $("body").on("service-delete-message", function(event, data) {
+        event.div.modal('hide'); // ferme la fenêtre modale
+        console.log(event.a.data('id'));
+        ServiceReferentiel.get(event.a.data('id')).onAfterDelete();
+    });
+}
\ No newline at end of file