2009-10-12 21:46:16 +00:00
|
|
|
<?php
|
|
|
|
|
2010-09-24 02:45:39 +00:00
|
|
|
require_once($CFG->libdir.'/formslib.php');
|
2009-10-12 21:46:16 +00:00
|
|
|
|
|
|
|
|
2009-10-16 07:55:34 +00:00
|
|
|
class webservice_test_client_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
2009-10-21 18:25:00 +00:00
|
|
|
list($functions, $protocols) = $this->_customdata;
|
2009-10-16 07:55:34 +00:00
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
2010-01-13 10:10:27 +00:00
|
|
|
$authmethod = array('simple' => 'simple', 'token' => 'token');
|
|
|
|
$mform->addElement('select', 'authmethod', get_string('authmethod', 'webservice'), $authmethod);
|
|
|
|
|
2009-10-21 18:25:00 +00:00
|
|
|
$mform->addElement('select', 'protocol', get_string('protocol', 'webservice'), $protocols);
|
|
|
|
|
2009-10-16 07:55:34 +00:00
|
|
|
$mform->addElement('select', 'function', get_string('function', 'webservice'), $functions);
|
|
|
|
|
|
|
|
$this->add_action_buttons(false, get_string('select'));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-22 23:07:21 +00:00
|
|
|
// === Test client forms ===
|
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
class moodle_user_create_users_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
/// specific to the create users function
|
|
|
|
$mform->addElement('text', 'username', 'username');
|
|
|
|
$mform->addElement('text', 'password', 'password');
|
|
|
|
$mform->addElement('text', 'firstname', 'firstname');
|
|
|
|
$mform->addElement('text', 'lastname', 'lastname');
|
|
|
|
$mform->addElement('text', 'email', 'email');
|
|
|
|
|
2010-05-25 03:44:29 +00:00
|
|
|
$mform->addElement('text', 'customfieldtype', 'customfieldtype');
|
|
|
|
$mform->addElement('text', 'customfieldvalue', 'customfieldvalue');
|
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
2010-05-25 03:44:29 +00:00
|
|
|
|
|
|
|
//set customfields
|
|
|
|
if (!empty($data->customfieldtype)) {
|
|
|
|
$data->customfields = array(array('type' => $data->customfieldtype, 'value' => $data->customfieldvalue));
|
|
|
|
}
|
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2010-05-25 03:44:29 +00:00
|
|
|
unset($data->customfieldtype);
|
|
|
|
unset($data->customfieldvalue);
|
2010-02-11 04:02:04 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['users'] = array();
|
|
|
|
$params['users'][] = (array)$data;
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class moodle_user_update_users_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
/// specific to the create users function
|
|
|
|
$mform->addElement('text', 'id', 'id');
|
|
|
|
$mform->addRule('id', get_string('required'), 'required', null, 'client');
|
|
|
|
$mform->addElement('text', 'username', 'username');
|
|
|
|
$mform->addElement('text', 'password', 'password');
|
|
|
|
$mform->addElement('text', 'firstname', 'firstname');
|
|
|
|
$mform->addElement('text', 'lastname', 'lastname');
|
|
|
|
$mform->addElement('text', 'email', 'email');
|
|
|
|
|
2010-02-15 08:56:51 +00:00
|
|
|
|
|
|
|
$mform->addElement('text', 'customfieldtype', 'customfieldtype');
|
|
|
|
$mform->addElement('text', 'customfieldvalue', 'customfieldvalue');
|
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
2010-02-15 08:56:51 +00:00
|
|
|
//set customfields
|
|
|
|
if (!empty($data->customfieldtype)) {
|
|
|
|
$data->customfields = array(array('type' => $data->customfieldtype, 'value' => $data->customfieldvalue));
|
|
|
|
}
|
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2010-02-15 08:56:51 +00:00
|
|
|
unset($data->customfieldtype);
|
|
|
|
unset($data->customfieldvalue);
|
2010-02-11 04:02:04 +00:00
|
|
|
|
|
|
|
foreach($data as $key => $value) {
|
|
|
|
if (empty($value)) {
|
|
|
|
unset($data->{$key});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['users'] = array();
|
|
|
|
$params['users'][] = (array)$data;
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class moodle_user_delete_users_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
/// beginning of specific code to the create users function
|
|
|
|
$mform->addElement('text', 'userids[0]', 'userids[0]');
|
|
|
|
$mform->addElement('text', 'userids[1]', 'userids[1]');
|
|
|
|
$mform->addElement('text', 'userids[2]', 'userids[2]');
|
|
|
|
$mform->addElement('text', 'userids[3]', 'userids[3]');
|
|
|
|
/// end of specific code to the create users function
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
|
|
|
|
|
|
|
/// beginning of specific code to the create users form
|
|
|
|
$params = array();
|
|
|
|
$params['userids'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->userids[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['userids'][] = $data->userids[$i];
|
|
|
|
}
|
|
|
|
/// end of specific code to the create users function
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
2010-02-11 04:02:04 +00:00
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class moodle_user_get_users_by_id_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
/// beginning of specific code to the create users function
|
|
|
|
$mform->addElement('text', 'userids[0]', 'userids[0]');
|
|
|
|
$mform->addElement('text', 'userids[1]', 'userids[1]');
|
|
|
|
$mform->addElement('text', 'userids[2]', 'userids[2]');
|
|
|
|
$mform->addElement('text', 'userids[3]', 'userids[3]');
|
|
|
|
/// end of specific code to the create users function
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
|
|
|
|
|
|
|
/// beginning of specific code to the create users form
|
|
|
|
$params = array();
|
|
|
|
$params['userids'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->userids[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['userids'][] = $data->userids[$i];
|
|
|
|
}
|
|
|
|
/// end of specific code to the create users function
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-22 23:54:35 +00:00
|
|
|
class moodle_group_create_groups_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
2009-10-22 23:54:35 +00:00
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
|
|
|
|
2009-10-22 23:54:35 +00:00
|
|
|
$mform->addElement('text', 'courseid', 'courseid');
|
|
|
|
$mform->addElement('text', 'name', 'name');
|
|
|
|
$mform->addElement('text', 'description', 'description');
|
|
|
|
$mform->addElement('text', 'enrolmentkey', 'enrolmentkey');
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
MDL-21782 reworked enrolment framework, the core infrastructure is in place, the basic plugins are all implemented; see the tracker issue for list of unfinished bits, expect more changes and improvements during the next week
AMOS START
MOV [sendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage,enrol_self]
MOV [configsendcoursewelcomemessage,core_admin],[sendcoursewelcomemessage_desc,enrol_self]
MOV [enrolstartdate,core],[enrolstartdate,enrol_self]
MOV [enrolenddate,core],[enrolenddate,enrol_self]
CPY [welcometocourse,core],[welcometocourse,enrol_self]
CPY [welcometocoursetext,core],[welcometocoursetext,enrol_self]
MOV [notenrollable,core],[notenrollable,core_enrol]
MOV [enrolenddaterror,core],[enrolenddaterror,enrol_self]
MOV [enrolmentkeyhint,core],[passwordinvalidhint,enrol_self]
MOV [coursemanager,core_admin],[coursecontact,core_admin]
MOV [configcoursemanager,core_admin],[coursecontact_desc,core_admin]
MOV [enrolledincourserole,core],[enrolledincourserole,enrol_manual]
MOV [enrolme,core],[enrolme,core_enrol]
MOV [unenrol,core],[unenrol,core_enrol]
MOV [unenrolme,core],[unenrolme,core_enrol]
MOV [enrolmentnew,core],[enrolmentnew,core_enrol]
MOV [enrolmentnewuser,core],[enrolmentnewuser,core_enrol]
MOV [enrolments,core],[enrolments,core_enrol]
MOV [enrolperiod,core],[enrolperiod,core_enrol]
MOV [unenrolroleusers,core],[unenrolroleusers,core_enrol]
AMOS END
2010-06-21 15:30:49 +00:00
|
|
|
|
2010-01-13 10:10:27 +00:00
|
|
|
|
2009-10-22 23:54:35 +00:00
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['groups'] = array();
|
|
|
|
$params['groups'][] = (array)$data;
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
2009-10-22 23:54:35 +00:00
|
|
|
}
|
|
|
|
|
2009-10-12 21:46:16 +00:00
|
|
|
class moodle_group_get_groups_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-10-12 21:46:16 +00:00
|
|
|
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
|
|
|
|
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
|
|
|
|
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
|
|
|
|
$mform->addElement('text', 'groupids[3]', 'groupids[3]');
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
2009-10-21 18:25:00 +00:00
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
2009-10-12 21:46:16 +00:00
|
|
|
|
2009-10-22 23:07:21 +00:00
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
2009-10-12 21:46:16 +00:00
|
|
|
}
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['groupids'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->groupids[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['groupids'][] = $data->groupids[$i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
2009-10-22 23:07:21 +00:00
|
|
|
}
|
|
|
|
|
2009-10-22 23:54:35 +00:00
|
|
|
class moodle_group_get_course_groups_form extends moodleform {
|
2009-10-22 23:07:21 +00:00
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-10-22 23:07:21 +00:00
|
|
|
$mform->addElement('text', 'courseid', 'courseid');
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['courseid'] = $data->courseid;
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
2009-10-22 23:07:21 +00:00
|
|
|
}
|
2009-10-22 23:54:35 +00:00
|
|
|
|
2009-10-27 09:27:34 +00:00
|
|
|
class moodle_group_delete_groups_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-10-27 09:27:34 +00:00
|
|
|
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
|
|
|
|
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
|
|
|
|
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
|
|
|
|
$mform->addElement('text', 'groupids[3]', 'groupids[3]');
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('static', 'warning', '', get_string('executewarnign', 'webservice'));
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-10-27 09:27:34 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['groupids'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->groupids[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['groupids'][] = $data->groupids[$i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
2009-11-05 20:04:27 +00:00
|
|
|
|
|
|
|
class moodle_group_get_groupmembers_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-11-05 20:04:27 +00:00
|
|
|
$mform->addElement('text', 'groupids[0]', 'groupids[0]');
|
|
|
|
$mform->addElement('text', 'groupids[1]', 'groupids[1]');
|
|
|
|
$mform->addElement('text', 'groupids[2]', 'groupids[2]');
|
|
|
|
$mform->addElement('text', 'groupids[3]', 'groupids[3]');
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-11-05 20:04:27 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['groupids'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->groupids[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['groupids'][] = $data->groupids[$i];
|
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
2009-11-05 22:06:49 +00:00
|
|
|
|
|
|
|
class moodle_group_add_groupmembers_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-11-05 22:06:49 +00:00
|
|
|
$mform->addElement('text', 'userid[0]', 'userid[0]');
|
|
|
|
$mform->addElement('text', 'groupid[0]', 'groupid[0]');
|
|
|
|
$mform->addElement('text', 'userid[1]', 'userid[1]');
|
|
|
|
$mform->addElement('text', 'groupid[1]', 'groupid[1]');
|
2009-11-05 22:13:25 +00:00
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-11-05 22:13:25 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['members'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->groupid[$i]) or empty($data->userid[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['members'][] = array('userid'=>$data->userid[$i], 'groupid'=>$data->groupid[$i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class moodle_group_delete_groupmembers_form extends moodleform {
|
|
|
|
public function definition() {
|
|
|
|
global $CFG;
|
|
|
|
|
|
|
|
$mform = $this->_form;
|
|
|
|
|
|
|
|
$mform->addElement('header', 'wstestclienthdr', get_string('testclient', 'webservice'));
|
|
|
|
|
|
|
|
//note: these values are intentionally PARAM_RAW - we want users to test any rubbish as parameters
|
2010-01-13 10:10:27 +00:00
|
|
|
$data = $this->_customdata;
|
|
|
|
if ($data['authmethod'] == 'simple') {
|
|
|
|
$mform->addElement('text', 'wsusername', 'wsusername');
|
|
|
|
$mform->addElement('text', 'wspassword', 'wspassword');
|
|
|
|
} else if ($data['authmethod'] == 'token') {
|
|
|
|
$mform->addElement('text', 'token', 'token');
|
|
|
|
}
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'authmethod', $data['authmethod']);
|
|
|
|
$mform->setType('authmethod', PARAM_SAFEDIR);
|
2009-11-05 22:13:25 +00:00
|
|
|
$mform->addElement('text', 'userid[0]', 'userid[0]');
|
|
|
|
$mform->addElement('text', 'groupid[0]', 'groupid[0]');
|
|
|
|
$mform->addElement('text', 'userid[1]', 'userid[1]');
|
|
|
|
$mform->addElement('text', 'groupid[1]', 'groupid[1]');
|
2009-11-05 22:06:49 +00:00
|
|
|
|
|
|
|
$mform->addElement('hidden', 'function');
|
|
|
|
$mform->setType('function', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$mform->addElement('hidden', 'protocol');
|
|
|
|
$mform->setType('protocol', PARAM_SAFEDIR);
|
|
|
|
|
|
|
|
$this->add_action_buttons(true, get_string('execute', 'webservice'));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_params() {
|
|
|
|
if (!$data = $this->get_data()) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
// remove unused from form data
|
|
|
|
unset($data->submitbutton);
|
|
|
|
unset($data->protocol);
|
|
|
|
unset($data->function);
|
|
|
|
unset($data->wsusername);
|
|
|
|
unset($data->wspassword);
|
2010-01-13 10:10:27 +00:00
|
|
|
unset($data->token);
|
|
|
|
unset($data->authmethod);
|
2009-11-05 22:06:49 +00:00
|
|
|
|
|
|
|
$params = array();
|
|
|
|
$params['members'] = array();
|
|
|
|
for ($i=0; $i<10; $i++) {
|
|
|
|
if (empty($data->groupid[$i]) or empty($data->userid[$i])) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$params['members'][] = array('userid'=>$data->userid[$i], 'groupid'=>$data->groupid[$i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|