Best practice forum (Archived)

create modinfo for section

 
Zhen Yun
create modinfo for section
by Zhen Yun - Sunday, 8 January 2012, 5:35 PM
 

Hi,

I need autocreate a mod: questionnaire. I already insert the value in course_modules, course_sections, but where is the function to create a modinfo like this:

{s:2:"id";s:3:"375";s:2:"cm";i:1624;s:3:"mod";s:16:"prelearningneeds";s:7:"section";s:1:"0";s:7:"visible";i:1;s:9:"groupmode";i:1;s:10:"groupingid";s:1:"0";s:16:"groupmembersonly";i:0;s:6:"indent";i:0;s:10:"completion";i:0;s:5:"extra";s:0:"";s:4:"name";s:3:"pre";}

 

in course table?

? ?
Re: create modinfo for section
by ? ? - Sunday, 8 January 2012, 6:24 PM
 

Hi Zhen,

If autocreating from a PHP script, you could use something like the following:

$modinfo = serialize(get_array_of_activities($course->id));

Which makes use of  a function in course/lib.php. Hope that helps,

Ciaran
Zhen Yun
Re: create modinfo for section
by Zhen Yun - Sunday, 8 January 2012, 9:46 PM
 

Got it, thanks very much!