Building course activites navigation

Re: Building course activites navigation

by Davo Smith -
Number of replies: 0
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$modinfo = get_fast_modinfo($course);

$modinfo->get_sections();   // Array of sectionnum => array of course module ids

$modinfo->get_cms(); // Array of cm_info objects - with info about each course module in the course

$modinfo->get_cm($cmid); // Get info about one course module, based on its ID

For more info, take a look in lib/modinfolib.php (which lists the rest of the functions found in the 'course_modinfo' class that get_fast_modinfo returns + the contents of the 'cm_info' class that get_cms and get_cm return).

Average of ratings: Useful (1)