55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Komponent\Component\Testquestions\Administrator\View\Preview;
|
|
|
|
defined('_JEXEC') or die;
|
|
|
|
use Joomla\CMS\Factory;
|
|
use Joomla\CMS\Language\Text;
|
|
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
|
use Joomla\CMS\Router\Route;
|
|
use Joomla\CMS\Toolbar\ToolbarHelper;
|
|
|
|
class HtmlView extends BaseHtmlView
|
|
{
|
|
protected $items = [];
|
|
protected $set;
|
|
|
|
public function display($tpl = null)
|
|
{
|
|
$user = Factory::getApplication()->getIdentity();
|
|
if (!$user->authorise('core.edit', 'com_testquestions') && !$user->authorise('core.manage', 'com_testquestions')) {
|
|
throw new \RuntimeException(Text::_('JERROR_ALERTNOAUTHOR'), 403);
|
|
}
|
|
|
|
$this->items = $this->get('Items');
|
|
$this->set = $this->get('Set');
|
|
$this->getDocument()->getWebAssetManager()->registerAndUseStyle(
|
|
'com_testquestions.exam',
|
|
'media/com_testquestions/egzamin.css'
|
|
);
|
|
ToolbarHelper::title(Text::_('COM_TESTQUESTIONS_PREVIEW_TITLE'));
|
|
|
|
if ($this->set) {
|
|
ToolbarHelper::link(
|
|
Route::_('index.php?option=com_testquestions&view=sets'),
|
|
'COM_TESTQUESTIONS_SETS',
|
|
'arrow-left'
|
|
);
|
|
ToolbarHelper::link(
|
|
Route::_('index.php?option=com_testquestions&task=set.edit&id=' . (int) $this->set->id),
|
|
'COM_TESTQUESTIONS_EDIT_SET',
|
|
'edit'
|
|
);
|
|
} else {
|
|
ToolbarHelper::link(
|
|
Route::_('index.php?option=com_testquestions&view=questions'),
|
|
'COM_TESTQUESTIONS',
|
|
'arrow-left'
|
|
);
|
|
}
|
|
|
|
return parent::display($tpl);
|
|
}
|
|
}
|