mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-23532 enrol - removed general handling of user enrolment editing/unenrolment plugins are now responsible for this
This commit is contained in:
parent
8c6e0ebebb
commit
12a52d7c6e
4 changed files with 4 additions and 120 deletions
|
@ -131,70 +131,4 @@ class enrol_users_addmember_form extends moodleform {
|
|||
|
||||
$this->set_data(array('action'=>'addmember', 'user'=>$user->id));
|
||||
}
|
||||
}
|
||||
|
||||
class enrol_users_edit_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', '');
|
||||
|
||||
$options = array(ENROL_USER_ACTIVE => get_string('participationactive', 'enrol'),
|
||||
ENROL_USER_SUSPENDED => get_string('participationsuspended', 'enrol'));
|
||||
if (isset($options[$ue->status])) {
|
||||
$mform->addElement('select', 'status', get_string('participationstatus', 'enrol'), $options);
|
||||
}
|
||||
|
||||
$mform->addElement('date_selector', 'timestart', get_string('enroltimestart', 'enrol'), array('optional' => true));
|
||||
|
||||
$mform->addElement('date_selector', 'timeend', get_string('enroltimeend', 'enrol'), array('optional' => true));
|
||||
|
||||
$mform->addElement('hidden', 'id');
|
||||
$mform->setType('id', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'ue');
|
||||
$mform->setType('ue', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'action');
|
||||
$mform->setType('action', PARAM_ACTION);
|
||||
|
||||
$mform->addElement('hidden', 'ifilter');
|
||||
$mform->setType('ifilter', PARAM_ALPHA);
|
||||
|
||||
$mform->addElement('hidden', 'page');
|
||||
$mform->setType('page', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'perpage');
|
||||
$mform->setType('perpage', PARAM_INT);
|
||||
|
||||
$mform->addElement('hidden', 'sort');
|
||||
$mform->setType('sort', PARAM_ALPHA);
|
||||
|
||||
$mform->addElement('hidden', 'dir');
|
||||
$mform->setType('dir', PARAM_ALPHA);
|
||||
|
||||
$this->add_action_buttons();
|
||||
|
||||
$this->set_data(array('action'=>'edit', 'ue'=>$ue->id, 'status'=>$ue->status, 'timestart'=>$ue->timestart, 'timeend'=>$ue->timeend));
|
||||
}
|
||||
|
||||
function validation($data, $files) {
|
||||
$errors = parent::validation($data, $files);
|
||||
|
||||
if (!empty($data['timestart']) and !empty($data['timeend'])) {
|
||||
if ($data['timestart'] >= $data['timeend']) {
|
||||
$errors['timestart'] = get_string('error');
|
||||
$errors['timeend'] = get_string('error');
|
||||
}
|
||||
}
|
||||
|
||||
return $errors;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue