Hello
I what to check all the items in a course (resourse or activity) and for each one to get your:
1. section member
2. Type of items (Example: Page, questionarie, chat, etc)
3. Item´s URL.
¿Some body know what API function can I to use?
Thanks
This code will do the trick:
global $DB, $CFG; $sql = " SELECT cm.id, cm.section, mdl.name FROM {course_modules} AS cm INNER JOIN {context} AS ctx ON ctx.contextlevel = :ctxlevel AND ctx.instanceid = cm.id INNER JOIN {modules} AS mdl ON cm.module = mdl.id "; $items = $DB->get_records_sql($sql, array('ctxlevel' => CONTEXT_MODULE)); foreach ($items as &$item) { $item->url = "{$CFG->wwwroot}/mod/{$item->name}/view.php/id={$item->id}"; }