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

core_course_duplicate_course: error/setting_locked_by_permission problem

$
0
0

by Anis Jradah.  

Dear All, Kindly, I am getting the error below while trying to duplicate a course using core_course_duplicate_course function:
<?xml version="1.0" encoding="UTF-8" ?><EXCEPTION class="base_setting_exception"><ERRORCODE>setting_locked_by_permission</ERRORCODE><MESSAGE>error/setting_locked_by_permission</MESSAGE></EXCEPTION>


my code:

$functionname = 'core_course_duplicate_course';

$restformat = 'xml';


$params = array(

  'courseid' => 2,

  'fullname' => 'duplicated Introduction to Moodle', // New course full name

  'shortname' => 'dup Introduction to Moodle', // New course shortname

  'categoryid' => 1, // New course category id

  'visible' => 1, // Make the course visible after duplicating

  'options' => array( array('name'=>'activities', 'value'=>1)

                    ) // Backup options

);

/// REST CALL

header('Content-Type: text/plain');

$serverurl = $domainname . '/webservice/rest/server.php'. '?wstoken=' . $token . '&wsfunction='.$functionname;

$curl = new curl;

//if rest format == 'xml', then we do not add the param for backward compatibility with Moodle < 2.2

$restformat = ($restformat == 'json')?'&moodlewsrestformat=' . $restformat:'';

$resp = $curl->post($serverurl . $restformat, $params);

print_r($resp);

Moodle version: 3.3.4

Thank you for all your help.

Best regards,

Anis



Viewing all articles
Browse latest Browse all 2362

Trending Articles



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