Fix issue with course icons not showing correctly when visibility is updated on course homepage and custom icons are defined in CSS theme - refs BT#9617

1.9.x
Yannick Warnier 11 years ago
parent 66c59086ef
commit 8eea258212
  1. 24
      main/inc/ajax/course_home.ajax.php

@ -12,22 +12,28 @@ switch ($action) {
$course_id = api_get_course_int_id();
if (api_is_allowed_to_edit(null, true)) {
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$tool_info = api_get_tool_information($_GET["id"]);
$tool_info = api_get_tool_information($_GET['id']);
$tool_visibility = $tool_info['visibility'];
$tool_image = $tool_info['image'];
if (api_get_setting('homepage_view') != 'activity_big') {
$new_image = Display::return_icon(str_replace('.gif','_na.gif',$tool_image), null, null, null, null, true);
$tool_image = Display::return_icon($tool_image, null, null, null, null, true);
$na_image = str_replace('.gif', '_na.gif', $tool_image);
} else {
$tool_image = $tool_info['image'];
// Display::return_icon() also checks in the main/css/{theme}/icons folder
$tool_image = (substr($tool_info['image'], 0, strpos($tool_info['image'], '.'))).'.png';
$new_image = str_replace('.png','_na.png',$tool_image);
$new_image = api_get_path(WEB_IMG_PATH).'icons/64/'.$new_image;
$tool_image = api_get_path(WEB_IMG_PATH).'icons/64/'.$tool_image;
$tool_image = Display::return_icon(
$tool_image,
get_lang(ucfirst($too_info['name'])),
null,
ICON_SIZE_BIG,
null,
true
);
$na_image = str_replace('.png', '_na.png', $tool_image);
}
$requested_image = ($tool_visibility == 0 ) ? $tool_image : $new_image;
$requested_clase = ($tool_visibility == 0 ) ? 'visible' : 'invisible';
$requested_image = ($tool_visibility == 0 ) ? $tool_image : $na_image;
$requested_class = ($tool_visibility == 0 ) ? 'visible' : 'invisible';
$requested_message = ($tool_visibility == 0 ) ? 'is_active' : 'is_inactive';
$requested_view = ($tool_visibility == 0 ) ? 'visible.png' : 'invisible.png';
$requested_visible = ($tool_visibility == 0 ) ? 1 : 0;
@ -58,7 +64,7 @@ switch ($action) {
}
$response_data = array(
'image' => $requested_image,
'tclass' => $requested_clase,
'tclass' => $requested_class,
'message' => $requested_message,
'view' => $requested_view
);

Loading…
Cancel
Save