From 826c9bc24d3978b142505b7863da858e66505a74 Mon Sep 17 00:00:00 2001 From: lecluse <lecluse@d57fa8bc-6af1-4de9-8b7d-78e900e231e7> Date: Thu, 3 Sep 2015 12:28:44 +0000 Subject: [PATCH] =?UTF-8?q?Refactoring=20et=20optimisation=20g=C3=A9n?= =?UTF-8?q?=C3=A9rale?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- composer.json | 1 + composer.lock | 100 ++++++-- init_autoloader.php | 28 +-- module/Application/Module.php | 3 + module/Application/config/module.config.php | 5 +- .../config/offre-formation.config.php | 14 +- .../ElementPedagogiqueController.php | 92 +++---- .../Entity/Db/AdresseIntervenant.php | 31 +-- .../Entity/Db/ServiceAPayerTrait.php | 2 +- .../src/Application/View/Helper/AdresseDl.php | 123 ---------- .../Application/View/Helper/AgrementDl.php | 2 +- .../Intervenant/IntervenantViewHelper.php | 78 +++++- .../Application/View/Helper/IntervenantDl.php | 224 ------------------ .../OffreFormation/ElementPedagogique.php | 61 ----- .../OffreFormation/ElementPedagogiqueDl.php | 110 --------- .../ElementPedagogiqueViewHelper.php | 111 +++++++++ .../View/Helper/OffreFormation/EtapeDl.php | 87 ------- .../Helper/OffreFormation/EtapeViewHelper.php | 13 +- .../{Mailto.php => UtilisateurViewHelper.php} | 6 +- .../Application/View/Helper/ValidationDl.php | 2 +- .../application/contrat/partial/list.phtml | 2 +- .../application/intervenant/apercevoir.phtml | 4 +- .../application/intervenant/rechercher.phtml | 2 +- .../view/application/intervenant/voir.phtml | 2 +- .../element-pedagogique/apercevoir.phtml | 4 +- .../element-pedagogique/supprimer.phtml | 2 +- .../element-pedagogique/voir.phtml | 2 +- .../offre-formation/search-of.phtml | 2 +- module/Common/Module.php | 45 +--- module/Common/config/module.config.php | 23 +- module/Common/src/Common/Constants.php | 2 + module/Import/Module.php | 52 +--- module/Import/autoload_classmap.php | 24 +- module/Import/config/module.config.php | 62 +++-- public/css/app.css | 29 ++- 35 files changed, 460 insertions(+), 890 deletions(-) delete mode 100644 module/Application/src/Application/View/Helper/AdresseDl.php delete mode 100644 module/Application/src/Application/View/Helper/IntervenantDl.php delete mode 100644 module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogique.php delete mode 100644 module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueDl.php create mode 100644 module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueViewHelper.php delete mode 100644 module/Application/src/Application/View/Helper/OffreFormation/EtapeDl.php rename module/Application/src/Application/View/Helper/{Mailto.php => UtilisateurViewHelper.php} (84%) diff --git a/composer.json b/composer.json index b5681acf5c..29acf27e42 100755 --- a/composer.json +++ b/composer.json @@ -19,6 +19,7 @@ }, "require-dev": { "zendframework/zend-test": ">=2.3", + "zendframework/zend-file": ">=2.3", "phpunit/PHPUnit": ">=3.7", "zendframework/zend-developer-tools": "dev-master", "unicaen/unicaen-code": "dev-trunk" diff --git a/composer.lock b/composer.lock index 814b800af1..534ee9e092 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "2e5b200c550fe0380663902466ee4d6e", + "hash": "308cfa4cdcc7d4dd8adddc06573faad5", "packages": [ { "name": "bjyoungblood/bjy-authorize", @@ -78,16 +78,16 @@ }, { "name": "doctrine/annotations", - "version": "v1.2.6", + "version": "v1.2.7", "source": { "type": "git", "url": "https://github.com/doctrine/annotations.git", - "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4" + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f4a91702ca3cd2e568c3736aa031ed00c3752af4", - "reference": "f4a91702ca3cd2e568c3736aa031ed00c3752af4", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f25c8aab83e0c3e976fd7d19875f198ccf2f7535", + "reference": "f25c8aab83e0c3e976fd7d19875f198ccf2f7535", "shasum": "" }, "require": { @@ -142,20 +142,20 @@ "docblock", "parser" ], - "time": "2015-06-17 12:21:22" + "time": "2015-08-31 12:32:49" }, { "name": "doctrine/cache", - "version": "v1.4.1", + "version": "v1.4.2", "source": { "type": "git", "url": "https://github.com/doctrine/cache.git", - "reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03" + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/c9eadeb743ac6199f7eec423cb9426bc518b7b03", - "reference": "c9eadeb743ac6199f7eec423cb9426bc518b7b03", + "url": "https://api.github.com/repos/doctrine/cache/zipball/8c434000f420ade76a07c64cbe08ca47e5c101ca", + "reference": "8c434000f420ade76a07c64cbe08ca47e5c101ca", "shasum": "" }, "require": { @@ -212,7 +212,7 @@ "cache", "caching" ], - "time": "2015-04-15 00:11:59" + "time": "2015-08-31 12:36:41" }, { "name": "doctrine/collections", @@ -282,16 +282,16 @@ }, { "name": "doctrine/common", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/doctrine/common.git", - "reference": "cd8daf2501e10c63dced7b8b9b905844316ae9d3" + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/cd8daf2501e10c63dced7b8b9b905844316ae9d3", - "reference": "cd8daf2501e10c63dced7b8b9b905844316ae9d3", + "url": "https://api.github.com/repos/doctrine/common/zipball/0009b8f0d4a917aabc971fb089eba80e872f83f9", + "reference": "0009b8f0d4a917aabc971fb089eba80e872f83f9", "shasum": "" }, "require": { @@ -351,7 +351,7 @@ "persistence", "spl" ], - "time": "2015-04-02 19:55:44" + "time": "2015-08-31 13:00:22" }, { "name": "doctrine/dbal", @@ -507,12 +507,12 @@ "version": "0.9.1", "source": { "type": "git", - "url": "https://github.com/doctrine/DoctrineORMModule.git", + "url": "git@github.com:doctrine/DoctrineORMModule.git", "reference": "11cf6a34cd097b4d252a82d198ceed565ee3102c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/DoctrineORMModule/zipball/11cf6a34cd097b4d252a82d198ceed565ee3102c", + "url": "https://api.github.com/repos/doctrine/DoctrineORMModule/zipball/731ec00a3b5cb9fcf0def3abc42e0ac58f8d0265", "reference": "11cf6a34cd097b4d252a82d198ceed565ee3102c", "shasum": "" }, @@ -757,16 +757,16 @@ }, { "name": "doctrine/orm", - "version": "v2.5.0", + "version": "v2.5.1", "source": { "type": "git", "url": "https://github.com/doctrine/doctrine2.git", - "reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe" + "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe", - "reference": "aa80c7d2c55a372f5f9f825f5c66dbda53a6e3fe", + "url": "https://api.github.com/repos/doctrine/doctrine2/zipball/e6a83bedbe67579cb0bfb688e982e617943a2945", + "reference": "e6a83bedbe67579cb0bfb688e982e617943a2945", "shasum": "" }, "require": { @@ -830,7 +830,7 @@ "database", "orm" ], - "time": "2015-04-02 20:40:18" + "time": "2015-08-31 12:59:39" }, { "name": "jasig/phpcas", @@ -4454,6 +4454,60 @@ ], "time": "2015-05-07 14:55:31" }, + { + "name": "zendframework/zend-file", + "version": "2.4.7", + "source": { + "type": "git", + "url": "https://github.com/zendframework/zend-file.git", + "reference": "eafa689f26fdaaa8569b1cbe927fc5d75ca802b2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/zendframework/zend-file/zipball/eafa689f26fdaaa8569b1cbe927fc5d75ca802b2", + "reference": "eafa689f26fdaaa8569b1cbe927fc5d75ca802b2", + "shasum": "" + }, + "require": { + "php": ">=5.3.23", + "zendframework/zend-stdlib": "self.version" + }, + "require-dev": { + "fabpot/php-cs-fixer": "1.7.*", + "phpunit/phpunit": "~4.0", + "satooshi/php-coveralls": "dev-master", + "zendframework/zend-filter": "self.version", + "zendframework/zend-i18n": "self.version", + "zendframework/zend-validator": "self.version" + }, + "suggest": { + "zendframework/zend-filter": "Zend\\Filter component", + "zendframework/zend-i18n": "Zend\\I18n component", + "zendframework/zend-validator": "Zend\\Validator component" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.4-dev", + "dev-develop": "2.5-dev" + } + }, + "autoload": { + "psr-4": { + "Zend\\File\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "homepage": "https://github.com/zendframework/zend-file", + "keywords": [ + "file", + "zf2" + ], + "time": "2015-05-07 14:55:31" + }, { "name": "zendframework/zend-test", "version": "2.4.7", diff --git a/init_autoloader.php b/init_autoloader.php index 8a5bed0902..48cdda92d8 100755 --- a/init_autoloader.php +++ b/init_autoloader.php @@ -17,33 +17,11 @@ */ // Composer autoloading -//if (file_exists('vendor/autoload.php')) { -include 'vendor/autoload.php'; -//} -/* -$zf2Path = false; - -if (is_dir('vendor/ZF2/library')) { - $zf2Path = 'vendor/ZF2/library'; -} elseif (getenv('ZF2_PATH')) { // Support for ZF2_PATH environment variable or git submodule - $zf2Path = getenv('ZF2_PATH'); -} elseif (get_cfg_var('zf2_path')) { // Support for zf2_path directive value - $zf2Path = get_cfg_var('zf2_path'); +if (file_exists('vendor/autoload.php')) { + include 'vendor/autoload.php'; } -if ($zf2Path) { - if (isset($loader)) { - $loader->add('Zend', $zf2Path); - } else { - include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; - Zend\Loader\AutoloaderFactory::factory(array( - 'Zend\Loader\StandardAutoloader' => array( - 'autoregister_zf' => true - ) - )); - } -} -*/ + if (!class_exists('Zend\Loader\AutoloaderFactory')) { throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); } diff --git a/module/Application/Module.php b/module/Application/Module.php index 5764607cd9..88180039a4 100755 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -124,6 +124,9 @@ class Module implements ConsoleUsageProviderInterface, ConsoleBannerProviderInte public function getAutoloaderConfig() { return [ + 'Zend\Loader\ClassMapAutoloader' => array( + __DIR__ . '/autoload_classmap.php', + ), 'Zend\Loader\StandardAutoloader' => [ 'namespaces' => [ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php index 00206f651e..1fee1f2520 100755 --- a/module/Application/config/module.config.php +++ b/module/Application/config/module.config.php @@ -214,10 +214,7 @@ $main = [ ], 'invokables' => [ 'validationDl' => 'Application\View\Helper\ValidationDl', - 'mailto' => 'Application\View\Helper\Mailto', - 'intervenantDl' => 'Application\View\Helper\IntervenantDl', - 'adresseDl' => 'Application\View\Helper\AdresseDl', - 'elementPedagogiqueDl' => 'Application\View\Helper\OffreFormation\ElementPedagogiqueDl', + 'utilisateur' => 'Application\View\Helper\UtilisateurViewHelper', 'fieldsetElementPedagogiqueRecherche' => 'Application\View\Helper\OffreFormation\FieldsetElementPedagogiqueRecherche', ], ], diff --git a/module/Application/config/offre-formation.config.php b/module/Application/config/offre-formation.config.php index 23c9558eed..9206711707 100644 --- a/module/Application/config/offre-formation.config.php +++ b/module/Application/config/offre-formation.config.php @@ -58,19 +58,11 @@ return [ 'voir' => [ 'type' => 'Segment', 'options' => [ - 'route' => '/voir/:id', - 'constraints' => [ 'id' => '[0-9]*' ], + 'route' => '/voir/:elementPedagogique', + 'constraints' => [ 'elementPedagogique' => '[0-9]*' ], 'defaults' => [ 'action' => 'voir' ], ], ], - 'apercevoir' => [ - 'type' => 'Segment', - 'options' => [ - 'route' => '/apercevoir/:id', - 'constraints' => [ 'id' => '[0-9]*' ], - 'defaults' => [ 'action' => 'apercevoir' ], - ], - ], 'ajouter' => [ 'type' => 'Segment', 'options' => [ @@ -391,7 +383,7 @@ return [ 'invokables' => [ 'EtapeModulateursSaisieForm' => 'Application\View\Helper\OffreFormation\EtapeModulateursSaisieForm', 'ElementModulateursSaisieFieldset' => 'Application\View\Helper\OffreFormation\ElementModulateursSaisieFieldset', - 'ElementPedagogique' => 'Application\View\Helper\OffreFormation\ElementPedagogique', + 'ElementPedagogique' => 'Application\View\Helper\OffreFormation\ElementPedagogiqueViewHelper', 'Etape' => 'Application\View\Helper\OffreFormation\EtapeViewHelper', 'EtapeCentreCoutForm' => 'Application\View\Helper\OffreFormation\EtapeCentreCoutFormViewHelper', 'ElementCentreCoutFieldset' => 'Application\View\Helper\OffreFormation\ElementCentreCoutFieldsetViewHelper', diff --git a/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php b/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php index 391e9930a6..b2309af2c9 100644 --- a/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php +++ b/module/Application/src/Application/Controller/OffreFormation/ElementPedagogiqueController.php @@ -16,47 +16,38 @@ use Application\Exception\DbException; class ElementPedagogiqueController extends AbstractActionController { use \Application\Service\Traits\ElementPedagogiqueAwareTrait, - \Application\Service\Traits\ContextAwareTrait - ; + \Application\Service\Traits\ContextAwareTrait; + public function voirAction() { - $element = $this->context()->mandatory()->elementPedagogiqueFromRoute('id'); - $title = "Détails d'un enseignement"; - $short = $this->params()->fromQuery('short', false); - - $viewModel = new \Zend\View\Model\ViewModel(); - $viewModel->setVariables(compact('element', 'title', 'short')); + $element = $this->getEvent()->getParam('elementPedagogique'); + $title = "Enseignement"; - return $viewModel; + return compact('element', 'title'); } - public function apercevoirAction() - { - $element = $this->context()->mandatory()->elementPedagogiqueFromRoute('id'); - $title = "Aperçu d'un enseignement"; - $short = $this->params()->fromQuery('short', false); - - $viewModel = new \Zend\View\Model\ViewModel(); - $viewModel->setVariables(compact('element', 'title', 'short')); - return $viewModel; - } public function ajouterAction() { return $this->saisirAction(); } + + public function modifierAction() { return $this->saisirAction(); } + + protected function saisirAction() { - $etape = $this->context()->mandatory()->etapeFromRoute(); /* @var $etape \Application\Entity\Db\Etape */ + $etape = $this->context()->mandatory()->etapeFromRoute(); + /* @var $etape \Application\Entity\Db\Etape */ $id = $this->params()->fromRoute('id'); $service = $this->getServiceElementPedagogique(); $title = $id ? "Modification d'un enseignement" : "Création d'un enseignement"; @@ -68,11 +59,11 @@ class ElementPedagogiqueController extends AbstractActionController if ($id) { $entity = $service->getRepo()->find($id); $form->bind($entity); - } - else { - $entity = $service->newEntity(); /* @var $entity \Application\Entity\Db\ElementPedagogique */ + } else { + $entity = $service->newEntity(); + /* @var $entity \Application\Entity\Db\ElementPedagogique */ $entity->setEtape($etape) - ->setStructure($etape->getStructure()); + ->setStructure($etape->getStructure()); $form->setObject($entity); } @@ -85,8 +76,7 @@ class ElementPedagogiqueController extends AbstractActionController try { $service->save($entity); $form->get('id')->setValue($entity->getId()); // transmet le nouvel ID - } - catch (\Exception $e) { + } catch (\Exception $e) { $e = DbException::translate($e); $errors[] = $e->getMessage(); } @@ -95,23 +85,25 @@ class ElementPedagogiqueController extends AbstractActionController $viewModel = new \Zend\View\Model\ViewModel(); $viewModel->setTemplate('application/offre-formation/element-pedagogique/saisir') - ->setVariables(compact('form', 'title', 'errors')); + ->setVariables(compact('form', 'title', 'errors')); return $viewModel; } + + public function supprimerAction() { $id = $this->params()->fromRoute('id', 0); - if (!($id = $this->params()->fromRoute('id'))){ + if (!($id = $this->params()->fromRoute('id'))) { throw new \Common\Exception\RuntimeException('L\'identifiant n\'est pas bon ou n\'a pas été fourni'); } - $service = $this->getServiceElementPedagogique(); - $entity = $service->getRepo()->find($id); - $title = "Suppression d'enseignement"; - $form = new \Application\Form\Supprimer('suppr'); - $errors = []; + $service = $this->getServiceElementPedagogique(); + $entity = $service->getRepo()->find($id); + $title = "Suppression d'enseignement"; + $form = new \Application\Form\Supprimer('suppr'); + $errors = []; $form->setAttribute('action', $this->url()->fromRoute(null, [], [], true)); $service->canAdd(true); @@ -119,14 +111,17 @@ class ElementPedagogiqueController extends AbstractActionController if ($this->getRequest()->isPost()) { try { $service->delete($entity); - }catch(\Exception $e){ - $e = DbException::translate($e); + } catch (\Exception $e) { + $e = DbException::translate($e); $errors[] = $e->getMessage(); } } + return compact('entity', 'title', 'form', 'errors'); } + + /** * Action pour rechercher des éléments pédagogiques. * @@ -147,7 +142,7 @@ class ElementPedagogiqueController extends AbstractActionController { $this->em()->getFilters()->enable('annee')->init( [ - 'Application\Entity\Db\ElementPedagogique' + 'Application\Entity\Db\ElementPedagogique', ], $this->getServiceContext()->getAnnee() ); @@ -156,14 +151,14 @@ class ElementPedagogiqueController extends AbstractActionController $niveau = $this->context()->niveauFromQuery(); $etape = $this->context()->etapeFromQuery(); $element = $this->context()->elementPedagogiqueFromQuery(); - $term = $this->params()->fromQuery('term'); + $term = $this->params()->fromQuery('term'); - if (! $etape && !$term) { + if (!$etape && !$term) { exit; } // respect des filtres éventuels spécifiés en GET ou sinon en session - $params = []; + $params = []; $params['structure'] = $structure; $params['niveau'] = $niveau; $params['etape'] = $etape; @@ -172,11 +167,11 @@ class ElementPedagogiqueController extends AbstractActionController $params['limit'] = $limit = 101; // fetch - $found = $this->getServiceElementPedagogique()->getSearchResultByTerm($params); + $found = $this->getServiceElementPedagogique()->getSearchResultByTerm($params); $result = []; foreach ($found as $item) { - if ($item['NB_CH'] > 1){ + if ($item['NB_CH'] > 1) { $item['LIBELLE_ETAPE'] = 'Enseignement commun à plusieurs parcours'; } @@ -188,7 +183,7 @@ class ElementPedagogiqueController extends AbstractActionController $extra .= sprintf('<span class="element-rech etape" title="%s">%s</span>', "Formation", $item['LIBELLE_ETAPE']); } $extra .= "Année" !== $item['LIBELLE_PE'] ? sprintf('<span class="element-rech periode" title="%s">%s</span>', "Période", $item['LIBELLE_PE']) : null; - $template = sprintf('<span class="element-rech extra">{extra}</span><span class="element-rech element" title="%s">{label}</span>', "Enseignement"); + $template = sprintf('<span class="element-rech extra">{extra}</span><span class="element-rech element" title="%s">{label}</span>', "Enseignement"); $result[$item['ID']] = [ 'id' => $item['ID'], 'label' => $item['SOURCE_CODE'] . ' ' . $item['LIBELLE'], @@ -202,19 +197,24 @@ class ElementPedagogiqueController extends AbstractActionController return new \Zend\View\Model\JsonModel($result); } + + public function getPeriodeAction() { $elementPedagogique = $this->context()->elementPedagogiqueFromRoute(); - $code = null; - if ($elementPedagogique){ - if ($periode = $elementPedagogique->getPeriode()){ + $code = null; + if ($elementPedagogique) { + if ($periode = $elementPedagogique->getPeriode()) { $code = $periode->getCode(); } } - $result = ['periode' => [ 'code' => $code ] ]; + $result = ['periode' => ['code' => $code]]; + return new \Zend\View\Model\JsonModel($result); } + + /** * Retourne le formulaire d'ajout/modif d'ElementPedagogique. * diff --git a/module/Application/src/Application/Entity/Db/AdresseIntervenant.php b/module/Application/src/Application/Entity/Db/AdresseIntervenant.php index cabd5b3391..49677e9c01 100644 --- a/module/Application/src/Application/Entity/Db/AdresseIntervenant.php +++ b/module/Application/src/Application/Entity/Db/AdresseIntervenant.php @@ -1,6 +1,7 @@ <?php namespace Application\Entity\Db; +use Common\Constants; use UnicaenApp\Entity\HistoriqueAwareInterface; use UnicaenApp\Entity\HistoriqueAwareTrait; @@ -497,24 +498,16 @@ class AdresseIntervenant implements HistoriqueAwareInterface */ public function __toString() { - $part1 = []; - $part1[] = $this->getNoVoie(); - $part1[] = $this->getNomVoie(); - $part1[] = $this->getBatiment(); - $part1[] = $this->getMentionComplementaire(); - $part1 = implode(', ', array_filter($part1)); - - $part2 = []; - $part2[] = $this->getLocalite(); - $part2[] = $this->getCodePostal(); - $part2[] = $this->getVille(); - $part2[] = $this->getPaysLibelle(); - $part2 = implode(', ', array_filter($part2)); - - $parts = []; - $parts[] = $part1; - $parts[] = $part2; - - return implode(PHP_EOL, array_filter($parts)); + $pays = $this->getPaysLibelle(); + if (strtoupper($pays) == Constants::ADRESSE_PAYS_DEFAULT) $pays = ''; + + return implode( "\n", array_filter([ + trim( $this->getNoVoie().' '.$this->getNomVoie() ), + trim( $this->getBatiment() ), + trim( $this->getMentionComplementaire() ), + trim( $this->getLocalite() ), + trim( $this->getCodePostal().' '.$this->getVille() ), + trim( $pays ) + ])); } } diff --git a/module/Application/src/Application/Entity/Db/ServiceAPayerTrait.php b/module/Application/src/Application/Entity/Db/ServiceAPayerTrait.php index dc8ab8648d..2791eb2aa9 100644 --- a/module/Application/src/Application/Entity/Db/ServiceAPayerTrait.php +++ b/module/Application/src/Application/Entity/Db/ServiceAPayerTrait.php @@ -1,6 +1,6 @@ <?php -namespace Application\Entity\DB; +namespace Application\Entity\Db; trait ServiceAPayerTrait { diff --git a/module/Application/src/Application/View/Helper/AdresseDl.php b/module/Application/src/Application/View/Helper/AdresseDl.php deleted file mode 100644 index 497414530c..0000000000 --- a/module/Application/src/Application/View/Helper/AdresseDl.php +++ /dev/null @@ -1,123 +0,0 @@ -<?php - -namespace Application\View\Helper; - -use Application\Entity\Db\AdresseIntervenant; - -/** - * Description of AdresseDl - * - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> - */ -class AdresseDl extends AbstractDl -{ - /** - * @var AdresseIntervenant - */ - protected $entity; - - /** - * @var bool - */ - protected $condensed; - - /** - * - * @param mixed $entity - * @param bool $horizontal - * @param bool $condensed - * @return self - */ - public function __invoke($entity = null, $horizontal = false, $condensed = false) - { - parent::__invoke($entity, $horizontal); - - $this->condensed = $condensed; - - return $this; - } - - /** - * - * - * @return string Code HTML - */ - public function render() - { - if (!$this->entity) { - return ''; - } - - $tplDtdd = $this->getTemplateDtDd(); - $html = ''; - $dtdds = []; - - if ($this->condensed) { - $complement = implode(', ', array_filter([$this->entity->getMentionComplementaire(), $this->entity->getBatiment()])); - $dtdds[] = sprintf($tplDtdd, - sprintf("Adresse %s:", $this->entity->getPrincipale() ? "principale" : null), - sprintf("%s %s%s", $this->entity->getNoVoie(), $this->entity->getNomVoie(), $complement ? " ($complement)" : null) - ); - } - else { - $dtdds[] = sprintf($tplDtdd, - "N° voie :", - $this->entity->getNoVoie() - ); - - $dtdds[] = sprintf($tplDtdd, - "Nom voie :", - $this->entity->getNomVoie() - ); - - $dtdds[] = sprintf($tplDtdd, - "Mention complementaire :", - $this->entity->getMentionComplementaire() - ); - - $dtdds[] = sprintf($tplDtdd, - "Bâtiment :", - $this->entity->getBatiment() - ); - } - - if ($this->entity->getLocalite()) { - $dtdds[] = sprintf($tplDtdd, - "Localité :", - $this->entity->getLocalite() - ); - } - - if ($this->condensed) { - $dtdds[] = sprintf($tplDtdd, - "Ville :", - sprintf("%s %s (%s)", $this->entity->getCodePostal(), $this->entity->getVille(), $this->entity->getPaysLibelle()) - ); - } - else { - $dtdds[] = sprintf($tplDtdd, - "Code postal :", - $this->entity->getCodePostal() - ); - - $dtdds[] = sprintf($tplDtdd, - "Ville :", - $this->entity->getVille() - ); - - $dtdds[] = sprintf($tplDtdd, - "Pays :", - sprintf("%s (%s)", $this->entity->getPaysLibelle(), $this->entity->getPaysCodeInsee()) - ); - - $dtdds[] = sprintf($tplDtdd, - "Historique :", - $this->getView()->historique($this->entity) - ); - } - - $html .= sprintf($this->getTemplateDl('adresse adresse-details'), implode(PHP_EOL, $dtdds)) . PHP_EOL; - - return $html; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/AgrementDl.php b/module/Application/src/Application/View/Helper/AgrementDl.php index 8cb96d396c..6a14a2f010 100644 --- a/module/Application/src/Application/View/Helper/AgrementDl.php +++ b/module/Application/src/Application/View/Helper/AgrementDl.php @@ -43,7 +43,7 @@ class AgrementDl extends AbstractDl $dtdds[] = sprintf($tplDtdd, "Date et auteur de l'enregistrement :", $entity->getHistoModification()->format(Constants::DATETIME_FORMAT) - . ' par ' . $this->getView()->mailto($entity->getHistoModificateur()) + . ' par ' . $this->getView()->utilisateur($entity->getHistoModificateur()) ); $html .= sprintf($this->getTemplateDl('agrement agrement-details'), implode(PHP_EOL, $dtdds)) . PHP_EOL; diff --git a/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php b/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php index 482df777a1..b7bb0e984b 100644 --- a/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php +++ b/module/Application/src/Application/View/Helper/Intervenant/IntervenantViewHelper.php @@ -15,22 +15,30 @@ class IntervenantViewHelper extends AbstractHtmlElement { use IntervenantAwareTrait; + + /** * * @param Intervenant $intervenant + * * @return self */ - public function __invoke( Intervenant $intervenant = null ) + public function __invoke(Intervenant $intervenant = null) { if ($intervenant) $this->setIntervenant($intervenant); + return $this; } + + public function __toString() { return $this->render(); } + + /** * * @@ -38,20 +46,78 @@ class IntervenantViewHelper extends AbstractHtmlElement */ public function render() { - return $this->renderLink(); + $entity = $this->getIntervenant(); + + if (!$entity) { + return ''; + } + + $adresse = $entity->getAdressePrincipale(); + + $vars = [ + 'identite' => [ + "NOM prénom" => $entity, + "Civilité" => $entity->getCiviliteToString(), + "Date de naissance" => $entity->getDateNaissanceToString(), + "Ville de naissance" => $entity->getVilleNaissanceLibelle() ?: "(Inconnue)", + "Pays de naissance" => $entity->getPaysNaissanceLibelle(), + "N° INSEE" => $entity->getNumeroInsee(), + ], + 'coordonnees' => [ + "Email" => $entity->getEmail() ?: "(Inconnu)", + "Téléphone mobile" => $entity->getTelMobile() ?: "(Inconnu)", + "Téléphone pro" => $entity->getTelPro() ?: "(Inconnu)", + "Adresse" => nl2br($entity->getAdressePrincipale()), + ], + 'metier' => [ + "Type d'intervenant" => $entity->getType(), + "Statut de l'intervenant" => $entity->getStatut(), + "N° {$entity->getSourceToString()}" => $entity->getSourceCode(), + "Affectation principale" => $entity->getStructure() ?: "(Inconnue)", + "Affectation recherche" => count($aff = $entity->getAffectation()) ? implode(" ; ", $aff->toArray()) : "(Inconnue)", + "Discipline" => $entity->getDiscipline() ?: "(Inconnue)", + ], + 'divers' => [ + "Id" => $entity->getId(), + "Id de connexion" => ($u = $entity->getUtilisateur()) ? $u->getUsername() : "(Aucun)", + ], + ]; + + /* @deprecated en attendant la fusion des types d'intervenants... */ + if ($entity instanceof \Application\Entity\Db\IntervenantExterieur) { + $vars['identite']['Situation familiale'] = $entity->getSituationFamiliale() ?: "(Inconnue)"; + } elseif ($entity instanceof \Application\Entity\Db\IntervenantPermanent) { + $vars['metier']['Corps'] = $entity->getCorps(); + } + + $html = ''; + foreach ($vars as $bloc => $vvs) { + $html .= "<dl class=\"intervenant intervenant-$bloc dl-horizontal\">\n"; + foreach ($vvs as $key => $value) { + $html .= "\t<dt>$key :</dt><dd>$value</dd>\n"; + } + $html .= "</dl>"; + } + + //$html .= $this->getView()->historique($entity); => pas de sens ici + + return $html; } + + public function renderLink() { $intervenant = $this->getIntervenant(); - if (! $intervenant) return ''; + if (!$intervenant) return ''; - if ($intervenant->getHistoDestruction()){ - return '<span class="bg-danger"><abbr title="Cet intervenant a été supprimé de OSE">'.$intervenant.'</abbr></span>'; + if ($intervenant->getHistoDestruction()) { + return '<span class="bg-danger"><abbr title="Cet intervenant a été supprimé de OSE">' . $intervenant . '</abbr></span>'; } $pourl = $this->getView()->url('intervenant/default', ['action' => 'apercevoir', 'intervenant' => $intervenant->getSourceCode()]); - $out = '<a href="'.$pourl.'" data-po-href="'.$pourl.'" class="ajax-modal">'.$intervenant.'</a>'; + $out = '<a href="' . $pourl . '" data-po-href="' . $pourl . '" class="ajax-modal">' . $intervenant . '</a>'; + return $out; } } \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/IntervenantDl.php b/module/Application/src/Application/View/Helper/IntervenantDl.php deleted file mode 100644 index b08b8e6444..0000000000 --- a/module/Application/src/Application/View/Helper/IntervenantDl.php +++ /dev/null @@ -1,224 +0,0 @@ -<?php - -namespace Application\View\Helper; - -use Application\Entity\Db\Intervenant; - -/** - * Description of IntervenantDl - * - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> - */ -class IntervenantDl extends AbstractDl -{ - /** - * @var Intervenant - */ - protected $entity; - - - - /** - * - * - * @return string Code HTML - */ - public function render() - { - if (!$this->entity) { - return ''; - } - - $tplDtdd = $this->getTemplateDtDd(); - $html = ''; - - /** - * Identité - */ - - $identite = []; - - if ($this->short) { - $identite[] = sprintf($tplDtdd, - "Identité :", - sprintf("%s, %s", $this->entity, $this->entity->getCiviliteToString()) - ); - } else { - $identite[] = sprintf($tplDtdd, - "NOM prénom :", - $this->entity - ); - - $identite[] = sprintf($tplDtdd, - "Civilité :", - $this->entity->getCiviliteToString() - ); - } - - if ($this->short) { - $parts = [ - $this->entity->getDateNaissanceToString(), - $this->entity->getVilleNaissanceLibelle(), - $this->entity->getPaysNaissanceLibelle(), - ]; - $identite[] = sprintf($tplDtdd, - "Naissance :", - implode(", ", $parts) - ); - } else { - $identite[] = sprintf($tplDtdd, - "Date de naissance :", - $this->entity->getDateNaissanceToString() - ); - - $identite[] = sprintf($tplDtdd, - "Ville de naissance :", - $this->entity->getVilleNaissanceLibelle() ?: "(Inconnue)" - ); - - $identite[] = sprintf($tplDtdd, - "Pays de naissance :", - $this->entity->getPaysNaissanceLibelle() - ); - } - - if (!$this->short) { - $identite[] = sprintf($tplDtdd, - "N° INSEE :", - $this->entity->getNumeroInsee() - ); - - if ($this->entity instanceof \Application\Entity\Db\IntervenantExterieur) { - $identite[] = sprintf($tplDtdd, - "Situation familiale :", - $this->entity->getSituationFamiliale() ?: "(Inconnue)" - ); - } - } - - $html .= sprintf($this->getTemplateDl('intervenant intervenant-identite'), implode(PHP_EOL, $identite)) . PHP_EOL; - - /** - * Coordonnées - */ - - $coord = []; - - $coord[] = sprintf($tplDtdd, - "Email :", - $this->entity->getEmail() ?: "(Inconnu)" - ); - - if (!$this->short) { - $coord[] = sprintf($tplDtdd, - "Téléphone mobile :", - $this->entity->getTelMobile() ?: "(Inconnu)" - ); - - $coord[] = sprintf($tplDtdd, - "Téléphone pro :", - $this->entity->getTelPro() ?: "(Inconnu)" - ); - } - - $html .= sprintf($this->getTemplateDl('intervenant intervenant-coord'), implode(PHP_EOL, $coord)) . PHP_EOL; - - /** - * Adresses - */ - - foreach ($this->entity->getAdresse() as $adresse) { - $html .= $this->getView()->adresseDl($adresse, true, true) . PHP_EOL; - } - - /** - * Métier - */ - - $metier = []; - - $metier[] = sprintf($tplDtdd, - "Type d'intervenant :", - $this->entity->getType() - ); - - if (($statut = $this->entity->getStatut())) { - $metier[] = sprintf($tplDtdd, - "Statut de l'intervenant :", - $statut - ); - } - - $metier[] = sprintf($tplDtdd, - "N° {$this->entity->getSourceToString()} :", - $this->entity->getSourceCode() - ); - - $metier[] = sprintf($tplDtdd, - "Affectation principale :", - $this->entity->getStructure() ?: "(Inconnue)" - ); - - if (!$this->short) { - $metier[] = sprintf($tplDtdd, - "Affectation recherche :", - count($aff = $this->entity->getAffectation()) ? implode(" ; ", $aff->toArray()) : "(Inconnue)" - ); - - $metier[] = sprintf($tplDtdd, - "Discipline :", - $this->entity->getDiscipline() ?: "(Inconnue)" - ); - - if ($this->entity instanceof \Application\Entity\Db\IntervenantPermanent) { - $metier[] = sprintf($tplDtdd, - "Corps :", - $this->entity->getCorps() - ); - } elseif ($this->entity instanceof \Application\Entity\Db\IntervenantExterieur) { - $metier[] = sprintf($tplDtdd, - "Régime sécu :", - $this->entity->getRegimeSecu() ?: "(Inconnu)" - ); - $metier[] = sprintf($tplDtdd, - "Type de poste :", - $this->entity->getTypePoste() ?: "(Inconnu)" - ); - } - } - - $html .= sprintf($this->getTemplateDl('intervenant intervenant-metier'), implode(PHP_EOL, $metier)) . PHP_EOL; - - /** - * Divers - */ - - $divers = []; - - if (!$this->short) { - $divers[] = sprintf($tplDtdd, - "Id :", - $this->entity->getId() - ); - } - - if (!$this->short) { - $divers[] = sprintf($tplDtdd, - "Id de connexion :", - ($u = $this->entity->getUtilisateur()) ? $u->getUsername() : "(Aucun)" - ); - } - - $html .= sprintf($this->getTemplateDl('intervenant intervenant-divers'), implode(PHP_EOL, $divers)) . PHP_EOL; - - /** - * Historique - */ - - if (!$this->short) { - $html .= $this->getView()->historique($this->entity, $this->horizontal); - } - - return $html; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogique.php b/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogique.php deleted file mode 100644 index 4603481447..0000000000 --- a/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogique.php +++ /dev/null @@ -1,61 +0,0 @@ -<?php - -namespace Application\View\Helper\OffreFormation; - -use Zend\View\Helper\AbstractHelper; -use Application\Entity\Db\ElementPedagogique as Entity; -use Application\Traits\ElementPedagogiqueAwareTrait; - -/** - * Description of ElementPedagogique - * - * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> - */ -class ElementPedagogique extends AbstractHelper -{ - use ElementPedagogiqueAwareTrait; - - /** - * - * @param Entity $elementPedagogique - * @return self - */ - public function __invoke( Entity $elementPedagogique = null ) - { - if ($elementPedagogique) $this->setElementPedagogique($elementPedagogique); - return $this; - } - - /** - * - * - * @return string Code HTML - */ - public function render() - { - - } - - public function renderLink( $format='original' ) - { - $element = $this->getElementPedagogique(); - if (! $element) return ''; - - if ($element->getHistoDestruction()){ - return '<span class="bg-danger"><abbr title="Cet élément pédagogique n\'existe plus">'.$element.'</abbr></span>'; - } - - switch( $format ){ - case 'libelle': - $str = $element->getLibelle(); - break; - default: - $str = (string)$element; - } - - $url = $this->getView()->url('of/element/voir', ['id' => $element->getId()]); - $pourl = $this->getView()->url('of/element/apercevoir', ['id' => $element->getId()]); - $out = '<a href="'.$url.'" data-po-href="'.$pourl.'" class="ajax-modal">'.$str.'</a>'; - return $out; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueDl.php b/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueDl.php deleted file mode 100644 index e7630cd873..0000000000 --- a/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueDl.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php - -namespace Application\View\Helper\OffreFormation; - -use Application\Entity\Db\ElementPedagogique; -use Application\View\Helper\AbstractDl; - -/** - * Description of ElementPedagogiqueDl - * - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> - */ -class ElementPedagogiqueDl extends AbstractDl -{ - /** - * @var ElementPedagogique - */ - protected $entity; - - /** - * - * - * @return string Code HTML - */ - public function render() - { - if (!$this->entity) { - return ''; - } - - $tplDtdd = $this->getTemplateDtDd(); - $html = ''; - - /** - * Détails - */ - - $details = []; - - if (!$this->short) { - $details[] = sprintf($tplDtdd, - "Code {$this->entity->getSource()->getLibelle()} :", - $this->entity->getSourceCode() - ); - } - - $details[] = sprintf($tplDtdd, - "Année :", - $this->entity->getAnnee() - ); - - $details[] = sprintf($tplDtdd, - "Libellé :", - $this->entity->getLibelle() - ); - - $details[] = sprintf($tplDtdd, - "Structure :", - $this->entity->getStructure() - ); - - if (($periode = $this->entity->getPeriode())) { - $details[] = sprintf($tplDtdd, - "Période d'enseignement :", - $this->entity->getPeriode() - ); - } - - if (($autresEtapes = $this->entity->getEtapes(false))) { - $details[] = sprintf($tplDtdd, - "Formation principale :", - $this->entity->getEtape() - ); - if (!$this->short) { - $details[] = sprintf($tplDtdd, - "Autre(s) formation(s) :", - $this->getView()->htmlList($autresEtapes) - ); - } - } - else { - $details[] = sprintf($tplDtdd, - "Formation :", - $this->entity->getEtape() - ); - } - - $details[] = sprintf($tplDtdd, - "<span title=\"Formation ouverte à distance\">FOAD</span> :", - (bool)$this->entity->getTauxFoad() ? "Oui" : "Non" - ); - - $details[] = sprintf($tplDtdd, - 'Régime(s) d\'inscription :', - $this->entity->getRegimesInscription(true) - ); - - $html .= sprintf($this->getTemplateDl('element element-details'), implode(PHP_EOL, $details)) . PHP_EOL; - - /** - * Historique - */ - - if (!$this->short) { - $html .= $this->getView()->historique($this->entity, $this->horizontal); - } - - return $html; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueViewHelper.php b/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueViewHelper.php new file mode 100644 index 0000000000..e63ea102fc --- /dev/null +++ b/module/Application/src/Application/View/Helper/OffreFormation/ElementPedagogiqueViewHelper.php @@ -0,0 +1,111 @@ +<?php + +namespace Application\View\Helper\OffreFormation; + +use Application\Entity\Db\ElementPedagogique as Entity; +use Application\Traits\ElementPedagogiqueAwareTrait; +use Zend\View\Helper\AbstractHtmlElement; + +/** + * Description of ElementPedagogiqueViewHelper + * + * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> + */ +class ElementPedagogiqueViewHelper extends AbstractHtmlElement +{ + use ElementPedagogiqueAwareTrait; + + + + /** + * + * @param Entity $elementPedagogique + * + * @return self + */ + public function __invoke(Entity $elementPedagogique = null) + { + if ($elementPedagogique) $this->setElementPedagogique($elementPedagogique); + + return $this; + } + + + + /** + * Retourne le code HTML. + * + * @return string Code HTML + */ + public function __toString() + { + return $this->render(); + } + + + + /** + * + * + * @return string Code HTML + */ + public function render() + { + $entity = $this->getElementPedagogique(); + + if (!$entity) { + return ''; + } + + $vars = [ + "Code {$entity->getSource()->getLibelle()}" => $entity->getSourceCode(), + "Libellé" => $entity->getLibelle(), + "Structure" => $entity->getStructure(), + "Période d'enseignement" => $entity->getPeriode(), + "<span title=\"Formation ouverte à distance\">FOAD</span>" => (bool)$entity->getTauxFoad() ? "Oui" : "Non", + "Régime(s) d'inscription" => $entity->getRegimesInscription(true), + ]; + + if (($autresEtapes = $entity->getEtapes(false))) { + $vars["Formation principale"] = $entity->getEtape(); + $vars["Autre(s) formation(s)"] = $this->getView()->htmlList($autresEtapes); + } else { + $vars["Formation"] = $entity->getEtape(); + } + + $html = "<dl class=\"element dl-horizontal\">\n"; + foreach ($vars as $key => $value) { + $html .= "\t<dt>$key :</dt><dd>$value</dd>\n"; + } + $html .= "</dl>"; + + $html .= $this->getView()->historique($entity); + + return $html; + } + + + + public function renderLink($format = 'original') + { + $element = $this->getElementPedagogique(); + if (!$element) return ''; + + switch ($format) { + case 'libelle': + $str = $element->getLibelle(); + break; + default: + $str = (string)$element; + } + + $url = $this->getView()->url('of/element/voir', ['elementPedagogique' => $element->getId()]); + $out = '<a href="' . $url . '" data-po-href="' . $url . '" class="ajax-modal">' . $str . '</a>'; + + if ($element->getHistoDestruction()) { + return '<span class="bg-danger"><abbr title="Cet élément pédagogique n\'existe plus">' . $out . '</abbr></span>'; + } else { + return $out; + } + } +} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/OffreFormation/EtapeDl.php b/module/Application/src/Application/View/Helper/OffreFormation/EtapeDl.php deleted file mode 100644 index 661d2c6f89..0000000000 --- a/module/Application/src/Application/View/Helper/OffreFormation/EtapeDl.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php - -namespace Application\View\Helper\OffreFormation; - -use Application\Entity\Db\Etape; -use Application\View\Helper\AbstractDl; - -/** - * Description of EtapeDl - * - * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr> - */ -class EtapeDl extends AbstractDl -{ - /** - * @var Etape - */ - protected $entity; - - /** - * - * - * @return string Code HTML - */ - public function render() - { - if (!$this->entity) { - return ''; - } - - $tplDtdd = $this->getTemplateDtDd(); - $html = ''; - - /** - * Détails - */ - - $details = []; - - $details[] = sprintf($tplDtdd, - "Code {$this->entity->getSource()->getLibelle()} :", - $this->entity->getSourceCode() - ); - - $details[] = sprintf($tplDtdd, - "Libellé :", - $this->entity->getLibelle() - ); - - $details[] = sprintf($tplDtdd, - "Structure :", - $this->entity->getStructure() - ); - - $details[] = sprintf($tplDtdd, - "Type de formation :", - $this->entity->getTypeFormation() - ); - - if (($niveau = $this->entity->getNiveau())) { - $details[] = sprintf($tplDtdd, - "Niveau :", - $niveau - ); - } - - $details[] = sprintf($tplDtdd, - "Spécif. échanges :", - $this->entity->getSpecifiqueEchanges() ? 'Oui' : 'Non' - ); - - $details[] = sprintf($tplDtdd, - "Domaine fonctionnel :", - $this->entity->getDomaineFonctionnel() ?: "Aucun" - ); - - $html .= sprintf($this->getTemplateDl('etape etape-details'), implode(PHP_EOL, $details)) . PHP_EOL; - - /** - * Historique - */ - - $html .= $this->getView()->historique($this->entity, $this->horizontal); - - return $html; - } -} \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/OffreFormation/EtapeViewHelper.php b/module/Application/src/Application/View/Helper/OffreFormation/EtapeViewHelper.php index 2a5db5708f..72965257f5 100644 --- a/module/Application/src/Application/View/Helper/OffreFormation/EtapeViewHelper.php +++ b/module/Application/src/Application/View/Helper/OffreFormation/EtapeViewHelper.php @@ -85,14 +85,13 @@ class EtapeViewHelper extends AbstractHtmlElement $etape = $this->getEtape(); if (!$etape) return ''; + $url = $this->getView()->url('of/etape/voir', ['etape' => $etape->getId()]); + $out = '<a href="' . $url . '" data-po-href="' . $url . '" class="ajax-modal">' . $etape . '</a>'; + if ($etape->getHistoDestruction() && 0 == $etape->getCheminPedagogique()->count()) { - return '<span class="bg-danger"><abbr title="Cette formation n\'existe plus">' . $etape . '</abbr></span>'; + return '<span class="bg-danger"><abbr title="Cette formation n\'existe plus">' . $out . '</abbr></span>'; + } else { + return $out; } - - $url = $this->getView()->url('of/etape/voir', ['etape' => $etape->getId()]); - $pourl = $this->getView()->url('of/etape/voir', ['etape' => $etape->getId()]); - $out = '<a href="' . $url . '" data-po-href="' . $pourl . '" class="ajax-modal">' . $etape . '</a>'; - - return $out; } } \ No newline at end of file diff --git a/module/Application/src/Application/View/Helper/Mailto.php b/module/Application/src/Application/View/Helper/UtilisateurViewHelper.php similarity index 84% rename from module/Application/src/Application/View/Helper/Mailto.php rename to module/Application/src/Application/View/Helper/UtilisateurViewHelper.php index 2203544287..b8a4dd4375 100644 --- a/module/Application/src/Application/View/Helper/Mailto.php +++ b/module/Application/src/Application/View/Helper/UtilisateurViewHelper.php @@ -2,15 +2,15 @@ namespace Application\View\Helper; -use Zend\View\Helper\AbstractHelper; use Application\Entity\Db\Utilisateur; +use Zend\View\Helper\AbstractHtmlElement; /** - * Description of Mailto + * Description of UtilisateurViewHelper * * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr> */ -class Mailto extends AbstractHelper +class UtilisateurViewHelper extends AbstractHtmlElement { /** * diff --git a/module/Application/src/Application/View/Helper/ValidationDl.php b/module/Application/src/Application/View/Helper/ValidationDl.php index a84201f0fe..721ae82bc3 100644 --- a/module/Application/src/Application/View/Helper/ValidationDl.php +++ b/module/Application/src/Application/View/Helper/ValidationDl.php @@ -35,7 +35,7 @@ class ValidationDl extends AbstractDl $dtdds[] = sprintf($tplDtdd, "Date et auteur :", $entity->getHistoModification()->format(\Common\Constants::DATETIME_FORMAT) - . ' par ' . $this->getView()->mailto($entity->getHistoModificateur()) + . ' par ' . $this->getView()->utilisateur($entity->getHistoModificateur()) ); // if ($entity->getDateConseilAcademique()) { diff --git a/module/Application/view/application/contrat/partial/list.phtml b/module/Application/view/application/contrat/partial/list.phtml index a3088ec4a1..f0f263e4c3 100644 --- a/module/Application/view/application/contrat/partial/list.phtml +++ b/module/Application/view/application/contrat/partial/list.phtml @@ -39,7 +39,7 @@ $role = $this->role; <td> <p> <strong><?php echo $contrat ?></strong> créé par - <?php echo $this->mailto($contrat->getHistoModificateur()) ?> + <?php echo $this->utilisateur($contrat->getHistoModificateur()) ?> <?php if ($this->isAllowed($contrat, ContratAssertion::PRIVILEGE_EXPORTER)): ?> <span class="pull-right"> diff --git a/module/Application/view/application/intervenant/apercevoir.phtml b/module/Application/view/application/intervenant/apercevoir.phtml index 7c8e7038a5..c3afa24f91 100644 --- a/module/Application/view/application/intervenant/apercevoir.phtml +++ b/module/Application/view/application/intervenant/apercevoir.phtml @@ -1,5 +1,3 @@ <h3><?php echo $intervenant ?> <small><?php echo $intervenant->getType() ?></small></h3> -<?php echo $this->intervenantDl($intervenant, true, $short) ?> - -<br /><?php //foreach( $changements as $changement ) { echo $this->differentielLigne( $changement ); } ?> \ No newline at end of file +<?php echo $this->intervenant($intervenant) ?> diff --git a/module/Application/view/application/intervenant/rechercher.phtml b/module/Application/view/application/intervenant/rechercher.phtml index 82d62b60c1..3ac6594d6f 100644 --- a/module/Application/view/application/intervenant/rechercher.phtml +++ b/module/Application/view/application/intervenant/rechercher.phtml @@ -13,7 +13,7 @@ </div> <div class="col-md-8 intervenant-voir"> <?php if (false !== $intervenant): ?> - <?php echo $intervenant ? $this->intervenantDl($intervenant, true) : "Intervenant introuvable dans OSE." ?> + <?php echo $intervenant ? $this->intervenant($intervenant) : "Intervenant introuvable dans OSE." ?> <?php endif ?> <?php if ($intervenant): ?> <?php echo $this->navigation('navigation')->menuContextuel()->withTarget($intervenant->getId()) ?> diff --git a/module/Application/view/application/intervenant/voir.phtml b/module/Application/view/application/intervenant/voir.phtml index e83c833d61..8eec90f67f 100644 --- a/module/Application/view/application/intervenant/voir.phtml +++ b/module/Application/view/application/intervenant/voir.phtml @@ -2,7 +2,7 @@ <h1 class="page-header"><?php echo $intervenant ?> <small><?php echo $intervenant->getType() ?></small></h1> -<?php echo $this->intervenantDl($intervenant, true) ?> +<?php echo $this->intervenant($intervenant) ?> <hr /> diff --git a/module/Application/view/application/offre-formation/element-pedagogique/apercevoir.phtml b/module/Application/view/application/offre-formation/element-pedagogique/apercevoir.phtml index 4908d26956..6ede7f1e4a 100644 --- a/module/Application/view/application/offre-formation/element-pedagogique/apercevoir.phtml +++ b/module/Application/view/application/offre-formation/element-pedagogique/apercevoir.phtml @@ -1,5 +1,3 @@ <h3><?php echo $element ?> <small><?php echo $element->getSourceCode() ?></small></h3> -<?php echo $this->elementPedagogiqueDl($element, true, $short) ?> - -<br /><?php //foreach( $changements as $changement ) { echo $this->differentielLigne( $changement ); } ?> +<?php echo $this->elementPedagogique($element); diff --git a/module/Application/view/application/offre-formation/element-pedagogique/supprimer.phtml b/module/Application/view/application/offre-formation/element-pedagogique/supprimer.phtml index 0edb55bf30..6bd8407b25 100644 --- a/module/Application/view/application/offre-formation/element-pedagogique/supprimer.phtml +++ b/module/Application/view/application/offre-formation/element-pedagogique/supprimer.phtml @@ -4,7 +4,7 @@ if (isset($errors) && $errors) { } else { echo '<p class="lead text-danger"><strong>Attention!</strong> Confirmez-vous la suppression de cet enregistrement ?</p>'; - echo $this->elementPedagogiqueDl($entity, true, true); + echo $this->elementPedagogique($entity); echo $this->form()->openTag($form); echo $this->formHidden($form->get('id')); diff --git a/module/Application/view/application/offre-formation/element-pedagogique/voir.phtml b/module/Application/view/application/offre-formation/element-pedagogique/voir.phtml index 4908d26956..c8c658902f 100644 --- a/module/Application/view/application/offre-formation/element-pedagogique/voir.phtml +++ b/module/Application/view/application/offre-formation/element-pedagogique/voir.phtml @@ -1,5 +1,5 @@ <h3><?php echo $element ?> <small><?php echo $element->getSourceCode() ?></small></h3> -<?php echo $this->elementPedagogiqueDl($element, true, $short) ?> +<?php echo $this->elementPedagogique($element) ?> <br /><?php //foreach( $changements as $changement ) { echo $this->differentielLigne( $changement ); } ?> diff --git a/module/Application/view/application/offre-formation/search-of.phtml b/module/Application/view/application/offre-formation/search-of.phtml index 411cb70e52..af73d4aff2 100644 --- a/module/Application/view/application/offre-formation/search-of.phtml +++ b/module/Application/view/application/offre-formation/search-of.phtml @@ -1,2 +1,2 @@ <?php echo time() ?><br /> -<?php echo $intervenant ? $this->intervenantDl($intervenant) : "Intervenant introuvable." ?> +<?php echo $intervenant ? $this->intervenant($intervenant) : "Intervenant introuvable." ?> diff --git a/module/Common/Module.php b/module/Common/Module.php index dee7a374df..86d296a9c3 100755 --- a/module/Common/Module.php +++ b/module/Common/Module.php @@ -9,24 +9,14 @@ namespace Common; -use Zend\Mvc\ModuleRouteListener; -use Zend\Mvc\MvcEvent; - class Module { - public function onBootstrap(MvcEvent $e) - { - $application = $e->getApplication(); - $sm = $application->getServiceManager(); - $sm->get('translator'); - $eventManager = $application->getEventManager(); - $moduleRouteListener = new ModuleRouteListener(); - $moduleRouteListener->attach($eventManager); - } - public function getAutoloaderConfig() { return [ + 'Zend\Loader\ClassMapAutoloader' => array( + __DIR__ . '/autoload_classmap.php', + ), 'Zend\Loader\StandardAutoloader' => [ 'namespaces' => [ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, @@ -39,33 +29,4 @@ class Module { return include __DIR__ . '/config/module.config.php'; } - - /** - * {@inheritDoc} - */ - public function getControllerPluginConfig() - { - return [ - 'factories' => [ - ], - ]; - } - - /** - * Expected to return \Zend\ServiceManager\Config object or array to - * seed such an object. - * - * @return array|\Zend\ServiceManager\Config - * @see ViewHelperProviderInterface - */ - public function getViewHelperConfig() - { - return [ - 'factories' => [ - ], - 'invokables' => [ - 'formButtonGroup' => 'Common\Form\View\Helper\FormButtonGroup', - ], - ]; - } } diff --git a/module/Common/config/module.config.php b/module/Common/config/module.config.php index 0c1c722c00..8409281ca2 100755 --- a/module/Common/config/module.config.php +++ b/module/Common/config/module.config.php @@ -3,26 +3,26 @@ namespace Application; return [ - 'doctrine' => [ + 'doctrine' => [ 'configuration' => [ 'orm_default' => [ 'string_functions' => [ - 'CONVERT' => 'Common\ORM\Query\Functions\Convert', - 'CONTAINS' => 'Common\ORM\Query\Functions\Contains', - 'REPLACE' => 'Common\ORM\Query\Functions\Replace', + 'CONVERT' => 'Common\ORM\Query\Functions\Convert', + 'CONTAINS' => 'Common\ORM\Query\Functions\Contains', + 'REPLACE' => 'Common\ORM\Query\Functions\Replace', 'OSE_DIVERS_STRUCTURE_DANS_STRUCTURE' => 'Common\ORM\Query\Functions\OseDivers\StructureDansStructure', - 'compriseEntre' => 'Common\ORM\Query\Functions\OseDivers\CompriseEntre', - 'pasHistorise' => 'Common\ORM\Query\Functions\OseDivers\PasHistorise', + 'compriseEntre' => 'Common\ORM\Query\Functions\OseDivers\CompriseEntre', + 'pasHistorise' => 'Common\ORM\Query\Functions\OseDivers\PasHistorise', ], - 'filters' => [ + 'filters' => [ 'historique' => 'Common\ORM\Filter\HistoriqueFilter', 'etape' => 'Common\ORM\Filter\EtapeFilter', 'annee' => 'Common\ORM\Filter\AnneeFilter', ], - ] + ], ], ], - 'translator' => [ + 'translator' => [ 'translation_file_patterns' => [ [ 'type' => 'phparray', @@ -32,8 +32,9 @@ return [ ], ], 'view_helpers' => [ - 'invokables' => [ - 'cartridge' => 'Common\View\Helper\CartridgeViewHelper', + 'invokables' => [ + 'cartridge' => 'Common\View\Helper\CartridgeViewHelper', + 'formButtonGroup' => 'Common\Form\View\Helper\FormButtonGroup', ], 'initializers' => [ ], diff --git a/module/Common/src/Common/Constants.php b/module/Common/src/Common/Constants.php index 51e7389df7..a084531012 100644 --- a/module/Common/src/Common/Constants.php +++ b/module/Common/src/Common/Constants.php @@ -13,4 +13,6 @@ class Constants const SEXE_M = 'M'; const SEXE_F = 'F'; + + const ADRESSE_PAYS_DEFAULT = 'FRANCE'; } \ No newline at end of file diff --git a/module/Import/Module.php b/module/Import/Module.php index 9574955e26..4914c46af5 100644 --- a/module/Import/Module.php +++ b/module/Import/Module.php @@ -8,9 +8,9 @@ class Module public function getAutoloaderConfig() { return [ - 'Zend\Loader\ClassMapAutoloader' => [ + 'Zend\Loader\ClassMapAutoloader' => array( __DIR__ . '/autoload_classmap.php', - ], + ), 'Zend\Loader\StandardAutoloader' => [ 'namespaces' => [ __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, @@ -24,52 +24,4 @@ class Module return include __DIR__ . '/config/module.config.php'; } - /** - * - * @return array - * @see ServiceProviderInterface - */ - public function getServiceConfig() - { - $services = [ - 'Schema', - 'QueryGenerator', - 'Intervenant', - 'Differentiel', - ]; - $processus = [ - 'Import', - ]; - $factories = []; - $invokables = []; - foreach( $services as $service ){ - $factories['importService'.$service] = function($sm) use ($service){ - $className = 'Import\\Service\\'.$service; - $so = new $className; - return $so; - }; - } - foreach( $processus as $proc ){ - $invokables['importProcessus'.$proc] = 'Import\\Processus\\'.$proc; - } - return [ - 'factories' => $factories, - 'invokables' => $invokables, - ]; - } - - /** - * - * @return array - * @see ViewHelperProviderInterface - */ - public function getViewHelperConfig() - { - return [ - 'invokables' => [ - 'differentielListe' => 'Import\View\Helper\DifferentielListe', - 'differentielLigne' => 'Import\View\Helper\DifferentielLigne\DifferentielLigne', - ], - ]; - } } \ No newline at end of file diff --git a/module/Import/autoload_classmap.php b/module/Import/autoload_classmap.php index 881ab67d03..cfc3634c48 100644 --- a/module/Import/autoload_classmap.php +++ b/module/Import/autoload_classmap.php @@ -1,2 +1,24 @@ <?php -return []; +// Generated by ZF2's ./bin/classmap_generator.php +return array( + 'Import\Module' => __DIR__ . '/Module.php', + 'Import\Entity\Schema\Column' => __DIR__ . '/src/Import/Entity/Schema/Column.php', + 'Import\Entity\Differentiel\Ligne' => __DIR__ . '/src/Import/Entity/Differentiel/Ligne.php', + 'Import\Entity\Differentiel\Query' => __DIR__ . '/src/Import/Entity/Differentiel/Query.php', + 'Import\Service\Intervenant' => __DIR__ . '/src/Import/Service/Intervenant.php', + 'Import\Service\Service' => __DIR__ . '/src/Import/Service/Service.php', + 'Import\Service\Schema' => __DIR__ . '/src/Import/Service/Schema.php', + 'Import\Service\QueryGenerator' => __DIR__ . '/src/Import/Service/QueryGenerator.php', + 'Import\Service\Differentiel' => __DIR__ . '/src/Import/Service/Differentiel.php', + 'Import\Processus\Import' => __DIR__ . '/src/Import/Processus/Import.php', + 'Import\Exception\Exception' => __DIR__ . '/src/Import/Exception/Exception.php', + 'Import\Exception\MissingDependency' => __DIR__ . '/src/Import/Exception/MissingDependency.php', + 'Import\View\Helper\DifferentielListe' => __DIR__ . '/src/Import/View/Helper/DifferentielListe.php', + 'Import\View\Helper\DifferentielLigne\CheminPedagogique' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/CheminPedagogique.php', + 'Import\View\Helper\DifferentielLigne\DifferentielLigne' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/DifferentielLigne.php', + 'Import\View\Helper\DifferentielLigne\ElementPedagogique' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/ElementPedagogique.php', + 'Import\View\Helper\DifferentielLigne\Intervenant' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Intervenant.php', + 'Import\View\Helper\DifferentielLigne\Etape' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Etape.php', + 'Import\View\Helper\DifferentielLigne\Personnel' => __DIR__ . '/src/Import/View/Helper/DifferentielLigne/Personnel.php', + 'Import\Controller\ImportController' => __DIR__ . '/src/Import/Controller/ImportController.php', +); diff --git a/module/Import/config/module.config.php b/module/Import/config/module.config.php index 185e98d27b..e48e43bcb4 100644 --- a/module/Import/config/module.config.php +++ b/module/Import/config/module.config.php @@ -5,13 +5,13 @@ namespace Import; use Application\Entity\Db\Privilege; return [ - 'controllers' => [ + 'controllers' => [ 'invokables' => [ - 'Import\Controller\Import' => 'Import\Controller\ImportController', + 'Import\Controller\Import' => 'Import\Controller\ImportController', ], ], - 'router' => [ + 'router' => [ 'routes' => [ 'import' => [ 'type' => 'Segment', @@ -19,16 +19,16 @@ return [ 'route' => '/import[/:action][/:table]', 'defaults' => [ '__NAMESPACE__' => 'Import\Controller', - 'controller' => 'Import', - 'action' => 'index', - 'table' => null + 'controller' => 'Import', + 'action' => 'index', + 'table' => null, ], ], ], ], ], - 'navigation' => [ + 'navigation' => [ 'default' => [ 'home' => [ 'pages' => [ @@ -37,27 +37,27 @@ return [ 'order' => 1, 'route' => 'import', 'resource' => 'controller/Import\Controller\Import:index', - 'pages' => [ - 'admin' => [ - 'label' => "Tableau de bord principal", - 'route' => 'import', + 'pages' => [ + 'admin' => [ + 'label' => "Tableau de bord principal", + 'route' => 'import', 'resource' => 'controller/Import\Controller\Import:showimporttbl', - 'params' => [ + 'params' => [ 'action' => 'showImportTbl', ], - 'visible' => true, - 'pages' => [ + 'visible' => true, + 'pages' => [ ], ], 'showDiff' => [ - 'label' => "Écarts entre OSE et ses sources", - 'route' => 'import', + 'label' => "Écarts entre OSE et ses sources", + 'route' => 'import', 'resource' => 'controller/Import\Controller\Import:showdiff', - 'params' => [ + 'params' => [ 'action' => 'showDiff', ], - 'visible' => true, + 'visible' => true, ], ], ], @@ -66,7 +66,7 @@ return [ ], ], - 'bjyauthorize' => [ + 'bjyauthorize' => [ 'guards' => [ 'Application\Guard\PrivilegeController' => [ [ @@ -86,7 +86,7 @@ return [ ], [ 'controller' => 'Import\Controller\Import', - 'action' => ['update','updateTables'], + 'action' => ['update', 'updateTables'], 'privileges' => [Privilege::IMPORT_MAJ], ], [ @@ -98,7 +98,27 @@ return [ ], ], - 'view_manager' => [ + 'service_manager' => [ + 'invokables' => [ + 'importServiceSchema' => 'Import\\Service\\Schema', + 'importServiceQueryGenerator' => 'Import\\Service\\QueryGenerator', + 'importServiceIntervenant' => 'Import\\Service\\Intervenant', + 'importServiceDifferentiel' => 'Import\\Service\\Differentiel', + 'importProcessusImport' => 'Import\\Processus\\Import', + ], + 'factories' => [ + + ], + ], + + 'view_helpers' => [ + 'invokables' => [ + 'differentielListe' => 'Import\View\Helper\DifferentielListe', + 'differentielLigne' => 'Import\View\Helper\DifferentielLigne\DifferentielLigne', + ], + ], + + 'view_manager' => [ 'template_path_stack' => [ 'import' => __DIR__ . '/../view', ], diff --git a/public/css/app.css b/public/css/app.css index 524343b5e4..b6d09cabe4 100755 --- a/public/css/app.css +++ b/public/css/app.css @@ -94,6 +94,22 @@ span.element-rech.periode { * Autre */ +dl.dl-horizontal.intervenant dt{ + width: 200px; +} + +dl.dl-horizontal.intervenant dd{ + margin-left: 220px; +} + +dl.dl-horizontal.element dt{ + width: 200px; +} + +dl.dl-horizontal.element dd{ + margin-left: 220px; +} + .nombre { text-align:right; white-space: nowrap; @@ -104,9 +120,20 @@ h1.page-header { } +.modal-header { + padding: 10px; + background-color: #428BCA; + border-top-left-radius: 5px; + border-top-right-radius: 5px; + margin:1px; +} .modal-header h1, .modal-header h2 { - line-height: 90%; + line-height: 90%; + font-size:12pt; + font-weight: 100; + text-shadow: inset; + color: white; } .modal-body h1 { -- GitLab