I am experimenting developing a script hoping to use the core_course_external::import_course function to import blocks and activities from a template course into others.
I am getting an exception on the 4th parameter ($options) that this method expects, which is an array of import options. (I traced the execution to the generic parameter checking in the validate_parameters method in /lib/externallib.php. The error message is detailed in the var_dump of the exception (See attached.)
What I find baffling is that I am clearly passing in an array, as follows!
$importfrom = 23;
$importto = 15;
$deletecontent=1;
$options = array(
"activities" => 1,
"blocks" => 1 ,
"filters" => 1
);
...
try {
$newcourse = core_course_external::import_course($importfrom,
$importto,
$deletecontent,
$options);
catch (exception $e) {
var_dump($e);
}
In fact I added print_r($params); to the code in /lib/externallib.php just to see what it is getting, and I see
Array ( [importfrom] => 23 [importto] => 15 [deletecontent] => 0 [options] => Array ( [activities] => 1 [blocks] => 1 [filters] => 1 ) )
So where is the invalid parameter? I must be missing something obvious. If anyone can help I will surely be grateful!
Alan
I am attaching the var_dump in case anyone can take a look.