af8ea1429e1447da21c9ecc1addff1bb5d932e0d
[moodle.git] / admin / tool / lp / templates / competency_picker_user_plans.mustache
1 {{!
2     This file is part of Moodle - http://moodle.org/
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.
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.
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 tool_lp/competency_picker_user_plans
20     Show a competency tree and allow picking a competency.
22     Context variables required for this template:
23     * singlePlan - boolean
25     * plans - array of plans
26       * id
27       * selected
28       * name
30     * plan
31       * id
32       * name
34     * competencies - array of nodes
35       * id - competency id
36       * name - competency idnumber
37       * children - array of children
38       * haschildren - boolean
40     Example context (json):
41     {
42         "singlePlan": false,
43         "plans": [
44             {
45                 "id": "1",
46                 "name": "Plan"
47             }
48         ],
49         "plan": {
50             "id": "1",
51             "name": "Plan"
52         },
53         "competencies": []
54     }
55 }}
57 <div data-region="competencylinktree">
58 {{^singlePlan}}
59     <h3>{{#str}}learningplans, tool_lp{{/str}}</h3>
60     <select data-action="chooseplan" class="custom-select">
61     {{#plans}}
62         <option value="{{id}}" {{#selected}}selected="selected"{{/selected}}>{{{name}}}</option>
63     {{/plans}}
64     </select>
65 {{/singlePlan}}
67 <h3 class="mt-1">{{#str}}locatecompetency, tool_lp{{/str}}</h3>
69 <form data-region="filtercompetencies" data-planid="{{plan.id}}" class="form-inline">
70     <div class="form-group">
71         <label class="accesshide" for="filter{{uniqid}}">{{#str}}search, tool_lp{{/str}}</label>
72         <input type="text" class="form-control" id="filter{{uniqid}}" placeholder="{{#str}}search, tool_lp{{/str}}" value="{{search}}">
73         <button class="btn btn-secondary">{{#pix}}a/search, ,{{#str}}search{{/str}}{{/pix}}</button>
74     </div>
75 </form>
77 <ul data-enhance="linktree" style="display: none;" class="mt-1 competency-tree">
78     <li><span>{{{plan.name}}}</span>
79         <ul>
80             {{#competencies}}
81                 {{> tool_lp/competencies_tree }}
82             {{/competencies}}
83         </ul>
84     </li>
85 </ul>
87 <div data-region="link-buttons" class="mt-1 pull-xs-right">
88     <input type="button" class="btn btn-primary" data-action="add" value="{{#str}}add{{/str}}"/>
89     <input type="button" class="btn btn-secondary" data-action="cancel" value="{{#str}}cancel{{/str}}"/>
90 </div>
91 <div class="clearfix"></div>
92 </div>