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 mod_unilabel/activity_picker
    Template showing a bootstrap modal dialog to pick an activity instance and get its url.

    Example context (json):
    {
        "formid": "xyzabc-123",
        "hasactivities": 1,
        "activities": [
            {
                "name": "name1",
                "module": "forum",
                "modulename": "Forum",
                "activityname": "Announcements",
                "url": "https://example.com",
                "icon": "https://example.com/img.png",
                "purpose": "content",
                "filterstring": "Forum Announcements",
                "hasavailabilityinfo": 1,
                "availableinfo": [
                    {
                        "text": "Not available unless: ..."
                    }
                ],
                "modstealth": "",
                "stealthinfo": "",
                "hidden": "1",
                "hiddeninfo": "Hidden from students"
            },
            {
                "name": "name1",
                "module": "page",
                "modulename": "Page",
                "activityname": "Text of something",
                "url": "https://example.com",
                "icon": "https://example.com/img.png",
                "purpose": "content",
                "filterstring": "Page Text of something",
                "hasavailabilityinfo": "",
                "availableinfo": "",
                "modstealth": 1,
                "stealthinfo": "Hidden but available",
                "hidden": "",
                "hiddeninfo": ""
            }
        ]
    }
}}

<!-- The Modal -->
<div class="modal fade" tabindex="-1" id="unilabel-modal-activity-picker-{{formid}}">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">

            <!-- Modal Header -->
            <div class="modal-header">
                <h4 class="modal-title"><i class="fa fa-external-link"></i> {{#str}}chooseurlfromactivity, mod_unilabel{{/str}}</h4>
                <button type="button" class="close" data-dismiss="modal">&times;</button>
            </div>

            <!-- Modal body -->
            <div id="unilabel-activity-picker" class="modal-body">
                {{> mod_unilabel/activity_picker_list }}
            </div>
            <!-- Modal footer -->
            <div class="modal-footer">
                <button type="button" class="btn btn-primary" data-dismiss="modal">{{#str}} closebuttontitle {{/str}}</button>
            </div>
        </div>
    </div>
</div>

{{#js}}
    require(['mod_unilabel/activity_picker'], function(activitypicker) {
        activitypicker.init('{{formid}}');
    });
{{/js}}