After becoming crazy many times reading/trying, i finally made another step after looking more carefully the html code...
So, in javascript file, in var data , to get the instanceid of the block, i added this :
block_instanceid :$('[data-block="course_overview"]').data('instanceid')
When i call my php file with ajax, to get this value and then get the instance of this object :
$block_instanceid = required_param('block_instanceid', PARAM_INT);
$blockinstance= block_instance_by_id($block_instanceid);
(it's so easy when it's written but it took me so long to write this 3 lines -_- )
This allow me to call function get_content()
$blockinstance->get_content();
The problem is this function already call a renderer and return me the text already rendered... So i can't give it to templates.render in my javascript file ..
At this step, if I return it to the javascript, like this :
echo json_encode($blockinstance->get_content());
I can do this in the javascript file :
templates.render('block_course_overview/main',new Object()).done(function(html,js){
$('[data-region="course-overview"]').replaceWith(new_data.text);
templates.runTemplateJS(js);
});
It's "working", but it doesn't look like the normal code like in the docs (seems a bit hacky i don't like it)
Looking more closely the code of get_content(), it's seems i need to change just the end of the function to get the return I need.
I tried to make another function and change the end of get_content like this :
$renderer = $this->page->get_renderer('block_course_overview');
$main = new block_course_overview\output\main($config, $tabs, $isediting, $tab, $sortorder, $favourites);
return $main->export_for_template($renderer);
Then I call it like this in my php ajax_script :
$test= $blockinstance->get_content_to_render();
The problem is $test contain all the good values expect all the links , which are all empty..
I tried to look values in process_tab, it's look ok, but if I look in export_for_template it's not.
If anyone have any idea of what happens, thanks to say me because i don't have any :'(
(If it's not clear, I actually updated the github fork )