Commit 16e6f941 authored by lecluse's avatar lecluse
Browse files

Historisation fine (#2843)

View Helper Intervenant
parent 48a72484
......@@ -553,6 +553,7 @@ return array(
'view_helpers' => array(
'invokables' => array(
'formuleTotauxHetd' => 'Application\View\Helper\Intervenant\TotauxHetdViewHelper',
'Intervenant' => 'Application\View\Helper\Intervenant\IntervenantViewHelper',
),
'initializers' => array(
),
......
<?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()
{
return $this->renderLink();
}
public function renderLink()
{
$intervenant = $this->getIntervenant();
if (! $intervenant) return '';
if ($intervenant->getHistoDestruction()){
return '<span class="bg-danger"><abbr title="Cet intervenant a été supprimé de OSE">'.$intervenant.'</abbr></span>';
}
$pourl = $this->getView()->url('intervenant/default', array('action' => 'apercevoir', 'intervenant' => $intervenant->getSourceCode()));
$out = '<a href="'.$pourl.'" data-po-href="'.$pourl.'" class="ajax-modal">'.$intervenant.'</a>';
return $out;
}
}
\ No newline at end of file
......@@ -157,9 +157,7 @@ class Ligne extends AbstractHtmlElement implements ServiceLocatorAwareInterface,
protected function renderIntervenant($intervenant)
{
$pourl = $this->getView()->url('intervenant/default', array('action' => 'apercevoir', 'intervenant' => $intervenant->getSourceCode()));
$out = '<a href="'.$pourl.'" data-po-href="'.$pourl.'" class="ajax-modal services">'.$intervenant.'</a>';
return $out;
return $this->getView()->intervenant( $intervenant )->renderLink();
}
protected function renderStructure($structure)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment