Files
kupshop/bundles/KupShop/ShoppingListBundle/View/ShoppingListView.php
2025-08-02 16:30:27 +02:00

60 lines
1.2 KiB
PHP

<?php
namespace KupShop\ShoppingListBundle\View;
use KupShop\KupShopBundle\Views\View;
class ShoppingListView extends View
{
protected string $smartyFallback = 'account';
protected string $entrypoint = 'account';
protected $template = 'shoppingList/list.tpl';
private $user;
private $checkUserLog;
public function getTitle()
{
return translate('title', 'shopping_list');
}
public function getBodyVariables()
{
$vars = parent::getBodyVariables();
$this->checkUserLog();
$this->getUser();
$vars['lists'] = $this->getUserShoppingLists();
return $vars;
}
private function getUserShoppingLists()
{
return $this->user->getShoppingLists();
}
protected function checkUserLog()
{
if ($this->checkUserLog) {
if (!$this->getUser()) {
redirection('LOGIN');
}
}
}
private function getUser()
{
if ($this->user) {
return $this->user;
}
return $this->user = \User::getCurrentUser();
}
public function getBreadcrumbs()
{
return getReturnNavigation(-1, 'USER', [$this->getTitle()]);
}
}