68 lines
1.9 KiB
PHP
68 lines
1.9 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'
|
|
);
|
|
|
|
ToolbarHelper::link(
|
|
'index.php?option=com_testquestions&view=results',
|
|
'COM_TESTQUESTIONS_RESULTS',
|
|
'list'
|
|
);
|
|
}
|
|
}
|