Files
moodle/lib/amd/build/form-cohort-selector.min.js
Damyon Wiese a60e8ba51e MDL-59365 enrol_manual: Rewrite the yui enrolment popup in amd
The add/roles thing was only converted to bootstrap 2/4 markup and the yui left in place.

The modal for adding users to a course was unsavable so I rewrote it with an mform in a popup, still calling
the same (barely) modified ajax script.

The webservice for searching cohorts was taken from admin/tool/lp and moved into /cohort. I added a generic "cohort"
mform element at the same time.

The webservice for searching for users was taken from the original ajax script.
2017-07-11 13:47:26 +01:00

1 line
577 B
JavaScript

define(["core/ajax","jquery"],function(a,b){return{processResults:function(a,c){var d=[],e=0,f=String(b(a).data("exclude")).split(",");for(e=0;e<c.cohorts.length;e++)f.indexOf(String(c.cohorts[e].id))===-1&&d.push({value:c.cohorts[e].id,label:c.cohorts[e].name});return d},transport:function(c,d,e,f){var g=b(c),h=null;"undefined"==typeof d&&(d="");var i=g.data("contextid"),j={query:d,includes:"parents",limitfrom:0,limitnum:100,context:{contextid:i}},k=[{methodname:"core_cohort_search_cohorts",args:j}];h=a.call(k),b.when.apply(b.when,h).done(function(a){e(a)}).fail(f)}}});