You are here

function opigno_learning_path_get_course_modules in Opigno Learning path 3.x

Same name and namespace in other branches
  1. 8 opigno_learning_path.module \opigno_learning_path_get_course_modules()

Select list of modules for course.

Parameters

integer $course_id: Couse id.

Return value

array Return list of modules for course.

File

./opigno_learning_path.module, line 2743
Contains opigno_learning_path.module.

Code

function opigno_learning_path_get_course_modules($course_id) {
  $course_steps = OpignoGroupManagedContent::loadByGroupId($course_id);
  $modules = [];
  if (!empty($course_steps)) {

    // Check if each course module has at least one activity.
    foreach ($course_steps as $course_step) {
      $id = $course_step
        ->getEntityId();
      $modules[$id] = OpignoModule::load($id);
    }
  }
  return $modules;
}