public function get_all_samples(\core_analytics\analysable $site) {
        global $DB;

        // Getting courses from DB instead of from the site as these samples
        // will be stored in memory and we just want the id.
        $select = 'id != 1';
        $courses = get_courses('all', 'c.sortorder ASC');
        unset($courses[SITEID]);

        $courseids = array_keys($courses);
        $sampleids = array_combine($courseids, $courseids);

        $courses = array_map(function($course) {
            return array('course' => $course, 'context' => \context_course::instance($course->id));
        }, $courses);

        // No related data attached.
        return array($sampleids, $courses);
    }
public function get_all_samples(\core_analytics\analysable $site) {
        global $DB;

        // Getting courses from DB instead of from the site as these samples
        // will be stored in memory and we just want the id.
        $select = 'id != 1';
        $courses = get_courses('all', 'c.sortorder ASC');
        unset($courses[SITEID]);

        $courseids = array_keys($courses);
        $sampleids = array_combine($courseids, $courseids);

        $courses = array_map(function($course) {
            return array('course' => $course, 'context' => \context_course::instance($course->id));
        }, $courses);

        // No related data attached.
        return array($sampleids, $courses);
    }
public function get_all_samples ( \ core_analytics \ analysable $ site ) { global $ DB ; // Getting courses from DB instead of from the site as these samples // will be stored in memory and we just want the id. $ select = 'id != 1' ; $ courses = get_courses ( 'all' , 'c.sortorder ASC' ) ; unset ( $ courses [ SITEID ] ) ; $ courseids = array_keys ( $ courses ) ; $ sampleids = array_combine ( $ courseids , $ courseids ) ; $ courses = array_map ( function ( $ course ) { return array ( 'course' => $ course , 'context' => \ context_course :: instance ( $ course -> id ) ) ; } , $ courses ) ; // No related data attached. return array ( $ sampleids , $ courses ) ; }
Returns all site courses.

@param \core_analytics\analysable $site
@return array
Returns all site courses .