[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 // This file is part of Moodle - http://moodle.org/ 2 // 3 // Moodle is free software: you can redistribute it and/or modify 4 // it under the terms of the GNU General Public License as published by 5 // the Free Software Foundation, either version 3 of the License, or 6 // (at your option) any later version. 7 // 8 // Moodle is distributed in the hope that it will be useful, 9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 // GNU General Public License for more details. 12 // 13 // You should have received a copy of the GNU General Public License 14 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 15 16 /** 17 * Module to enable inline editing of a comptency grade. 18 * 19 * @package tool_lp 20 * @copyright 2015 Damyon Wiese 21 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 22 */ 23 24 define(['jquery'], function($) { 25 26 /** 27 * UserCompetencyCourseNavigation 28 * 29 * @param {String} userSelector The selector of the user element. 30 * @param {String} competencySelector The selector of the competency element. 31 * @param {String} baseUrl The base url for the page (no params). 32 * @param {Number} userId The user id 33 * @param {Number} competencyId The competency id 34 * @param {Number} courseId The course id 35 */ 36 var UserCompetencyCourseNavigation = function(userSelector, competencySelector, baseUrl, userId, competencyId, courseId) { 37 this._baseUrl = baseUrl; 38 this._userId = userId + ''; 39 this._competencyId = competencyId + ''; 40 this._courseId = courseId; 41 42 $(userSelector).on('change', this._userChanged.bind(this)); 43 $(competencySelector).on('change', this._competencyChanged.bind(this)); 44 }; 45 46 /** 47 * The user was changed in the select list. 48 * 49 * @method _userChanged 50 * @param {Event} e 51 */ 52 UserCompetencyCourseNavigation.prototype._userChanged = function(e) { 53 var newUserId = $(e.target).val(); 54 var queryStr = '?userid=' + newUserId + '&courseid=' + this._courseId + '&competencyid=' + this._competencyId; 55 document.location = this._baseUrl + queryStr; 56 }; 57 58 /** 59 * The competency was changed in the select list. 60 * 61 * @method _competencyChanged 62 * @param {Event} e 63 */ 64 UserCompetencyCourseNavigation.prototype._competencyChanged = function(e) { 65 var newCompetencyId = $(e.target).val(); 66 var queryStr = '?userid=' + this._userId + '&courseid=' + this._courseId + '&competencyid=' + newCompetencyId; 67 document.location = this._baseUrl + queryStr; 68 }; 69 70 /** @type {Number} The id of the competency. */ 71 UserCompetencyCourseNavigation.prototype._competencyId = null; 72 /** @type {Number} The id of the user. */ 73 UserCompetencyCourseNavigation.prototype._userId = null; 74 /** @type {Number} The id of the course. */ 75 UserCompetencyCourseNavigation.prototype._courseId = null; 76 /** @type {String} Plugin base url. */ 77 UserCompetencyCourseNavigation.prototype._baseUrl = null; 78 /** @type {Boolean} Ignore the first change event for competencies. */ 79 UserCompetencyCourseNavigation.prototype._ignoreFirstCompetency = null; 80 81 return /** @alias module:tool_lp/user_competency_course_navigation */ UserCompetencyCourseNavigation; 82 83 });
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |