Fixing bug when changing visibility of tools in the course homepage when using custom icons see BT#4202

skala
Julio Montoya 13 years ago
parent 78b445d419
commit 629f63dba4
  1. 4
      main/inc/ajax/course_home.ajax.php
  2. 10
      main/inc/lib/display.lib.php

@ -17,8 +17,8 @@ switch ($action) {
$tool_visibility = $tool_info['visibility'];
$tool_image = $tool_info['image'];
if (api_get_setting('homepage_view') != 'activity_big') {
$new_image = api_get_path(WEB_IMG_PATH).str_replace('.gif','_na.gif',$tool_image);
$tool_image = api_get_path(WEB_IMG_PATH).$tool_image;
$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);
} else {
$tool_image = $tool_info['image'];
$tool_image = (substr($tool_info['image'], 0, strpos($tool_info['image'], '.'))).'.png';

@ -555,7 +555,7 @@ class Display {
* @author Yannick Warnier 2011 Added size handler
* @version Feb 2011
*/
public static function return_icon($image, $alt_text = '', $additional_attributes = array(), $size = ICON_SIZE_SMALL, $show_text = true) {
public static function return_icon($image, $alt_text = '', $additional_attributes = array(), $size = ICON_SIZE_SMALL, $show_text = true, $return_only_path = false) {
$code_path = api_get_path(SYS_CODE_PATH);
$w_code_path = api_get_path(WEB_CODE_PATH);
@ -568,6 +568,8 @@ class Display {
if (isset($size)) {
$size = intval($size);
$size_extra = $size.'/';
} else {
$size = ICON_SIZE_SMALL;
}
//Checking the theme icons folder example: main/css/chamilo/icons/XXX
@ -580,6 +582,11 @@ class Display {
//Checking the img/ folder
$icon = $w_code_path.'img/'.$image;
}
if ($return_only_path) {
return $icon;
}
$img = self::img($icon, $alt_text, $additional_attributes);
if (SHOW_TEXT_NEAR_ICONS == true and !empty($alt_text)) {
if ($show_text) {
@ -602,7 +609,6 @@ class Display {
// Sanitizing the parameter $image_path
$image_path = Security::filter_img_path($image_path);
$attribute_list = '';
// alt text = the image name if there is none provided (for XHTML compliance)
if ($alt_text == '') {
$alt_text = basename($image_path);

Loading…
Cancel
Save