]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-12886 more external groups api
authorPetr Skoda <skodak@moodle.org>
Thu, 5 Nov 2009 20:04:27 +0000 (20:04 +0000)
committerPetr Skoda <skodak@moodle.org>
Thu, 5 Nov 2009 20:04:27 +0000 (20:04 +0000)
lib/db/services.php
version.php
webservice/testclient_forms.php

index c0acfbd57dce22bac4474a127539915810ef3b0e..8ca0d9b9b9525f4b1bcbc5ef59dfaec1734bcde5 100644 (file)
@@ -59,7 +59,7 @@ $functions = array(
         'description' => 'Deletes all specified groups.',
         'type'        => 'delete',
     ),
-/*
+
     'moodle_group_get_groupmembers' => array(
         'classname'   => 'moodle_group_external',
         'methodname'  => 'get_groupmembers',
@@ -67,7 +67,7 @@ $functions = array(
         'description' => 'Returns group members.',
         'type'        => 'read',
     ),
-
+/*
     'moodle_group_add_groupmembers' => array(
         'classname'   => 'moodle_group_external',
         'methodname'  => 'add_groupmembers',
index abbf67203e8ec5925f603e017f8c81aec63ec039..388db8abc3e90a10f4a0a35a44f4eede00378232 100644 (file)
@@ -6,7 +6,7 @@
 // This is compared against the values stored in the database to determine
 // whether upgrades should be performed (see lib/db/*.php)
 
-    $version = 2009110400;  // YYYYMMDD   = date of the last version bump
+    $version = 2009110500;  // YYYYMMDD   = date of the last version bump
                             //         XX = daily increments
 
     $release = '2.0 dev (Build: 20091105)';  // Human-friendly version name
index 687db3cedd2d72541922c8105f68d6b0bc0ece78..6ce6b6b5727c6a82a5b34bae10f66d77e67c9ff7 100644 (file)
@@ -207,3 +207,53 @@ class moodle_group_delete_groups_form extends moodleform {
         return $params;
     }
 }
+
+
+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
+        $mform->addElement('text', 'wsusername', 'wsusername');
+        $mform->addElement('text', 'wspassword', 'wspassword');
+        $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);
+
+        $params = array();
+        $params['groupids'] = array();
+        for ($i=0; $i<10; $i++) {
+            if (empty($data->groupids[$i])) {
+                continue;
+            }
+            $params['groupids'][] = $data->groupids[$i];
+        }
+
+        return $params;
+    }
+}