$token = 'f4458487f63c0558484f4505d61f1245'; // the teachers security key
|
$domainname = 'http://localhost/moodledev'; // the Moodle server
|
$functionname = 'core_grading_save_definitions'; // the web service function we are testing
|
|
$gradingarea = array(
|
'cmid' => 3, // the course module id
|
'contextid' => 232, // the context id
|
'component' => 'mod_assign',
|
'areaname' => 'submissions',
|
'activemethod' => 'guide'
|
);
|
$definition = array(
|
'method' => 'guide',
|
'name' => 'Understand zoonose control',
|
'description' => 'Demonstrate an understanding of the control of zoonoses',
|
'status' => 20,
|
'copiedfromid' => 1,
|
'timecreated' => 1,
|
'usercreated' => 199,
|
'timemodified' => 1,
|
'usermodified' => 199,
|
'timecopied' => 0
|
);
|
$guidecomment = array(
|
'sortorder' => 1,
|
'description' => 'Students need to show that they understand the control of zoonoses',
|
'descriptionformat' => 0
|
);
|
$guidecriteria1 = array (
|
'sortorder' => 1,
|
'shortname' => 'Rabies Control',
|
'description' => 'Understand rabies control',
|
'descriptionformat' => 0,
|
'descriptionmarkers' => 'Student must demonstrate that they understand rabies control',
|
'descriptionmarkersformat' => 0,
|
'maxscore' => 50
|
);
|
$guidecriteria2 = array (
|
'sortorder' => 2,
|
'shortname' => 'Anthrax Control',
|
'description' => 'Understand anthrax control',
|
'descriptionformat' => 0,
|
'descriptionmarkers' => 'Student must demonstrate that they understand anthrax control',
|
'descriptionmarkersformat' => 0,
|
'maxscore' => 50
|
);
|
|
$definition['guide'] = array('guide_criteria' => array($guidecriteria1, $guidecriteria2),
|
'guide_comments' => array($guidecomment));
|
$gradingarea['definitions'] = array($definition);
|
$params = array('areas' => array ($gradingarea));
|
|
///// REST CALL
|
header('Content-Type: text/plain');
|
$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token. '&wsfunction='.$functionname;
|
require_once('./curl.php');
|
$curl = new curl;
|
$resp = $curl->post($serverurl, $params);
|
print_r($resp);
|