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

Ajout de l'utilisation du service Immobilier dans les vues associées aux postes

parent cc0d4900
Loading
Loading
Loading
Loading
+1 −1
Changes for composer.json: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@
        "unicaen/app":                  "^1.2",
        "unicaen/auth":                 "^1.2",
        "unicaen/ldap": "^2.2",
        "unicaen/octopus": "^0.1.0"
        "unicaen/octopus": "^0.2.0"
    },
    "require-dev": {
        "unicaen/code":                         "^1.0",
+3 −2
Changes for module/Application/config/merged/poste.config.php: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ use Application\Provider\Privilege\PostePrivileges;
use Application\Service\Poste\PosteService;
use Application\Service\Poste\PosteServiceFactory;
use Application\View\Helper\PosteViewHelper;
use Application\View\Helper\PosteViewHelperFactory;
use UnicaenAuth\Guard\PrivilegeController;
use Zend\Mvc\Router\Http\Literal;
use Zend\Mvc\Router\Http\Segment;
@@ -153,8 +154,8 @@ return [
        ]
    ],
    'view_helpers' => [
        'invokables' => [
            'poste' => PosteViewHelper::class,
        'factories' => [
            'poste' => PosteViewHelperFactory::class,
        ],
    ],

+1
Changes for module/Application/src/Application/Controller/Poste/PosteController.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class PosteController extends AbstractActionController {
        
        return new ViewModel([
            'postes' => $postes,
            'immobilierService' => $this->getImmobiliserService(),
        ]);
    }

+4 −1
Changes for module/Application/src/Application/View/Helper/PosteViewHelper.php: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -3,10 +3,12 @@
namespace Application\View\Helper;

use Application\Entity\Db\Poste;
use Octopus\Service\Immobilier\ImmobilierServiceAwareTrait;
use Zend\View\Helper\AbstractHelper;

class PosteViewHelper extends AbstractHelper
{
    use ImmobilierServiceAwareTrait;

    /** @var Poste */
    protected $poste;
@@ -40,7 +42,8 @@ class PosteViewHelper extends AbstractHelper
        $texte .= '<dt> Affectation du poste </dt>';
        $texte .= '<dd class="siham">'.$poste->getAffectation()->getLibelle().'</dd>';
        $texte .= '<dt> Localisation du poste </dt>';
        $texte .= '<dd class="siham">'.$poste->getLocalisation().'</dd>';
//        $texte .= '<dd class="siham">'.$poste->getLocalisation().'</dd>';
        $texte .= '<dd class="siham">'.$this->getImmobiliserService()->getImmobilierBatiment($poste->getLocalisation()).'</dd>';
        $texte .= '<dt> Rattachement hiérarchique </dt>';
        $texte .= '<dd class="siham">'.(($poste->getRattachementHierarchique())?$poste->getRattachementHierarchique()->getDenomination():"---").'</dd>';
        $texte .= '<dt> Catégorie </dt>';
+20
Changes for module/Application/src/Application/View/Helper/PosteViewHelperFactory.php: 20 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\View\Helper;

use Octopus\Service\Immobilier\ImmobilierService;
use Zend\View\HelperPluginManager;

class PosteViewHelperFactory {

    public function __invoke(HelperPluginManager $manager)
    {
        /** @var ImmobilierService $immobilierService */
        $immobilierService = $manager->getServiceLocator()->get(ImmobilierService::class);

        /** @var PosteViewHelper $helper */
        $helper = new PosteViewHelper();
        $helper->setImmobiliserService($immobilierService);
        return $helper;
    }
}
 No newline at end of file
Loading