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_lti/categorynode
19
 
20
    Provides a template for the course categories tree view.
21
 
22
    Classes required for JS:
23
    * none
24
 
25
    Data attributes required for JS:
26
    * none
27
 
28
    Context variables required for this template:
29
    * id Course category ID.
30
    * parent Course category parent ID.
31
    * name Course category name.
32
    * haschildren Course category has any sub-category - true/false.
33
 
34
    Example context (json):
35
    {
36
        "id": "5",
37
        "parent": "0",
38
        "name": "Example 1",
39
        "nodes": [{
40
                "id": "6",
41
                "parent": "5",
42
                "name": "Sub category 1",
43
                "nodes": [{
44
                    "id": "7",
45
                    "parent": "6",
46
                    "name": "Sub Sub category 1",
47
                    "nodes": [],
48
                    "haschildren": "0"
49
                }],
50
                "haschildren": "1"
51
            },
52
            {
53
                "id": "8",
54
                "parent": "5",
55
                "name": "Sub category 2",
56
                "nodes": [{
57
                    "id": "9",
58
                    "parent": "8",
59
                    "name": "Sub Sub category 2",
60
                    "nodes": [],
61
                    "haschildren": "0"
62
                }],
63
                "haschildren": "1"
64
            },
65
            {
66
                "id": "593",
67
                "parent": "5",
68
                "name": "Sub category 3",
69
                "nodes": [],
70
                "haschildren": "1"
71
            }
72
        ],
73
        "haschildren": "1"
74
    }
75
}}
76
 
77
 
78
{{^id}}
79
    <div class="accordion modltitree" id="accordion">
80
{{/id}}
81
    {{#nodes}}
82
        {{#haschildren}}
83
        <div class="accordion-group">
84
            <div class="accordion-heading">
85
                <input type="checkbox" class="lticoursecategories" id="cat-{{{id}}}" name="lticoursecategories" value="{{{id}}}">
86
                <label for="cat-{{{id}}}">
87
                    <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion{{{id}}}" href="#collapse{{{id}}}" aria-expanded="true">
88
                        <span>{{{name}}}</span>
89
                    </a>
90
                </label>
91
            </div>
92
            <div id="collapse{{{id}}}" class="accordion-body collapse">
93
                <div class="accordion-inner">
94
                    <div class="accordion" id="accordion{{{id}}}">
95
                        {{>mod_lti/categorynode}}
96
                    </div>
97
                </div>
98
            </div>
99
        </div>
100
        {{/haschildren}}
101
        {{^haschildren}}
102
        <p>
103
            <label for="cat-{{{id}}}">
104
            <input type="checkbox" class="lticoursecategories" id="cat-{{{id}}}" name="lticoursecategories" value="{{{id}}}">
105
                <span>{{{name}}}</span>
106
            </label>
107
        </p>
108
        {{/haschildren}}
109
    {{/nodes}}
110
{{^id}}
111
    </div>
112
{{/id}}