Quantcast
Channel: Web services
Viewing all articles
Browse latest Browse all 2364

Re: core_course_duplicate_course (Web Service)

$
0
0
by Dave Arnold.  

I realize this is an old post but I'm not finding much informaiton on this. Does anyone have a working example of core_course_duplicate_course?

I'm attempting to use it on version 2.6 and I keep getting. 

Calling parameters do not match signature

Here is my code

function duplicateCourse($params){
	/// XML-RPC CALL
		header('Content-Type: text/plain');
		$path = $this->server.$this->dir."/webservice/xmlrpc/server.php?wstoken=".$this->token;
		$functionname = 'core_course_duplicate_course';
		$curl = new curl;

		$post = xmlrpc_encode_request($functionname, $params);
		$resp = xmlrpc_decode($curl->post($path, $post));
		print_r($post);
		print_r($resp);
		if(isset($resp['faultCode'])):
			error_log('faultCode '.$resp['faultCode'].' faultString '.$resp['faultString']);
		endif;
	}

$name = "Sample Duplicated Course";
$courseid = 4;
$fullname = $name.' '.date('M d, Y H:i:s');
$shortname = $name.' '.rand(1000,1000000);


$params = array(
'courseid' => $courseid, // Course id to be duplicated
'fullname' => $fullname, // New course full name
'shortname' => $shortname, // New course shortname
'categoryid' => 3, // New course category id
'visible' => 1, // Make the course visible after duplicating
'options' => array(array('name'=>'blocks', 'value'=>1),
				   array('name'=>'activities', 'value'=>1),
				   array('name'=>'filters', 'value'=>1)) // Backup options
);

duplicateCourse($params);

Viewing all articles
Browse latest Browse all 2364

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>