diff --git a/enrol/editenrolment.php b/enrol/editenrolment.php index 8b6f54efe11..54f18efc46e 100644 --- a/enrol/editenrolment.php +++ b/enrol/editenrolment.php @@ -41,7 +41,7 @@ $instance = $DB->get_record('enrol', array('id'=>$ue->enrolid), '*', MUST_EXIST) $course = $DB->get_record('course', array('id'=>$instance->courseid), '*', MUST_EXIST); // The URL of the enrolled users page for the course. -$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id)); +$usersurl = new moodle_url('/user/index.php', array('id' => $course->id)); // Do not allow any changes if plugin disabled, not available or not suitable. if (!$plugin = enrol_get_plugin($instance->enrol)) { diff --git a/enrol/editenrolment_form.php b/enrol/editenrolment_form.php index 8bdc46611de..307346c4125 100644 --- a/enrol/editenrolment_form.php +++ b/enrol/editenrolment_form.php @@ -28,15 +28,10 @@ require_once("$CFG->libdir/formslib.php"); class enrol_user_enrolment_form extends moodleform { function definition() { - global $CFG, $DB; - $mform = $this->_form; - $user = $this->_customdata['user']; - $course = $this->_customdata['course']; - $ue = $this->_customdata['ue']; - - $mform->addElement('header','general', ''); + $ue = $this->_customdata['ue']; + $modal = !empty($this->_customdata['modal']); $options = array(ENROL_USER_ACTIVE => get_string('participationactive', 'enrol'), ENROL_USER_SUSPENDED => get_string('participationsuspended', 'enrol')); @@ -56,7 +51,10 @@ class enrol_user_enrolment_form extends moodleform { $mform->addElement('hidden', 'ifilter'); $mform->setType('ifilter', PARAM_ALPHA); - $this->add_action_buttons(); + // Show action buttons if this is not being rendered as a fragment. + if (!$modal) { + $this->add_action_buttons(); + } $this->set_data(array( 'ue' => $ue->id, @@ -71,8 +69,7 @@ class enrol_user_enrolment_form extends moodleform { if (!empty($data['timestart']) and !empty($data['timeend'])) { if ($data['timestart'] >= $data['timeend']) { - $errors['timestart'] = get_string('error'); - $errors['timeend'] = get_string('error'); + $errors['timeend'] = get_string('enroltimeendinvalid', 'enrol'); } } diff --git a/enrol/unenroluser.php b/enrol/unenroluser.php index 99033919001..fe1fc18d190 100644 --- a/enrol/unenroluser.php +++ b/enrol/unenroluser.php @@ -58,8 +58,7 @@ if (!$plugin->allow_unenrol_user($instance, $ue) or !has_capability("enrol/$inst $manager = new course_enrolment_manager($PAGE, $course, $filter); $table = new course_enrolment_users_table($manager, $PAGE); -$returnurl = new moodle_url('/enrol/users.php', array('id' => $course->id)+$manager->get_url_params()+$table->get_url_params()); -$usersurl = new moodle_url('/enrol/users.php', array('id' => $course->id)); +$usersurl = new moodle_url('/user/index.php', array('id' => $course->id)); $PAGE->set_pagelayout('admin'); navigation_node::override_active_url($usersurl); @@ -67,7 +66,7 @@ navigation_node::override_active_url($usersurl); // If the unenrolment has been confirmed and the sesskey is valid unenrol the user. if ($confirm && confirm_sesskey()) { $plugin->unenrol_user($instance, $ue->userid); - redirect($returnurl); + redirect($usersurl); } $yesurl = new moodle_url($PAGE->url, array('confirm'=>1, 'sesskey'=>sesskey())); @@ -82,5 +81,5 @@ $PAGE->navbar->add($fullname); echo $OUTPUT->header(); echo $OUTPUT->heading($fullname); -echo $OUTPUT->confirm($message, $yesurl, $returnurl); +echo $OUTPUT->confirm($message, $yesurl, $usersurl); echo $OUTPUT->footer(); diff --git a/lang/en/enrol.php b/lang/en/enrol.php index 5f6af83f413..d60f50a6d3c 100644 --- a/lang/en/enrol.php +++ b/lang/en/enrol.php @@ -43,6 +43,7 @@ $string['deleteinstancenousersconfirm'] = 'You are about to delete the enrolment $string['disableinstanceconfirmself'] = 'Are you really sure you want to disable instance "{$a->name}" that gives you access to this course? It is possible that you will not be able to access this course if you continue.'; $string['durationdays'] = '{$a} days'; $string['editenrolment'] = 'Edit enrolment'; +$string['edituserenrolment'] = 'Edit {$a}\'s enrolment'; $string['enrol'] = 'Enrol'; $string['enrolcandidates'] = 'Not enrolled users'; $string['enrolcandidatesmatching'] = 'Matching not enrolled users'; @@ -67,6 +68,7 @@ $string['enrolusers'] = 'Enrol users'; $string['enrolxusers'] = 'Enrol {$a} users'; $string['enroltimecreated'] = 'Enrolment created'; $string['enroltimeend'] = 'Enrolment ends'; +$string['enroltimeendinvalid'] = 'Enrolment end date must be after the enrolment start date'; $string['enroltimestart'] = 'Enrolment starts'; $string['errajaxfailedenrol'] = 'Failed to enrol user'; $string['errajaxsearch'] = 'Error when searching users';