65 lines
2.6 KiB
PHP
65 lines
2.6 KiB
PHP
<?php
|
|
|
|
defined('_JEXEC') or die;
|
|
?>
|
|
<form action="<?php echo Joomla\CMS\Router\Route::_('index.php?option=com_testquestions&layout=edit&id=' . (int) $this->item->id); ?>" method="post" name="adminForm" id="question-form">
|
|
<div class="row">
|
|
<div class="col-lg-8">
|
|
<?php echo $this->form->renderField('question_type'); ?>
|
|
<?php echo $this->form->renderField('question'); ?>
|
|
<?php echo $this->form->renderField('answer_a'); ?>
|
|
<?php echo $this->form->renderField('answer_b'); ?>
|
|
<?php echo $this->form->renderField('answer_c'); ?>
|
|
<?php echo $this->form->renderField('answer_d'); ?>
|
|
<?php echo $this->form->renderField('correct_answer'); ?>
|
|
<?php echo $this->form->renderField('answer_open'); ?>
|
|
</div>
|
|
<div class="col-lg-4">
|
|
<?php echo $this->form->renderField('category_id'); ?>
|
|
<?php echo $this->form->renderField('time_limit'); ?>
|
|
<?php echo $this->form->renderField('points'); ?>
|
|
<?php echo $this->form->renderField('test_symbol'); ?>
|
|
<?php echo $this->form->renderField('exam_year'); ?>
|
|
<?php echo $this->form->renderField('question_number'); ?>
|
|
<?php echo $this->form->renderField('image'); ?>
|
|
<?php echo $this->form->renderField('published'); ?>
|
|
</div>
|
|
</div>
|
|
<?php echo $this->form->renderField('id'); ?>
|
|
<div class="mt-3">
|
|
<a class="btn btn-secondary" href="<?php echo Joomla\CMS\Router\Route::_('index.php?option=com_testquestions&view=questions'); ?>">
|
|
<?php echo Joomla\CMS\Language\Text::_('JTOOLBAR_CANCEL'); ?>
|
|
</a>
|
|
</div>
|
|
<input type="hidden" name="task" value="question.save">
|
|
<?php echo Joomla\CMS\HTML\HTMLHelper::_('form.token'); ?>
|
|
</form>
|
|
<script>
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
const symbol = document.getElementById('jform_test_symbol');
|
|
const fields = ['jform_exam_year', 'jform_question_number'];
|
|
|
|
if (!symbol) {
|
|
return;
|
|
}
|
|
|
|
const toggleExamFields = function () {
|
|
const show = symbol.value.trim() !== '';
|
|
|
|
fields.forEach(function (id) {
|
|
const field = document.getElementById(id);
|
|
const wrapper = field ? field.closest('.control-group, .form-group') : null;
|
|
|
|
if (wrapper) {
|
|
wrapper.classList.toggle('hidden', !show);
|
|
wrapper.style.display = show ? '' : 'none';
|
|
}
|
|
});
|
|
};
|
|
|
|
symbol.addEventListener('input', toggleExamFields);
|
|
symbol.addEventListener('change', toggleExamFields);
|
|
toggleExamFields();
|
|
});
|
|
</script>
|