public static function get_blockids_from_courseid($courseid) {
        global $DB;

        // Get the context of the course
        $contextid = context_course::instance($courseid)->id;

        // Get all the block instances which parentcontextid is the course contextid
        $blockids = array();
        $instances = $DB->get_records('block_instances', array('parentcontextid' => $contextid), '', 'id');
        foreach ($instances as $instance) {
            $blockids[] = $instance->id;
        }
        return $blockids;
    }
public static function get_blockids_from_courseid($courseid) {
        global $DB;

        // Get the context of the course
        $contextid = context_course::instance($courseid)->id;

        // Get all the block instances which parentcontextid is the course contextid
        $blockids = array();
        $instances = $DB->get_records('block_instances', array('parentcontextid' => $contextid), '', 'id');
        foreach ($instances as $instance) {
            $blockids[] = $instance->id;
        }
        return $blockids;
    }
public static function get_blockids_from_courseid ( $ courseid ) { global $ DB ; // Get the context of the course $ contextid = context_course :: instance ( $ courseid ) -> id ; // Get all the block instances which parentcontextid is the course contextid $ blockids = array ( ) ; $ instances = $ DB -> get_records ( 'block_instances' , array ( 'parentcontextid' => $ contextid ) , '' , 'id' ) ; foreach ( $ instances as $ instance ) { $ blockids [ ] = $ instance -> id ; } return $ blockids ; }
Given one course id, return one array with all the block intances that belong to it
Given one course id return one array with all the block intances that belong to it