Files
System-testowy/administrator/components/com_testquestions/src/View/Questions/HtmlView.php
T
2026-10-15 16:30:43 +02:00

62 lines
1.8 KiB
PHP

<?php
namespace Komponent\Component\Testquestions\Administrator\View\Questions;
defined('_JEXEC') or die;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Toolbar\ToolbarHelper;
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
class HtmlView extends BaseHtmlView
{
protected $items;
protected $pagination;
protected $state;
protected $categories;
public function display($tpl = null)
{
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->state = $this->get('State');
$this->categories = $this->get('Categories');
if (count($errors = $this->get('Errors'))) {
throw new \RuntimeException(implode("\n", $errors));
}
$this->addToolbar();
return parent::display($tpl);
}
protected function addToolbar()
{
$user = $this->getCurrentUser();
$this->getDocument()->setTitle(Text::_('COM_TESTQUESTIONS'));
if ($user->authorise('core.create', 'com_testquestions')) {
ToolbarHelper::addNew('question.add', 'JTOOLBAR_NEW');
}
if ($user->authorise('core.edit', 'com_testquestions')) {
ToolbarHelper::editList('question.edit', 'JTOOLBAR_EDIT');
}
if ($user->authorise('core.delete', 'com_testquestions')) {
ToolbarHelper::deleteList('', 'questions.delete', 'JTOOLBAR_DELETE');
}
ToolbarHelper::link(
'index.php?option=com_testquestions&view=categories',
'COM_TESTQUESTIONS_MANAGE_CATEGORIES',
'list'
);
ToolbarHelper::link(
'index.php?option=com_testquestions&view=sets',
'COM_TESTQUESTIONS_SETS',
'list'
);
}
}