MDL-24064 disabling bulk enrol for now, it needs to be rewritten a bit; fixing incorrect sue of PARAM_CLEAN

This commit is contained in:
Petr Skoda 2010-09-02 18:08:04 +00:00
parent 7e4341f9f5
commit ceb65471f7
3 changed files with 10 additions and 6 deletions

View File

@ -24,7 +24,7 @@ if ($data = $action_form->get_data()) {
case 3: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_delete.php');
case 4: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_display.php');
case 5: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_download.php');
case 6: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_enrol.php');
//case 6: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_enrol.php'); //TODO: MDL-24064
case 7: redirect($CFG->wwwroot.'/'.$CFG->admin.'/user/user_bulk_forcepasswordchange.php');
}
}

View File

@ -2,6 +2,9 @@
/**
* script for bulk user multy enrol operations
*/
die('this needs to be rewritten to use new enrol framework, sorry'); //TODO: MDL-24064
require_once('../../config.php');
require_once($CFG->libdir.'/adminlib.php');
$processed = optional_param('processed', '', PARAM_CLEAN);
@ -75,7 +78,7 @@ if(!empty($processed)) {
for ( $i = 0; $i < $total; $i++ )
{
$param = "selected".$i;
$info = optional_param($param, '', PARAM_CLEAN);
$info = optional_param($param, '', PARAM_SEQUENCE);
/**
* user id: ids[0]
* course id: ids[1]
@ -84,7 +87,7 @@ if(!empty($processed)) {
$ids = explode(',', $info);
if(!empty($ids[2])) {
$context = get_context_instance(CONTEXT_COURSE, $ids[1]);
role_assign(5, $ids[0], $context->id);
role_assign(5, $ids[0], $context->id); //TODO: horrible!!
} else {
if( empty($ids[1] ) ) {
continue;
@ -93,7 +96,7 @@ if(!empty($processed)) {
role_unassign(5, $ids[0], $context->id);
}
}
redirect($return, get_string('changessaved'));
redirect($return, get_string('changessaved')); //TODO: horrible!!
}
//Form beginning

View File

@ -24,8 +24,9 @@ class user_bulk_action_form extends moodleform {
if (has_capability('moodle/user:update', $syscontext)) {
$actions[5] = get_string('download', 'admin');
}
if (has_capability('moodle/role:assign', $syscontext)){ //TODO: use some enrol cap
$actions[6] = get_string('enrolmultipleusers', 'admin');
if (has_capability('moodle/role:assign', $syscontext)){
//TODO: MDL-24064
//$actions[6] = get_string('enrolmultipleusers', 'admin');
}
if (has_capability('moodle/user:update', $syscontext)) {
$actions[7] = get_string('forcepasswordchange');