General developer forum

Add course content programmiticatly

 
Picture of A. Obeid
Add course content programmiticatly
Particularly helpful Moodlers

Hi

i am using

list($module, $context, $cw, $cm, $udata) = prepare_new_moduleinfo_data($course, 'url', $section);// url
list($module, $context, $cw, $cm, $rdata) = prepare_new_moduleinfo_data($course, 'resource', $section); // Resource

and create other required data like

$uploadinfo = new stdClass();
$uploadinfo->type = 'Files';
$uploadinfo->course = $course;
$uploadinfo->draftitemid = 0;
$uploadinfo->coursemodule = $rmdata;
$name = $item->name;
$uploadinfo->displayname = $name;      
resource_dndupload_handle($uploadinfo);

the entries are created in resource/url DB, but in the course noting is shown.

What is missing?

Thx.


 
Average of ratings: -
Picture of A. Obeid
Re: Add course content programmiticatly
Particularly helpful Moodlers
function add_moduleinfo($moduleinfo, $course, $mform = null)//  course/modlib.php
solve this issue.
 
Average of ratings: -