{{!
    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_mooduell/table_questions_teacher
    Template which defines a mooduell view page.
    Classes required for JS:
    * none
    Data attributes required for JS:
    * none
    Context variables required for this template:
    Example context (json):
    
    {
        "categories" : [
            [
               {
                  "catid":"7",
                  "contextid":"1",
                  "catname":"MooDuell Pr\u00e4sentation",
                  "courseid":"50"
               }
            ]
        ],
        "questions" : [
          [
            {
            "questionid" : "2",
            "imageurl" : "https://image.png",
            "imagetext" : "my text",
            "questiontext" : "my question",
            "answers" : [
              {
                "answertext" : "this is the answer",
                "correct" : "true"
              }
            ],
            "questiontype" : "multichoice",
            "length" : "77",
            "categoryname" : "7",
            "warnings" : [
              {
                "warningstet" : "this is a warning"
              }
            ],
            "status" : "OK"
            }
          ]
        ]
    }
}}

<ul>
{{#categories}}
    <li>
        <a href="../../question/edit.php?courseid={{courseid}}&category={{catid}}%2C{{contextid}}">
        {{#str}} addquestionstocategory, mod_mooduell, {{catname}}{{/str}}
        </a>
    </li>
{{/categories}}
</ul>
<table class="generaltable fullwidth fieldslist hidden" id="questionstable">
    <thead>
    <tr>
        <th scope="col">{{#str}} questionid, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} questionimage, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} questiontext, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} questiontype, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} questiontextlength, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} category, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} warnings, mod_mooduell {{/str}}</th>
        <th scope="col">{{#str}} questionstatus, mod_mooduell {{/str}}</th>
    </tr>
    </thead>
    <tbody>
    {{#questions}}
        <tr class="field">
            <td>
                <a href="{{path}}?returnurl=/question/edit.php?courseid={{courseid}}&courseid={{courseid}}&id={{questionid}}">
                {{questionid}}
                </a>
            </td>
            <td>
            {{#imageurl}}
                <a href="{{imageurl}}"><img src="{{imageurl}}" width="100px"></a>
                <p>{{imagetext}}</p>
            {{/imageurl}}
            </td>
            <td>
               <div class='questiontext'>
                    {{{questiontext}}}
                </div>
                <div class='answers'>
                    <ul>
                        {{#answers}}
                            <li>
                                {{#correct}}<span class="correct">{{/correct}}
                                    {{{answertext}}}
                                {{#correct}}</span>{{/correct}}
                            </li>
                        {{/answers}}
                    </ul>
                </div>
            </td>
            <td>{{questiontype}}</td>
            <td>{{length}}</td>
            <td>{{categoryname}}</td>
            <td>
                <ul>
                    {{#warnings}}
                    <li>
                        <span style="color: red">{{message}}</span>
                    </li>
                    {{/warnings}}
                </ul>
            </td>
            <td>{{status}}</td>
        </tr>
    {{/questions}}
    </tbody>
</table>