Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    @template datafield_latlong/latlong

    The purpose of this template is to enable the user to define a latlong field.

    Classes required for JS:
    * none

    Data attributes required for JS:
    * none

    Context variables required for this template:
    * name string The field's name.
    * description string The field's description.
    * required bool The field's requiredness.
    * latlonglinkservices array The field's Link out services.
    * otherfields array The field's Other fields.
    * otherfieldsoptgroups array The field's Other fields optgroups.
    * dataid int The field's dataid.
    * fieldid int The field's fieldid.

    Example context (json):
    {
        "name": "A name",
        "description": "A description",
        "required": true,
        "latlonglinkservices": [ { "name": "Google Maps", "selected": true },
          { "name": "Google Earth", "selected": false } ],
        "latlonglinkservicessize": 2,
        "otherfields": [ { "name": "Entry #", "value": "-1", "selected": false },
          { "name": "Latitude/Longitude", "value": "-2", "selected": false } ],
        "otherfieldsoptgroups": [
            {
                "label": "Other fields:",
                "options": [
                    { "name": "Field A", "value": "6", "selected": false },
                    { "name": "Field B", "value": "7", "selected": true }
                ]
            }
        ],
        "dataid": 6,
        "fieldid": 0
    }
}}

<fieldset>
    {{> mod_data/fields/basicfields }}
    {{> mod_data/fields/requiredfield }}
    <div class="form-group row fitem">
        <div class="col-md-3">
            <label for="param1">{{#str}}latlonglinkservicesdisplayed, data{{/str}}</label>
        </div>
        <div class="col-md-9 form-inline align-items-start felement">
            <select class="linkservicesdisplayed form-control" name="param1[]" id="param1" multiple="multiple" size="{{latlonglinkservicessize}}">
                {{#latlonglinkservices}}
                    <option {{#selected}}selected{{/selected}}>{{name}}</option>
                {{/latlonglinkservices}}
            </select>
        </div>
    </div>
    <div class="form-group row fitem">
        <div class="col-md-3">
            <label for="param2" class="mb-0">{{#str}}latlongkmllabelling, data{{/str}}</label>
        </div>
        <div class="col-md-9 form-inline align-items-start felement">
            <select class="kmllabelling select custom-select form-control" name="param2" id="param2">
                {{#otherfields}}
                    <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
                {{/otherfields}}
                {{#otherfieldsoptgroups}}
                    <optgroup label="{{label}}">
                        {{#otherfieldsoptgroups}}
                            <option value="{{value}}" {{#selected}}selected{{/selected}}>{{name}}</option>
                        {{/otherfieldsoptgroups}}
                    </optgroup>
                {{/otherfieldsoptgroups}}
            </select>
        </div>
    </div>
    {{#fieldid}}
    <div class="form-group row fitem">
        <div class="col-md-3">
        </div>
        <div class="col-md-9 form-inline align-items-start felement">
            <a href='./field/latlong/kml.php?d={{dataid}}&fieldid={{fieldid}}'>{{#str}}latlongdownloadallhint, data{{/str}}</a>
        </div>
    </div>
    {{/fieldid}}
</fieldset>