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 datafield_latlong/latlong
|
|
|
19 |
|
|
|
20 |
The purpose of this template is to enable the user to define a latlong field.
|
|
|
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 |
* name string The field's name.
|
|
|
30 |
* description string The field's description.
|
|
|
31 |
* required bool The field's requiredness.
|
|
|
32 |
* latlonglinkservices array The field's Link out services.
|
|
|
33 |
* otherfields array The field's Other fields.
|
|
|
34 |
* otherfieldsoptgroups array The field's Other fields optgroups.
|
|
|
35 |
* dataid int The field's dataid.
|
|
|
36 |
* fieldid int The field's fieldid.
|
|
|
37 |
|
|
|
38 |
Example context (json):
|
|
|
39 |
{
|
|
|
40 |
"name": "A name",
|
|
|
41 |
"description": "A description",
|
|
|
42 |
"required": true,
|
|
|
43 |
"latlonglinkservices": [ { "name": "Google Maps", "selected": true },
|
|
|
44 |
{ "name": "Google Earth", "selected": false } ],
|
|
|
45 |
"latlonglinkservicessize": 2,
|
|
|
46 |
"otherfields": [ { "name": "Entry #", "value": "-1", "selected": false },
|
|
|
47 |
{ "name": "Latitude/Longitude", "value": "-2", "selected": false } ],
|
|
|
48 |
"otherfieldsoptgroups": [
|
|
|
49 |
{
|
|
|
50 |
"label": "Other fields:",
|
|
|
51 |
"options": [
|
|
|
52 |
{ "name": "Field A", "value": "6", "selected": false },
|
|
|
53 |
{ "name": "Field B", "value": "7", "selected": true }
|
|
|
54 |
]
|
|
|
55 |
}
|
|
|
56 |
],
|
|
|
57 |
"dataid": 6,
|
|
|
58 |
"fieldid": 0
|
|
|
59 |
}
|
|
|
60 |
}}
|
|
|
61 |
|
|
|
62 |
<fieldset>
|
|
|
63 |
{{> mod_data/fields/basicfields }}
|
|
|
64 |
{{> mod_data/fields/requiredfield }}
|
|
|
65 |
<div class="form-group row fitem">
|
|
|
66 |
<div class="col-md-3">
|
|
|
67 |
<label for="param1">{{#str}}latlonglinkservicesdisplayed, data{{/str}}</label>
|
|
|
68 |
</div>
|
|
|
69 |
<div class="col-md-9 form-inline align-items-start felement">
|
|
|
70 |
<select class="linkservicesdisplayed form-control" name="param1[]" id="param1" multiple="multiple" size="{{latlonglinkservicessize}}">
|
|
|
71 |
{{#latlonglinkservices}}
|
|
|
72 |
<option {{#selected}}selected{{/selected}}>{{name}}</option>
|
|
|
73 |
{{/latlonglinkservices}}
|
|
|
74 |
</select>
|
|
|
75 |
</div>
|
|
|
76 |
</div>
|
|
|
77 |
<div class="form-group row fitem">
|
|
|
78 |
<div class="col-md-3">
|
|
|
79 |
<label for="param2" class="mb-0">{{#str}}latlongkmllabelling, data{{/str}}</label>
|
|
|
80 |
</div>
|
|
|
81 |
<div class="col-md-9 form-inline align-items-start felement">
|
|
|
82 |
<select class="kmllabelling select custom-select form-control" name="param2" id="param2">
|
|
|
83 |
{{#otherfields}}
|
|
|
84 |
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
|
|
85 |
{{/otherfields}}
|
|
|
86 |
{{#otherfieldsoptgroups}}
|
|
|
87 |
<optgroup label="{{label}}">
|
|
|
88 |
{{#otherfieldsoptgroups}}
|
|
|
89 |
<option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
|
|
|
90 |
{{/otherfieldsoptgroups}}
|
|
|
91 |
</optgroup>
|
|
|
92 |
{{/otherfieldsoptgroups}}
|
|
|
93 |
</select>
|
|
|
94 |
</div>
|
|
|
95 |
</div>
|
|
|
96 |
{{#fieldid}}
|
|
|
97 |
<div class="form-group row fitem">
|
|
|
98 |
<div class="col-md-3">
|
|
|
99 |
</div>
|
|
|
100 |
<div class="col-md-9 form-inline align-items-start felement">
|
|
|
101 |
<a href='./field/latlong/kml.php?d={{dataid}}&fieldid={{fieldid}}'>{{#str}}latlongdownloadallhint, data{{/str}}</a>
|
|
|
102 |
</div>
|
|
|
103 |
</div>
|
|
|
104 |
{{/fieldid}}
|
|
|
105 |
</fieldset>
|