Select Git revision
IntervenantViewHelper.php
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
IntervenantViewHelper.php 3.72 KiB
<?php
namespace Application\View\Helper\Intervenant;
use Zend\View\Helper\AbstractHtmlElement;
use Application\Entity\Db\Intervenant;
use Application\Traits\IntervenantAwareTrait;
/**
* Description of Intervenant
*
* @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
*/
class IntervenantViewHelper extends AbstractHtmlElement
{
use IntervenantAwareTrait;
/**
*
* @param Intervenant $intervenant
*
* @return self
*/
public function __invoke(Intervenant $intervenant = null)
{
if ($intervenant) $this->setIntervenant($intervenant);
return $this;
}
public function __toString()
{
return $this->render();
}
/**
*
*
* @return string Code HTML
*/
public function render()
{
$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()),