General developer forum

 
 
Picture of Ashish Jain
Building course activites navigation
 

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: -
Davo
Re: Building course activites navigation
Group DevelopersGroup Particularly helpful Moodlers

$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)