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
+ $mform->addElement('text', 'wsusername', 'wsusername');
+ $mform->addElement('text', 'wspassword', 'wspassword');
+ $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]');
+
+ $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);
+
+ $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;
+ }
+}