I'm writing a cron-function for a specialized block and I need to be able to access which course this block instance is created in.
I get the instances running
$instances = $DB->get_records( 'block_instances', array('blockname'=>'myblock') );
then iterating over them as $instance, getting the block_base object and finally the information I need will be in _instanceid in the context_course object
$block = block_instance('myblock', $instance);
context::instance_by_id($block->instance->parentcontextid);
I cannot figure out how to get at that _instanceid, could someone help me out here?