|
|
|
@@ -41,7 +41,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
|
<?php $pendingAiCount = 0; ?>
|
|
|
|
|
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
|
|
|
|
<?php $candidate = $this->item->questions[(int) $questionId] ?? null; ?>
|
|
|
|
|
<?php if ($candidate && $candidate->question_type === 'open' && empty($answer['correct'])) { $pendingAiCount++; } ?>
|
|
|
|
|
<?php if ($candidate && $candidate->question_type === 'open' && empty($answer['correct']) && trim((string) ($answer['selected'] ?? '')) !== '') { $pendingAiCount++; } ?>
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
<?php if ($pendingAiCount > 0) : ?>
|
|
|
|
|
<div class="mb-3">
|
|
|
|
@@ -72,6 +72,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
|
<h2><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_RESULT_ANSWERS'); ?></h2>
|
|
|
|
|
<?php foreach ($this->item->answers as $questionId => $answer) : ?>
|
|
|
|
|
<?php $question = $this->item->questions[(int) $questionId] ?? null; if (!$question) continue; ?>
|
|
|
|
|
<?php $hasResponse = trim((string) ($answer['selected'] ?? '')) !== ''; ?>
|
|
|
|
|
<article class="mb-4 border rounded p-3">
|
|
|
|
|
<div class="mb-2"><?php echo $question->question; ?></div>
|
|
|
|
|
<?php if (!empty($question->image)) : ?><div class="mb-3"><img src="<?php echo htmlspecialchars($resolveImageUrl($question->image), ENT_QUOTES, 'UTF-8'); ?>" alt="" loading="lazy" style="max-width: 100%; height: auto;"></div><?php endif; ?>
|
|
|
|
@@ -83,7 +84,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<div class="mt-2 <?php echo !empty($answer['correct']) ? 'text-success' : 'text-danger'; ?>"><?php echo !empty($answer['correct']) ? '✓ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_CORRECT') : '✗ ' . \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_ANSWER_INCORRECT'); ?></div>
|
|
|
|
|
<?php if (empty($answer['correct'])) : ?>
|
|
|
|
|
<?php if ($question->question_type === 'open') : ?>
|
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
|
|
<div class="mt-3">
|
|
|
|
|
<button type="submit" name="ai_question_id" value="<?php echo (int) $questionId; ?>" onclick="this.form.task.value='result.ai';" formaction="<?php echo Route::_('index.php?option=com_testquestions&task=result.ai&id=' . (int) $this->item->id); ?>" class="btn btn-outline-primary">
|
|
|
|
|
<?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_EVALUATE'); ?>
|
|
|
|
@@ -104,7 +105,7 @@ $resolveImageUrl = static function ($path) {
|
|
|
|
|
<div class="alert alert-info mt-3"><strong><?php echo \Joomla\CMS\Language\Text::_('COM_TESTQUESTIONS_AI_RESULT'); ?>:</strong><br><?php echo nl2br(htmlspecialchars((string) $answer['ai_feedback'], ENT_QUOTES, 'UTF-8')); ?></div>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
<?php if ($question->question_type === 'open') : ?>
|
|
|
|
|
<?php if ($question->question_type === 'open' && $hasResponse) : ?>
|
|
|
|
|
<div class="row mt-3">
|
|
|
|
|
<div class="col-md-3">
|
|
|
|
|
<label for="awarded-points-<?php echo (int) $questionId; ?>" class="form-label"><?php echo \Joomla\CMS\Language\Text::sprintf('COM_TESTQUESTIONS_RESULT_AWARDED_POINTS', (int) ($question->points ?? 0)); ?></label>
|
|
|
|
|