Skip to content
Snippets Groups Projects
Select Git revision
  • 23122dbcc90fdbbe21494e6914a84d6da8d4dcbd
  • master default protected
  • release/8.0-perimetres
  • php84
  • detached3
  • 6.x
  • 7.x
  • detached2
  • detached
  • php82
  • 5.x
  • cherry-pick-bf3b5271
  • v5.x-test
  • laminas_migration
  • 7.2.9
  • 7.2.8
  • 7.2.7
  • 7.2.6
  • 7.2.5
  • 7.2.4
  • 7.2.3
  • 7.2.2
  • 7.2.1
  • 7.2.0
  • 7.1.3
  • 7.1.2
  • 7.1.1
  • 7.1.0
  • 7.0.1
  • 7.0.0
  • 6.1.11
  • 6.1.10
  • 6.1.9
  • 6.1.8
34 results

001_tables.sql

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