MDL-14320, remove icon when no file in entry, Thanks Robert

This commit is contained in:
dongsheng
2008-04-15 02:37:29 +00:00
parent f0c8025bbc
commit 3be617a985
+8 -4
View File
@@ -115,10 +115,14 @@ class data_field_file extends data_field_base {
$width = $this->field->param1 ? ' width = "'.s($this->field->param1).'" ':' ';
$height = $this->field->param2 ? ' height = "'.s($this->field->param2).'" ':' ';
require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src);
$str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
'<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
if (isset($contents[0])) {
require_once($CFG->libdir.'/filelib.php');
$icon = mimeinfo('icon', $src);
$str = '<img src="'.$CFG->pixpath.'/f/'.$icon.'" height="16" width="16" alt="'.$icon.'" />&nbsp;'.
'<a href="'.$source.'/'.$src.'" >'.$name.'</a>';
} else {
$str = '';
}
return $str;
}
return false;