Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54c4c56469 |
@@ -25,6 +25,6 @@ Szkielet komponentu Joomla 6 do gromadzenia pytań testowych.
|
||||
|
||||
## Instalacja
|
||||
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.14.0).
|
||||
W Joomla wybierz **System → Install → Install from Folder** i wskaż ten katalog. Manifestem instalacyjnym jest `com_testquestions.xml` (wersja 1.14.1).
|
||||
|
||||
Po instalacji komponent jest dostępny w panelu administratora jako **Pytania testowe**.
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
-- No database changes required for version 1.14.1.
|
||||
@@ -4,7 +4,7 @@
|
||||
<creationDate>2026-10-14</creationDate>
|
||||
<author>Komponent</author>
|
||||
<license>GNU General Public License version 2 or later</license>
|
||||
<version>1.14.0</version>
|
||||
<version>1.14.1</version>
|
||||
<description>COM_TESTQUESTIONS_DESCRIPTION</description>
|
||||
<element>com_testquestions</element>
|
||||
<namespace path="src">Komponent\Component\Testquestions</namespace>
|
||||
|
||||
@@ -19,3 +19,5 @@ COM_TESTQUESTIONS_MENU_TEST_SYMBOL_DESC="Opcjonalnie wybierz symbol arkusza, kt
|
||||
COM_TESTQUESTIONS_ENTER_ANSWER="Wpisz odpowiedź"
|
||||
COM_TESTQUESTIONS_SET_DURATION="Czas trwania testu"
|
||||
COM_TESTQUESTIONS_SET_NOT_FOUND="Nie znaleziono wybranego zestawu testowego."
|
||||
COM_TESTQUESTIONS_SELECT_SET="Wybierz zestaw pytań"
|
||||
COM_TESTQUESTIONS_SHOW_SET="Pokaż zestaw"
|
||||
|
||||
@@ -56,4 +56,18 @@ class SetModel extends BaseDatabaseModel
|
||||
->order('sq.ordering ASC, q.id ASC')
|
||||
)->loadObjectList();
|
||||
}
|
||||
|
||||
public function getSets()
|
||||
{
|
||||
$db = Factory::getContainer()->get('DatabaseDriver');
|
||||
|
||||
return $db->setQuery(
|
||||
$db->getQuery(true)
|
||||
->select(['s.id', 's.title', 'sub.title AS subject_title'])
|
||||
->from($db->quoteName('#__testquestions_sets', 's'))
|
||||
->leftJoin($db->quoteName('#__testquestions_subjects', 'sub') . ' ON sub.id = s.subject_id')
|
||||
->where('s.published = 1')
|
||||
->order('sub.title ASC, s.title ASC')
|
||||
)->loadObjectList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,12 +11,18 @@ class HtmlView extends BaseHtmlView
|
||||
{
|
||||
protected $set;
|
||||
protected $items;
|
||||
protected $sets;
|
||||
protected $results;
|
||||
|
||||
public function display($tpl = null)
|
||||
{
|
||||
$this->getDocument()->getWebAssetManager()->registerAndUseStyle(
|
||||
'com_testquestions.exam',
|
||||
'media/com_testquestions/egzamin.css'
|
||||
);
|
||||
$this->set = $this->get('Set');
|
||||
$this->items = $this->get('Items');
|
||||
$this->sets = $this->get('Sets');
|
||||
$this->results = $this->buildResults($this->items);
|
||||
|
||||
return parent::display($tpl);
|
||||
|
||||
@@ -3,6 +3,18 @@
|
||||
defined('_JEXEC') or die;
|
||||
?>
|
||||
<div class="com-testquestions egzamin">
|
||||
<form action="<?php echo htmlspecialchars($_SERVER['REQUEST_URI'], ENT_QUOTES, 'UTF-8'); ?>" method="get" class="mb-4">
|
||||
<label for="test-set" class="form-label"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECT_SET'); ?></label>
|
||||
<div class="input-group">
|
||||
<select id="test-set" name="set_id" class="form-select egzamin" required>
|
||||
<option value=""><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SELECT_SET'); ?></option>
|
||||
<?php foreach ($this->sets as $set) : ?>
|
||||
<option value="<?php echo (int) $set->id; ?>" <?php echo $this->set && (int) $this->set->id === (int) $set->id ? 'selected' : ''; ?>><?php echo htmlspecialchars(($set->subject_title ? $set->subject_title . ' — ' : '') . $set->title, ENT_QUOTES, 'UTF-8'); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<input type="submit" class="egzamin" value="<?php echo htmlspecialchars(\Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SHOW_SET'), ENT_QUOTES, 'UTF-8'); ?>">
|
||||
</div>
|
||||
</form>
|
||||
<?php if (!$this->set) : ?>
|
||||
<div class="alert alert-info"><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_SET_NOT_FOUND'); ?></div>
|
||||
<?php else : ?>
|
||||
|
||||
Reference in New Issue
Block a user