Premiers écrans sur module PointRetrait
This commit is contained in:
54
local/modules/PointRetrait/Hook/AdminHook.php
Normal file
54
local/modules/PointRetrait/Hook/AdminHook.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace PointRetrait\Hook;
|
||||
|
||||
use PointRetrait\PointRetrait;
|
||||
use Thelia\Core\Event\Hook\HookRenderBlockEvent;
|
||||
use Thelia\Core\Event\Hook\HookRenderEvent;
|
||||
use Thelia\Core\Hook\BaseHook;
|
||||
use Thelia\Core\Security\AccessManager;
|
||||
use Thelia\Core\Security\SecurityContext;
|
||||
|
||||
/**
|
||||
* Class AdminHook
|
||||
*/
|
||||
class AdminHook extends BaseHook
|
||||
{
|
||||
protected $securityContext;
|
||||
|
||||
public function __construct(SecurityContext $securityContext)
|
||||
{
|
||||
$this->securityContext = $securityContext;
|
||||
}
|
||||
|
||||
|
||||
public function onMainTopMenuTools(HookRenderEvent $event)
|
||||
{
|
||||
$isGranted = $this->securityContext->isGranted(
|
||||
["ADMIN"],
|
||||
[],
|
||||
[PointRetrait::getModuleCode()],
|
||||
[AccessManager::VIEW]
|
||||
);
|
||||
|
||||
if ($isGranted) {
|
||||
$event->add($this->render("menu-hook.html", $event->getArguments()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Pour afficher la liste des retraits en Point Retrait prévus dans la page d'accueil backOffice */
|
||||
public function displayScheduledWithdrawals(HookRenderBlockEvent $event)
|
||||
{
|
||||
$content = trim($this->render("scheduled-withdrawals.html"));
|
||||
if (!empty($content)) {
|
||||
$event->add([
|
||||
"id" => "block-scheduled-withdrawals",
|
||||
"title" => $this->trans("Scheduled withdrawals", [], PointRetrait::DOMAIN_NAME),
|
||||
"content" => $content,
|
||||
"class" => "col-md-6"
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user