Your IP : 192.168.165.1


Current Path : C:/xampp/htdocs/moodle/mod/h5pactivity/templates/local/result/
Upload File :
Current File : C:/xampp/htdocs/moodle/mod/h5pactivity/templates/local/result/options.mustache

{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template mod_h5pactivity/local/result/options

    This template will render a choices table inside a H5P activity results report.

    Variables required for this template:
    * options - An array of options
    * optionslabel - The right label for options column
    * correctlabel - The right label for correct answer column
    * answerlabel - The right label for the attempt answer column

    Example context (json):
    {
        "optionslabel": "Choice",
        "correctlabel": "Correct answer",
        "answerlabel": "Attempt answer",
        "options": [
            {
                "description": "Choice 1 text",
                "id": 0,
                "useranswer": {
                    "answer": "Correct answer",
                    "pass": true
                },
                "correctanswer": {
                    "answer": "Answer checked",
                    "checked": true
                }
            },
            {
                "description": "Choice 2 text",
                "id": 1,
                "useranswer": {
                    "answer": "Wrong answer",
                    "fail": true
                },
                "correctanswer": {
                    "answer": "Answer checked",
                    "unchecked": true
                }
            },
            {
                "description": "Choice 3 text",
                "id": 2,
                "useranswer": {
                    "answer": "This was the correct text",
                    "correct": true
                },
                "correctanswer": {
                    "answer": "This was the correct text",
                    "text": true
                }
            },
            {
                "description": "Choice 4 text",
                "id": 3,
                "correctanswer": {
                    "answer": "Some text",
                    "text": true
                }
            },
            {
                "description": "Choice 4 text",
                "id": 3,
                "useranswer": {
                    "answer": "Some wrong text",
                    "incorrect": true
                }
            }
        ]
    }

}}
<table class="table table-striped">
  <thead>
    <tr>
        <th scope="col">{{optionslabel}}</th>
        <th scope="col">{{correctlabel}}</th>
        <th scope="col">{{answerlabel}}</th>
    </tr>
  </thead>
  <tbody>
    {{#options}}
    <tr>
        <td>{{description}}</td>
        <td>{{#correctanswer}}{{>mod_h5pactivity/local/result/answer}}{{/correctanswer}}</td>
        <td>{{#useranswer}}{{>mod_h5pactivity/local/result/answer}}{{/useranswer}}</td>
    </tr>
    {{/options}}
    {{#score}}
    <tr class="table-light">
        <td colspan="2" class="d-none d-sm-table-cell border-top-3 border-dark"></td>
        <td class="d-none d-sm-table-cell border-top border-dark">
            <strong>{{#str}}score, mod_h5pactivity{{/str}}: {{score}}</strong>
        </td>
        <td class="d-table-cell d-sm-none text-right border-top border-dark" colspan="3">
            <strong>{{#str}}score, mod_h5pactivity{{/str}}: {{score}}</strong>
        </td>
    </tr>
    {{/score}}
  </tbody>
</table>