Add read-only test question preview

This commit is contained in:
Wojtek
2026-10-16 20:44:44 +02:00
parent ef5410689d
commit 606612784c
9 changed files with 169 additions and 2 deletions
@@ -0,0 +1,33 @@
<?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\Toolbar\ToolbarHelper;
class HtmlView extends BaseHtmlView
{
protected $items = [];
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->getDocument()->getWebAssetManager()->registerAndUseStyle(
'com_testquestions.exam',
'media/com_testquestions/egzamin.css'
);
ToolbarHelper::title(Text::_('COM_TESTQUESTIONS_PREVIEW_TITLE'));
ToolbarHelper::link('index.php?option=com_testquestions&view=questions', 'COM_TESTQUESTIONS', 'arrow-left');
return parent::display($tpl);
}
}