<?php
namespace App\Twig;
use App\Services\Dossiers;
use App\Services\House;
use App\Tools\Houses\SituationStatus;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
class DossiersExtension extends AbstractExtension {
public function __construct(Dossiers $dossiers, House $house) {
$this->dossiers = $dossiers;
$this->house = $house;
}
/**
* {@inheritdoc}
*/
public function getFunctions(): array
{
return [
new TwigFunction('getDossiersItem', [$this, 'getDossiersItem']),
new TwigFunction('getDossiersArrayWidgets', [$this, 'getDossiersArrayWidgets']),
new TwigFunction('getDossiersTotalHtWidgets', [$this, 'getDossiersTotalHtWidgets']),
new TwigFunction('getDossiersTotalTtcWidgets', [$this, 'getDossiersTotalTtcWidgets']),
new TwigFunction('getDossiersHousesDocument', [$this, 'getDossiersHousesDocument']),
new TwigFunction('getHousesSituationTool', [$this, 'getHousesSituationTool']),
];
}
public function getHousesSituationTool($status)
{
return SituationStatus::getStatus($status);
}
public function getDossiersHousesDocument($dossierID,$documentID)
{
return $this->house->getDossierDocument($dossierID,$documentID);
}
public function getDossiersItem($ficheID,$groupID)
{
return $this->dossiers->getItems($ficheID,$groupID);
}
public function getDossiersArrayWidgets($detailID)
{
return $this->dossiers->getArrayWidgets($detailID);
}
public function getDossiersTotalHtWidgets($detailID)
{
return $this->dossiers->getWidgetTotalHT($detailID);
}
public function getDossiersTotalTtcWidgets($detailID)
{
return $this->dossiers->getWidgetTotalTTC($detailID);
}
}