mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 08:26:37 +02:00
administration MDL-23287 removed confirmation question when deleting user profile category.
This commit is contained in:
parent
adbb249d99
commit
3cb462d288
1 changed files with 2 additions and 18 deletions
|
@ -41,24 +41,8 @@ switch ($action) {
|
||||||
break;
|
break;
|
||||||
case 'deletecategory':
|
case 'deletecategory':
|
||||||
$id = required_param('id', PARAM_INT);
|
$id = required_param('id', PARAM_INT);
|
||||||
$confirm = optional_param('confirm', 0, PARAM_BOOL);
|
profile_delete_category($id);
|
||||||
$fieldcount = $DB->count_records('user_info_field', array('categoryid'=>$id));
|
redirect($redirect,get_string('deleted'));
|
||||||
if (data_submitted() and ($confirm and confirm_sesskey()) or $fieldcount===0) {
|
|
||||||
|
|
||||||
profile_delete_category($id);
|
|
||||||
redirect($redirect,get_string('deleted'));
|
|
||||||
}
|
|
||||||
|
|
||||||
//ask for confirmation
|
|
||||||
$optionsyes = array ('id'=>$id, 'confirm'=>1, 'action'=>'deletecategory', 'sesskey'=>sesskey());
|
|
||||||
echo $OUTPUT->header();
|
|
||||||
echo $OUTPUT->heading(get_string('profiledeletecategory', 'admin'));
|
|
||||||
|
|
||||||
$formcontinue = new single_button(new moodle_url($redirect, $optionsyes), get_string('yes'), 'post');
|
|
||||||
$formcancel = new single_button(new moodle_url($redirect), get_string('no'), 'get');
|
|
||||||
echo $OUTPUT->confirm(get_string('profileconfirmcategorydeletion', 'admin', $fieldcount), $formcontinue, $formcancel);
|
|
||||||
echo $OUTPUT->footer();
|
|
||||||
die;
|
|
||||||
break;
|
break;
|
||||||
case 'deletefield':
|
case 'deletefield':
|
||||||
$id = required_param('id', PARAM_INT);
|
$id = required_param('id', PARAM_INT);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue