60 lines
1.2 KiB
PHP
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()]);
|
|
}
|
|
}
|