Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{{!
    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 core_question/question_category_selector

    Template for core_question\output\question_category_selector

    Example context (json):
    {
        "categories": [
            {
                "value": "0",
                "disabled": true,
                "label": "Bank name 1"
            },
            {
                "value": "123,456",
                "selected": true,
                "label": "Category 1"
            },
            {
                "value": "124,456",
                "label": "Category 2"
            }
        ]
    }
}}
<div class="question_category_selector">
    <label for="selectcategory{{uniqid}}" class="visually-hidden">{{#str}} questioncategory, core_question {{/str}}</label>
    <select id="selectcategory{{uniqid}}" class="selectcategory" name="selectcategory">
        {{#banks}}
            <optgroup label="{{bankname}}">
                {{#categories}}
                    <option value="{{idcontext}}"{{#selected}} selected{{/selected}}>{{{category}}}</option>
                {{/categories}}
            </optgroup>
        {{/banks}}
        {{#categories}}
            <option {{!
                }}value="{{value}}"{{!
                }}{{#disabled}} disabled class="suggestions-heading"{{/disabled}}{{!
                }}{{#selected}} selected{{/selected}}>
                    {{{label}}}
                </option>
        {{/categories}}
    </select>
</div>