{{!
    This file is part of mod_openbook for 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_openbook/myfiles

    Openbook resource folder's myfiles template.

    The purpose of this template is to the contents of the myfiles.

    Example context (json):
    {
        "assign": "<tr><th>Assignment</th><td><a href='https://example.com/mod/assign/view.php?id=10'>Assignment 1</a></td></tr>",
        "timeremaining": "3 days 5 hours",
        "approvalfromdate": "Monday, 20 October 2025, 08:00",
        "approvaltodate": "Friday, 24 October 2025, 17:00",
        "securewindowfromdate": "Monday, 27 October 2025, 08:00",
        "securewindowtodate": "Friday, 31 October 2025, 17:00",
        "hasmyfiles": true,
        "lastmodified": "Wednesday, 22 October 2025, 09:32",
        "myfilestitle": "My uploaded files",
        "myfiles": [
            ["<a href='https://example.com/pluginfile.php/123/mod_openbook/file1.pdf'>file1.pdf</a>"],
            ["<a href='https://example.com/pluginfile.php/124/mod_openbook/file2.docx'>file2.docx</a>"],
            ["<a href='https://example.com/pluginfile.php/125/mod_openbook/image.png'>image.png</a>"]
        ],
        "hascommonteacherfiles": true,
        "commonteacherfilestitle": "My uploaded files",
        "commonteacherfiles": [
            ["<a href='https://example.com/pluginfile.php/123/mod_openbook/file1.pdf'>file1.pdf</a>"],
            ["<a href='https://example.com/pluginfile.php/124/mod_openbook/file2.docx'>file2.docx</a>"],
            ["<a href='https://example.com/pluginfile.php/125/mod_openbook/image.png'>image.png</a>"]
        ]
    }
}}
<table class="table table-striped w-100">
{{#assign}}
    {{{.}}}
{{/assign}}
{{#timeremaining}}
    <tr><th>{{#str}}timeremaining,assign{{/str}}</th><td>{{.}}</td></tr>
{{/timeremaining}}
{{#approvalfromdate}}
    <tr>
        <th>{{#str}}approvalfromdate,openbook{{/str}}</th><td>{{.}}</td>
    </tr>
{{/approvalfromdate}}
{{#approvaltodate}}
    <tr>
        <th>{{#str}}approvaltodate,openbook{{/str}}</th><td>{{.}}</td>
    </tr>
{{/approvaltodate}}
{{#securewindowfromdate}}
    <tr>
        <th>{{#str}}securewindowfromdate,openbook{{/str}}</th><td>{{.}}</td>
    </tr>
{{/securewindowfromdate}}
{{#securewindowtodate}}
    <tr>
        <th>{{#str}}securewindowtodate,openbook{{/str}}</th><td>{{.}}</td>
    </tr>
{{/securewindowtodate}}

{{#hasmyfiles}}
    <tr>
        <th>{{#str}}lastmodified{{/str}}</th>
        <td>{{lastmodified}}</td>
    </tr>
{{/hasmyfiles}}
{{#hascommonteacherfiles}}
<tr>
    <th>{{commonteacherfilestitle}}</th>
    <td>{{#hascommonteacherfiles}}
        <table id="teacherfilestable" class="table-reboot">{{#myfiles}}
            <tr>{{#.}}<td>{{{.}}}</td>{{/.}}</tr>
        {{/myfiles}}
        </table>
    {{/hascommonteacherfiles}}
        {{^hascommonteacherfiles}}
            {{#str}}nofiles,openbook{{/str}}
        {{/hascommonteacherfiles}}
    </td>
</tr>
{{/hascommonteacherfiles}}
<tr>
    <th>{{myfilestitle}}</th>
    <td>{{#hasmyfiles}}
            <table id="myfilestable" class="table-reboot">{{#myfiles}}
                    <tr>{{#.}}<td>{{{.}}}</td>{{/.}}</tr>
                {{/myfiles}}
            </table>
        {{/hasmyfiles}}
        {{^hasmyfiles}}
            {{#str}}nofiles,openbook{{/str}}
        {{/hasmyfiles}}
    </td>
</tr>
</table>
