Moodle Development - Get course(s) using Moodle's Data Manipulation API
To get course(s) using Moodle's Data Manipulation API, from version 2.5.1 we can do like following:
* Get a specific course with provided id:
$course_id = 20
$course = get_course($course_id);
(instead of :
* Get all courses in the system:
$courses = get_courses();
* Get a specific course with provided id:
$course_id = 20
$course = get_course($course_id);
(instead of :
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);)
* Get all courses in the system:
$courses = get_courses();
Comments
Post a Comment