$search = optional_param('search', '', PARAM_RAW);
$page = optional_param('page', 0, PARAM_INT);
$addedenrollment = optional_param('enrolcount', 0, PARAM_INT);
- $perpage = 25; // This value is hard-coded to 25 in quickenrolment.js
+ $perpage = optional_param('perpage', 25, PARAM_INT); // This value is hard-coded to 25 in quickenrolment.js
$outcome->response = $manager->get_potential_users($enrolid, $search, $searchanywhere, $page, $perpage, $addedenrollment);
$extrafields = get_extra_user_fields($context);
foreach ($outcome->response['users'] as &$user) {
ASSIGNABLEROLES : 'assignableRoles',
DISABLEGRADEHISTORY : 'disableGradeHistory',
RECOVERGRADESDEFAULT : 'recoverGradesDefault',
- ENROLCOUNT : 'enrolCount'
+ ENROLCOUNT : 'enrolCount',
+ PERPAGE : 'perPage'
};
/** CSS classes for nodes in structure **/
var CSS = {
params['search'] = this.get(UEP.SEARCH).get('value');
params['page'] = this.get(UEP.PAGE);
params['enrolcount'] = this.get(UEP.ENROLCOUNT);
+ params['perpage'] = this.get(UEP.PERPAGE);
if (this.get(UEP.MULTIPLE)) {
alert('oh no there are multiple');
var content = create('<div class="'+CSS.SEARCHRESULTS+'"></div>')
.append(create('<div class="'+CSS.TOTALUSERS+'">'+usersstr+'</div>'))
.append(users);
- if (result.response.totalusers > (this.get(UEP.PAGE)+1)*25) {
+ if (result.response.totalusers > (this.get(UEP.PAGE)+1)*this.get(UEP.PERPAGE)) {
var fetchmore = create('<div class="'+CSS.MORERESULTS+'"><a href="#">'+M.str.enrol.ajaxnext25+'</a></div>');
fetchmore.on('click', this.search, this, true);
content.append(fetchmore)
this.setContent(content);
Y.delegate("click", this.enrolUser, users, '.'+CSS.USER+' .'+CSS.ENROL, this, args);
} else {
- if (result.response.totalusers <= (this.get(UEP.PAGE)+1)*25) {
+ if (result.response.totalusers <= (this.get(UEP.PAGE)+1)*this.get(UEP.PERPAGE)) {
this.get(UEP.BASE).one('.'+CSS.MORERESULTS).remove();
}
}
enrolCount : {
value : 0,
validator : Y.Lang.isNumber
+ },
+ perPage : {
+ value: 25,
+ Validator: Y.Lang.isNumber
}
}
});