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
        "questionbank": "<pre>Question bank HTML goes here</pre>"
37
    }
38
}}
39
<div class="mt-2 position-relative" data-region="add_random_question_form-container">
40
    <form action="{{returnurl}}" method="POST" id="add_random_question_form">
41
        <fieldset id="id_existingcategoryheader">
42
            <legend>{{#str}} randomfromexistingcategory, mod_quiz {{/str}}</legend>
43
            <!-- Question bank -->
44
            {{{questionbank}}}
45
 
46
            <!-- Select number of random question -->
47
            <label>
48
                {{#str}}randomnumber, mod_quiz{{/str}}
49
                <select id="menurandomcount" name="randomcount" class="form-control custom-select">
50
                    {{#randomoptions}}
51
                        <option value="{{value}}">{{name}}</option>
52
                    {{/randomoptions}}
53
                </select>
54
            </label>
55
 
56
            <!-- Buttons -->
57
            <div class="modal-footer mt-1" data-region="footer">
58
                <input type="hidden" name="message" value="">
59
                <input type="submit" class="btn btn-primary" name="addrandom" value="{{#str}} addrandomquestion, mod_quiz {{/str}}">
60
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
61
            </div>
62
 
63
        </fieldset>
64
 
65
        <fieldset id="id_newcategoryheader">
66
            <legend>{{#str}} randomquestionusinganewcategory, mod_quiz {{/str}}</legend>
67
            <!-- New categoryname -->
68
            <label class="mr-md-2 mb-md-0" for="categoryname">{{#str}} name {{/str}} </label>
69
            <input type="text" class="form-control" id="categoryname" name="categoryname" maxlength="254" size="50">
70
 
71
            <!-- Select number of random question -->
72
            <label class="mr-md-2 mb-md-0" for="parentcategory">{{#str}} parentcategory, question {{/str}} </label>
73
            <select id="parentcategory" name="parentcategory" class="form-control">
74
                {{#questioncategoryoptions}}
75
                    <optgroup label="{{label}}">
76
                        {{#options}}
77
                            <option value="{{value}}">{{{name}}}</option>
78
                        {{/options}}
79
                    </optgroup>
80
                {{/questioncategoryoptions}}
81
            </select>
82
 
83
            <!-- Buttons -->
84
            <div class="modal-footer mt-1" data-region="footer">
85
                <input type="submit" class="btn btn-primary" name="newcategory" value="{{#str}} createcategoryandaddrandomquestion, mod_quiz {{/str}}">
86
                <input type="submit" class="btn btn-secondary" name="cancel" value="{{#str}} cancel {{/str}}">
87
            </div>
88
        </fieldset>
89
    </form>
90
</div>