Add question set management
This commit is contained in:
@@ -51,5 +51,11 @@ class HtmlView extends BaseHtmlView
|
||||
'COM_TESTQUESTIONS_MANAGE_CATEGORIES',
|
||||
'list'
|
||||
);
|
||||
|
||||
ToolbarHelper::link(
|
||||
'index.php?option=com_testquestions&view=sets',
|
||||
'COM_TESTQUESTIONS_SETS',
|
||||
'list'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Komponent\Component\Testquestions\Administrator\View\Set;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
protected $form;
|
||||
protected $item;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->form = $this->get('Form');
|
||||
$this->item = $this->get('Item');
|
||||
|
||||
if (count($errors = $this->get('Errors'))) {
|
||||
throw new \RuntimeException(implode("\n", $errors));
|
||||
}
|
||||
|
||||
$this->addToolbar();
|
||||
|
||||
return parent::display($tpl);
|
||||
}
|
||||
|
||||
protected function addToolbar()
|
||||
{
|
||||
ToolbarHelper::title($this->item->id ? Text::_('COM_TESTQUESTIONS_EDIT_SET') : Text::_('COM_TESTQUESTIONS_NEW_SET'));
|
||||
ToolbarHelper::apply('set.apply', 'JTOOLBAR_APPLY');
|
||||
ToolbarHelper::save('set.save', 'JTOOLBAR_SAVE');
|
||||
ToolbarHelper::cancel('set.cancel', 'JTOOLBAR_CANCEL');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Komponent\Component\Testquestions\Administrator\View\Sets;
|
||||
|
||||
defined('_JEXEC') or die;
|
||||
|
||||
use Joomla\CMS\HTML\HTMLHelper;
|
||||
use Joomla\CMS\Language\Text;
|
||||
use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView;
|
||||
use Joomla\CMS\Toolbar\ToolbarHelper;
|
||||
|
||||
class HtmlView extends BaseHtmlView
|
||||
{
|
||||
protected $items;
|
||||
protected $pagination;
|
||||
protected $state;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->items = $this->get('Items');
|
||||
$this->pagination = $this->get('Pagination');
|
||||
$this->state = $this->get('State');
|
||||
|
||||
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_SETS'));
|
||||
|
||||
if ($user->authorise('core.create', 'com_testquestions')) {
|
||||
ToolbarHelper::addNew('set.add', 'JTOOLBAR_NEW');
|
||||
}
|
||||
if ($user->authorise('core.edit', 'com_testquestions')) {
|
||||
ToolbarHelper::editList('set.edit', 'JTOOLBAR_EDIT');
|
||||
}
|
||||
if ($user->authorise('core.delete', 'com_testquestions')) {
|
||||
ToolbarHelper::deleteList('', 'sets.delete', 'JTOOLBAR_DELETE');
|
||||
}
|
||||
|
||||
ToolbarHelper::link(
|
||||
'index.php?option=com_testquestions&view=questions',
|
||||
'COM_TESTQUESTIONS_QUESTIONS',
|
||||
'list'
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user