Hi, Yannick,
here's the solution. I do not think it's good enough to be called a patch. Some of the reasons are mentioned bellow; and as i said before. i just can't get the philosophy (bussiness rules?) behind the controling of the session's tools. So, just move this post to the troubleshooting section if you like to.
ok,
home page links are constructed and shown (taken from course_home/activity.php, but no matter which view) :
$my_list = CourseHome::get_tools_category(TOOL_STUDENT_VIEW); // construct the list of the tools
CourseHome::show_tools_category($my_list); // shows the list
constructed list from the get_tools_catagory shows publish lp link as:
[6] => Array
(
[id] => 27
[name] => NovaUčnaPot
[link] => newscorm/lp_controller.php?action=view&lp_id=1&id_session=0
[image] => scormbuilder.gif
[visibility] => 1
[admin] => 0
[address] => pastillegris.gif
[added_tool] => 0
[target] => _self
[category] => authoring
[session_id] => 0
)
so lp is present in the constructed list, but condition for showing (from CourseHome::show_tools_category ) that reads:
foreach ($all_tools_list as & $tool){
if ($tool['image'] == 'scormbuilder.gif') {
// display links to lp only for current session
if (api_get_session_id() != $tool['session_id']) { // session id is wrong, continue with no action at the beggining of the block
continue;
}
prevents lp from showing as looking for the field [session_id] to be real session_id not 0 as been read from database table.
at this point, we can choose to control publishing lp link only by originated course. but from code, i suspect, that original idea was a bit more complex (controled by DB table field), but poorly or just not implemented. No matter what, following change should works with 1.8.7(.1):
main/inc/lib/course_home.lib.php / method get_tools_category /somewhere around line 489:
original code:
while ($temp_row = Database::fetch_assoc($result)) {
if ($check) {
if (!in_array($temp_row['name'],$hide_list)) {
$all_tools_list[] = $temp_row;
} else {
}
} else {
$all_tools_list[] = $temp_row;
}
}
/*if(api_is_course_coach()) {
changed:
while ($temp_row = Database::fetch_assoc($result)) {
if ($check) {
if (!in_array($temp_row['name'],$hide_list)) {
if ( $temp_row['image']=='scormbuilder.gif' ){
$temp_row['session_id'] = $session_id; // change id to current session id
}
$all_tools_list[] = $temp_row;
} else {
}
} else {
if ( $temp_row['image']=='scormbuilder.gif' ){
$temp_row['session_id'] = $session_id; // change id to current session id
}
$all_tools_list[] = $temp_row;
}
}
/*if(api_is_course_coach()) {
for the 1.8.7 will works. Note, that [code] [link] => newscorm/lp_controller.php?action=view&lp_id=1&id_session=0 [/code] was not changed (!!) since was not used anywhere. But this is not thee case with
1.8.8 (alpha+) as there is new interface for the session home. Currently this interface does not taking care about the visibility and there is a bug connected with lp_link constructed (duplicated id_session parameter, ... unfinished task?).