Files

68 lines
1.8 KiB
PHP

<?php
namespace PlanificationLivraison\Hook;
use PlanificationLivraison\PlanificationLivraison;
use Thelia\Core\Event\Hook\HookRenderEvent;
use Thelia\Core\Hook\BaseHook;
use Thelia\Core\Security\AccessManager;
use Thelia\Core\Security\SecurityContext;
/**
* Class BackHook
* @package PlanificationLivraison\Hook
*/
class BackHook extends BaseHook
{
protected $securityContext;
public function __construct(SecurityContext $securityContext)
{
$this->securityContext = $securityContext;
}
public function onModuleConfiguration(HookRenderEvent $event)
{
$module_id = self::getModule()->getModuleId();
$event->add($this->render("module_configuration.html", ['module_id' => $module_id]));
}
public function onMainTopMenuTools(HookRenderEvent $event)
{
$isGranted = $this->securityContext->isGranted(
["ADMIN"],
[],
[PlanificationLivraison::getModuleCode()],
[AccessManager::VIEW]
);
if ($isGranted) {
$event->add($this->render("menu-hook.html", $event->getArguments()));
}
}
public function onAddJS(HookRenderEvent $event)
{
$datePickerJS = $this->addJS('assets/js/bootstrap-datepicker.js');
$event->add($datePickerJS);
$frenchDatePickerJS = $this->addJS('assets/js/bootstrap-datepicker.fr.js');
$event->add($frenchDatePickerJS);
}
public function onAddCSS(HookRenderEvent $event)
{
$datePickerCSS = $this->addCSS('assets/css/bootstrap-datepicker3.css');
$event->add($datePickerCSS);
$customCSS = $this->addCSS('assets/css/custom.css');
$event->add($customCSS);
$printCSS = $this->addCSS('assets/css/print.css');
$event->add($printCSS);
}
}