Proyectos de Subversion Moodle

Rev

| 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": {
42
                "extraclasses": "iconhelp",
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">
55
            <legend>{{#str}} randomfromexistingcategory, mod_quiz {{/str}}</legend>
56
            <!-- Question bank -->
57
            {{{questionbank}}}
58
 
59
            <!-- Select number of random question -->
60
            <label>
61
                {{#str}}randomnumber, mod_quiz{{/str}}
62
                <select id="menurandomcount" name="randomcount" class="form-control custom-select">
63
                    {{#randomoptions}}
64
                        <option value="{{value}}">{{name}}</option>
65
                    {{/randomoptions}}
66
                </select>
67
            </label>
68
 
69
            <!-- Buttons -->
70
            <div class="modal-footer mt-1" data-region="footer">
71
                <input type="hidden" name="message" value="">
72
                <input type="submit" class="btn btn-primary" name="addrandom" value="{{#str}} addrandomquestion, mod_quiz {{/str}}">
73
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
74
            </div>
75
 
76
        </fieldset>
77
 
78
        <fieldset id="id_newcategoryheader">
79
            <legend>{{#str}} randomquestionusinganewcategory, mod_quiz {{/str}}</legend>
80
            <!-- New categoryname -->
81
            <div class="mb-3 row fitem">
82
                <div class="col-md-3 col-form-label d-flex pb-0 pr-md-0">
83
                    <label class="mr-md-2 mb-md-0" for="categoryname">{{#str}} name {{/str}} </label>
84
                </div>
85
                <div class="col-md-9 d-flex flex-wrap align-items-start felement" data-fieldtype="text">
86
                    <input type="text" class="form-control" id="categoryname" name="categoryname" maxlength="254" size="50">
87
                </div>
88
            </div>
89
 
90
            <!-- Select parent of new category -->
91
            <div class="mb-3 row fitem">
92
                <div class="col-md-3 col-form-label d-flex pb-0 pr-md-0">
93
                    <label class="mr-md-2 mb-md-0" for="parentcategory">{{#str}} parentcategory, question {{/str}} </label>
94
                    {{#questioncategoryhelp}}
95
                        {{>core/help_icon}}
96
                    {{/questioncategoryhelp}}
97
                </div>
98
                <div class="col-md-9 d-flex flex-wrap align-items-start felement" data-fieldtype="select">
99
                    <select id="parentcategory" name="parentcategory" class="form-control">
100
                        {{#questioncategoryoptions}}
101
                            <optgroup label="{{label}}">
102
                                {{#options}}
103
                                    <option value="{{value}}">{{{name}}}</option>
104
                                {{/options}}
105
                            </optgroup>
106
                        {{/questioncategoryoptions}}
107
                    </select>
108
                </div>
109
            </div>
110
 
111
            <!-- Buttons -->
112
            <div class="modal-footer mt-1" data-region="footer">
113
                <input type="submit" class="btn btn-primary" name="newcategory" value="{{#str}} createcategoryandaddrandomquestion, mod_quiz {{/str}}">
114
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
115
            </div>
116
        </fieldset>
117
    </form>
118
</div>