Building course activites navigation

Building course activites navigation

by Ashish Jain -
Number of replies: 1

Can somebody tell me how can I get the list of particular course activiites and resources. I'm planning to build the block to show them, something like open2study

 

Thanks! in advance.

Average of ratings: -
In reply to Ashish Jain

Re: Building course activites navigation

by Davo Smith -
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)