2
0
forked from Wavyzz/dolibarr

Fix: ajout du filtre png lors de l'affichage de l'icone pdf

This commit is contained in:
Regis Houssin
2007-07-14 15:48:42 +00:00
parent f6defad5ec
commit a1e1ea2367
2 changed files with 41 additions and 35 deletions

View File

@@ -3053,8 +3053,14 @@ class Form
} }
// Recupe liste des fichiers // Recupe liste des fichiers
if ($iconPDF==1) $png = '|\.png$'; $png = '';
$file_list=dolibarr_dir_list($filedir,'files',0,'','\.meta$'.$png,'date',SORT_DESC); $filter = '';
if ($iconPDF==1)
{
$png = '|\.png$';
$filter = $filename;
}
$file_list=dolibarr_dir_list($filedir,'files',0,$filter,'\.meta$'.$png,'date',SORT_DESC);
// Affiche en-tete tableau si non deja affich<63> // Affiche en-tete tableau si non deja affich<63>
if (sizeof($file_list) && ! $headershown && !$iconPDF) if (sizeof($file_list) && ! $headershown && !$iconPDF)

View File

@@ -2241,56 +2241,56 @@ function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $exclu
if (! is_dir($path)) return array(); if (! is_dir($path)) return array();
if ($dir = opendir($path)) if ($dir = opendir($path))
{
$file_list = array();
while (false !== ($file = readdir($dir)))
{ {
$file_list = array(); $qualified=1;
while (false !== ($file = readdir($dir)))
{
$qualified=1;
// Check if file is qualified // Check if file is qualified
if (eregi('^\.',$file)) $qualified=0; if (eregi('^\.',$file)) $qualified=0;
if ($excludefilter && eregi($excludefilter,$file)) $qualified=0; if ($excludefilter && eregi($excludefilter,$file)) $qualified=0;
if ($qualified) if ($qualified)
{ {
// Check whether this is a file or directory and whether we're interested in that type // Check whether this is a file or directory and whether we're interested in that type
if ((is_dir($path."/".$file)) && (($types=="directories") || ($types=="all"))) if ((is_dir($path."/".$file)) && (($types=="directories") || ($types=="all")))
{ {
// Add entry into file_list array // Add entry into file_list array
if ($sortcriteria == 'date') $filedate=filemtime($path."/".$file); if ($sortcriteria == 'date') $filedate=filemtime($path."/".$file);
if ($sortcriteria == 'size') $filesize=filesize($path."/".$file); if ($sortcriteria == 'size') $filesize=filesize($path."/".$file);
if (! $filter || eregi($filter,$path.'/'.$file)) if (! $filter || eregi($filter,$path.'/'.$file))
{ {
$file_list[] = array( $file_list[] = array(
"name" => $file, "name" => $file,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize "size" => $filesize
); );
} }
// if we're in a directory and we want recursive behavior, call this function again // if we're in a directory and we want recursive behavior, call this function again
if ($recursive) if ($recursive)
{ {
$file_list = array_merge($file_list, dolibarr_dir_list($path."/".$file."/", $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder)); $file_list = array_merge($file_list, dolibarr_dir_list($path."/".$file."/", $types, $recursive, $filter, $excludefilter, $sortcriteria, $sortorder));
}
} }
}
else if (($types == "files") || ($types == "all")) else if (($types == "files") || ($types == "all"))
{ {
// Add file into file_list array // Add file into file_list array
if ($sortcriteria == 'date') $filedate=filemtime($path."/".$file); if ($sortcriteria == 'date') $filedate=filemtime($path."/".$file);
if ($sortcriteria == 'size') $filesize=filesize($path."/".$file); if ($sortcriteria == 'size') $filesize=filesize($path."/".$file);
if (! $filter || eregi($filter,$path.'/'.$file)) if (! $filter || eregi($filter,$path.'/'.$file))
{ {
$file_list[] = array( $file_list[] = array(
"name" => $file, "name" => $file,
"fullname" => $path.'/'.$file, "fullname" => $path.'/'.$file,
"date" => $filedate, "date" => $filedate,
"size" => $filesize "size" => $filesize
); );
}
} }
}
} }
} }
closedir($dir); closedir($dir);