-1
<div style="margin-top:10px;">
{foreach from=$aQuiz.results name=questions item=aQuestion} 
    <div class="clearfix quiz_result_item {if is_int($phpfox.iteration.questions/2)}row1{else}row2{/if}{if $phpfox.iteration.questions == 1} row_first{/if}{if $aQuestion.userAnswer == $aQuestion.correctAnswer} row_is_correct{else} row_is_incorrect{/if}">
        <div class="quiz_result_left">
            {$phpfox.iteration.questions}
        </div>
        <div class="quiz_result_right">
            <div class="txt-dark fs-lg-3 quiz_result_question">{$aQuestion.questionText}</div>

            <table><tr><th style="width:20%px;">Answer Choices</th><th>Correct</th> <th>Your Choice</th> <th>User Statistics</th></tr> </table>
            <div>
                <span class="txt-light">{phrase var='quiz.full_name_s_answer' full_name=$aQuestion.full_name}:</span>
                <span class="txt-dark fw-500">{$aQuestion.userAnswerText}</span>
            </div>
            <div>
                <span class="txt-light">{phrase var='quiz.correct_answer'}:</span>
                <span class="txt-dark fw-500">{$aQuestion.correctAnswerText}</span>
                <div class="table_left">{phrase var='quiz.answers'}:</div>


            </div>
        </div>
    </div>
{/foreach}  
</div>

This code shows only the correct answer and userAnswer but I want to access all the answers of a Question I don't how can I access all answers.any help would be appreciated.

Pardeep Kumar
  • 83
  • 1
  • 9

1 Answers1

0

What you referenced in your question is Quiz's template. You need to find the source of $aQuiz, which is typically in block controllers, or in regular controllers.

In your case, most probably you need to look into /PF.Base/module/quiz/include/component/controller/view.class.php.

In process() function you need to select questions from table phpfox_quiz_question indicating quiz_id in this select. Then you can assign results using ->assign(...) that is being called in chain of other setters of $this->template().

Kirk Hammett
  • 656
  • 8
  • 24