简体   繁体   中英

course content created Event Trigger in Moodle

I am amateur in moodle. I want to trigger an event when a new course content created by 'modedit.php' file. For the user created event i used this:

include_once($CFG->dirroot.$handlers['user_created']['handlerfile']);
call_user_func($handlers['user_created']['handlerfunction'], $eventdata);

But for the course content created what should i do?

moodle provides core events and you can make your own events as well.

core events are on below link.

https://docs.moodle.org/dev/Events_API

there is no core event for course content created but it is for course created

core\\event\\course_created

trigger an event

$params = array('context' => $context, 'other' => array('questionnaire' =>$cm->instance , 'type' => 'u','name'=>'questionnaire_question'));

            $event = \<plugin>\event\data_updated::create($params);
            $event->trigger();

data_updated is an event written in my module and it is fired under questionnaire module.

you will need to go thorough event api of moodle.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM