Skip to content
Snippets Groups Projects
Select Git revision
  • c74a35371b6916c301dcbb4fffd1e341e40879d1
  • master default protected
  • cleanup_fixtures
  • add-openvox
  • freebsd-14
  • remove-legacy-top-scope-syntax
  • rel430
  • tests
  • revert-363-augeas-module-cleanup
  • release-4.1.0
  • puppet8
  • relax-dependencies
  • rel400
  • mode
  • puppet7
  • release-3.1.0
  • freebsd13
  • freebsd11
  • stdlib
  • centos
  • fedora
  • v5.1.0
  • v5.0.0
  • v4.5.0
  • v4.4.0
  • v4.3.0
  • v4.2.1
  • v4.2.0
  • v4.1.0
  • v4.0.0
  • v3.1.0
  • v3.0.0
  • v2.0.0
  • 1.12.0
  • 1.11.0
  • 1.10.0
  • 1.9.0
  • 1.8.0
  • 1.7.0
  • 1.6.0
  • 1.5.0
41 results

init.pp

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    TypeInterventionAdminViewHelper.php 2.79 KiB
    <?php
    
    namespace Application\View\Helper;
    
    use Application\Entity\Db\TypeIntervention;
    use Application\Filter\StringFromFloat;
    use Application\Service\Traits\TypeInterventionServiceAwareTrait;
    
    /**
     * Aide de vue permettant d'afficher une liste de statuts
     */
    class TypeInterventionAdminViewHelper extends AbstractViewHelper
    {
        use TypeInterventionServiceAwareTrait;
    
        /**
         *
         * @var string
         */
        private $id;
    
        /**
         * @var TypeIntervention
         */
        private $typeIntervention;
    
    
    
        /**
         *
         * @return TypeIntervention
         */
        public function getTypeIntervention()
        {
            return $this->typeIntervention;
        }
    
    
    
        /**
         *
         * @param TypeIntervention $typeIntervention
         *
         * @return self
         */
        public function setTypeIntervention($typeIntervention)
        {
            $this->typeIntervention = $typeIntervention;
    
            return $this;
        }
    
    
    
        /**
         * Helper entry point.
         *
         * @param TypeIntervention $TypeIntervention
         *
         * @return self
         */
        final public function __invoke(TypeIntervention $typeIntervention)
        {
            $this->setTypeIntervention($typeIntervention);
    
            return $this;
        }
    
    
    
        /**
         * Retourne le code HTML généré par cette aide de vue.
         *
         * @return string
         */
        public function __toString()
        {
            return $this->render();
        }
    
    
    
        /**
         * Génère le code HTML.
         *
         * @return string
         */
        public function render($details = false)
        {
            $ti = $this->getTypeIntervention();
    
            $title   = '';
            $statuts = $ti->getTypeInterventionStatut();
            foreach ($statuts as $tis) {
                if ($title) $title .= ' - ';
                $title .= $tis->getStatutIntervenant()->getLibelle();
            }
            $etoile = (strlen($title) ? '&#x2605;' : '');
    
            $url = $this->getView()->url('type-intervention/statut', ['typeIntervention' => $ti->getId()]);
    
            $html = '<td>';
            $html .= $this->getView()->tag('a', [
                'class'              => 'ajax-modal',
                'data-toggle'        => 'tooltip',
                'data-placement'     => 'bottom',
                'title'              => $title,
                'href'               => $url,
                'data-submit-reload' => 'true',
            ])->text(StringFromFloat::run($ti->getTauxHetdService()) . $etoile);
            $html .= '</td><td>';
    
            $html .= $this->getView()->tag('a', [
                'class'              => 'ajax-modal',
                'data-toggle'        => 'tooltip',
                'data-placement'     => 'bottom',
                'title'              => $title,
                'href'               => $url,
                'data-submit-reload' => 'true',
            ])->text(StringFromFloat::run($ti->getTauxHetdComplementaire()) . $etoile);
    
            $html .= '</td>';
    
            return $html;
        }
    }