mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-13 04:51:25 +01:00
La fonction dolibarr_list_dir peut trier par nom
This commit is contained in:
@@ -2176,14 +2176,17 @@ function create_exdir($dir)
|
|||||||
\param $recursive Determines whether subdirectories are searched
|
\param $recursive Determines whether subdirectories are searched
|
||||||
\param $filter Regex for filter
|
\param $filter Regex for filter
|
||||||
\param $exludefilter Regex for exclude filter
|
\param $exludefilter Regex for exclude filter
|
||||||
\param $sortcriteria Sort criteria ("date","size")
|
\param $sortcriteria Sort criteria ("name","date","size")
|
||||||
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
\param $sortorder Sort order (SORT_ASC, SORT_DESC)
|
||||||
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
\return array Array of array('name'=>xxx,'date'=>yyy,'size'=>zzz)
|
||||||
*/
|
*/
|
||||||
function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="", $sortorder=SORT_ASC)
|
function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::dolibarr_dir_list $path");
|
dolibarr_syslog("functions.inc.php::dolibarr_dir_list $path");
|
||||||
|
|
||||||
|
$loaddate=false;
|
||||||
|
$loadsize=false;
|
||||||
|
|
||||||
if (! is_dir($path)) return array();
|
if (! is_dir($path)) return array();
|
||||||
|
|
||||||
if ($dir = opendir($path))
|
if ($dir = opendir($path))
|
||||||
@@ -2203,8 +2206,8 @@ function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $exclu
|
|||||||
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 ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||||
if ($sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||||
|
|
||||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||||
{
|
{
|
||||||
@@ -2225,8 +2228,8 @@ function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $exclu
|
|||||||
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 ($loaddate || $sortcriteria == 'date') $filedate=filemtime($path."/".$file);
|
||||||
if ($sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
if ($loadsize || $sortcriteria == 'size') $filesize=filesize($path."/".$file);
|
||||||
if (! $filter || eregi($filter,$path.'/'.$file))
|
if (! $filter || eregi($filter,$path.'/'.$file))
|
||||||
{
|
{
|
||||||
$file_list[] = array(
|
$file_list[] = array(
|
||||||
@@ -2257,6 +2260,7 @@ function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $exclu
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\brief Retourne le num<75>ro de la semaine par rapport a une date
|
\brief Retourne le num<75>ro de la semaine par rapport a une date
|
||||||
\param time Date au format 'timestamp'
|
\param time Date au format 'timestamp'
|
||||||
|
|||||||
Reference in New Issue
Block a user