Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
{{!
2
    This file is part of Moodle - http://moodle.org/
3
 
4
    Moodle is free software: you can redistribute it and/or modify
5
    it under the terms of the GNU General Public License as published by
6
    the Free Software Foundation, either version 3 of the License, or
7
    (at your option) any later version.
8
 
9
    Moodle is distributed in the hope that it will be useful,
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
    GNU General Public License for more details.
13
 
14
    You should have received a copy of the GNU General Public License
15
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
16
}}
17
{{!
18
    @template mod_quiz/add_random_question_form
19
 
20
    From to add random questions.
21
 
22
    Example context (json):
23
    {
24
        "returnurl": "http://example.com",
25
        "randomoptions": [
26
            {"name": "1", "value": "1"},
27
            {"name": "2", "value": "2"}
28
        ],
29
        "questioncategoryoptions": {
30
            "label": "Category 1",
31
            "options": [
32
                {"name": "Category 2", "value": "1"},
33
                {"name": "Category 3", "value": "2"}
34
            ]
35
        },
36
        "questioncategoryhelp": {
37
            "title": "Help with something",
38
            "text": "Help with something",
39
            "url": "http://example.org/help",
40
            "linktext": "",
41
            "icon": {
1441 ariadna 42
                "extraclasses": "",
1 efrain 43
                "attributes": [
44
                    {"name": "src", "value": "../../../pix/help.svg"},
45
                    {"name": "alt", "value": "Help icon"}
46
                ]
47
            }
48
        },
49
        "questionbank": "<pre>Question bank HTML goes here</pre>"
50
    }
51
}}
52
<div class="mt-2 position-relative" data-region="add_random_question_form-container">
53
    <form action="{{returnurl}}" method="POST" id="add_random_question_form" class="mform">
54
        <fieldset id="id_existingcategoryheader">
1441 ariadna 55
            {{^slotid}}
1 efrain 56
            <legend>{{#str}} randomfromexistingcategory, mod_quiz {{/str}}</legend>
1441 ariadna 57
            {{/slotid}}
1 efrain 58
            <!-- Question bank -->
59
            {{{questionbank}}}
60
 
61
            <!-- Select number of random question -->
1441 ariadna 62
            {{^slotid}}
1 efrain 63
            <label>
64
                {{#str}}randomnumber, mod_quiz{{/str}}
1441 ariadna 65
                <select id="menurandomcount" name="randomcount" class="form-control form-select">
1 efrain 66
                    {{#randomoptions}}
67
                        <option value="{{value}}">{{name}}</option>
68
                    {{/randomoptions}}
69
                </select>
70
            </label>
1441 ariadna 71
            {{/slotid}}
1 efrain 72
 
1441 ariadna 73
                        <!-- Buttons -->
1 efrain 74
            <div class="modal-footer mt-1" data-region="footer">
75
                <input type="hidden" name="message" value="">
1441 ariadna 76
                {{#slotid}}
77
                    <input name="slotid" type="hidden" value="{{slotid}}"/>
78
                    <input type="submit" class="btn btn-primary" name="update" value="{{#str}} updatefilterconditon, mod_quiz {{/str}}">
79
                {{/slotid}}
80
                {{^slotid}}
81
                    <input type="submit" class="btn btn-primary" name="addrandom" value="{{#str}} addrandomquestion, mod_quiz {{/str}}">
82
                {{/slotid}}
1 efrain 83
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
84
            </div>
85
 
86
        </fieldset>
87
 
1441 ariadna 88
        {{^slotid}}
1 efrain 89
        <fieldset id="id_newcategoryheader">
90
            <legend>{{#str}} randomquestionusinganewcategory, mod_quiz {{/str}}</legend>
91
            <!-- New categoryname -->
92
            <div class="mb-3 row fitem">
1441 ariadna 93
                <div class="col-md-3 col-form-label d-flex pb-0 pe-md-0">
94
                    <label class="me-md-2 mb-md-0" for="categoryname">{{#str}} name {{/str}} </label>
1 efrain 95
                </div>
96
                <div class="col-md-9 d-flex flex-wrap align-items-start felement" data-fieldtype="text">
97
                    <input type="text" class="form-control" id="categoryname" name="categoryname" maxlength="254" size="50">
98
                </div>
99
            </div>
100
 
101
            <!-- Select parent of new category -->
102
            <div class="mb-3 row fitem">
1441 ariadna 103
                <div class="col-md-3 col-form-label d-flex pb-0 pe-md-0">
104
                    <label class="me-md-2 mb-md-0" for="parentcategory">{{#str}} parentcategory, question {{/str}} </label>
1 efrain 105
                    {{#questioncategoryhelp}}
106
                        {{>core/help_icon}}
107
                    {{/questioncategoryhelp}}
108
                </div>
109
                <div class="col-md-9 d-flex flex-wrap align-items-start felement" data-fieldtype="select">
110
                    <select id="parentcategory" name="parentcategory" class="form-control">
111
                        {{#questioncategoryoptions}}
112
                            <optgroup label="{{label}}">
113
                                {{#options}}
114
                                    <option value="{{value}}">{{{name}}}</option>
115
                                {{/options}}
116
                            </optgroup>
117
                        {{/questioncategoryoptions}}
118
                    </select>
119
                </div>
120
            </div>
121
 
122
            <!-- Buttons -->
123
            <div class="modal-footer mt-1" data-region="footer">
124
                <input type="submit" class="btn btn-primary" name="newcategory" value="{{#str}} createcategoryandaddrandomquestion, mod_quiz {{/str}}">
125
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
126
            </div>
127
        </fieldset>
1441 ariadna 128
        {{/slotid}}
1 efrain 129
    </form>
130
</div>