Skip to content
Snippets Groups Projects
Select Git revision
  • 4cbbeba79f1ea09a54028fa4705fd40fa066ed2d
  • master default
  • php8.2-docker-services
  • 6.x
  • laminas
  • bertrand.gauthier-master-patch-70311
  • bertrand.gauthier-master-patch-87168
  • laminas_migration
  • sqlite
  • 4.0.0
  • 3.2.1
  • 3.2.0
  • 3.1.0
  • 3.0.0
  • 1.0.1
  • 1.0.0
16 results

IndexController.php

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;
        }
    }