Make code simpler to sort list of files.
This commit is contained in:
parent
8e9a4e1877
commit
00eb0511f6
@ -164,9 +164,9 @@ if (! dol_is_dir($upload_dir))
|
||||
print '<!-- ajaxdirpreview type='.$type.' -->'."\n";
|
||||
//print '<!-- Page called with mode='.dol_escape_htmltag(isset($mode)?$mode:'').' type='.dol_escape_htmltag($type).' module='.dol_escape_htmltag($module).' url='.dol_escape_htmltag($url).' '.dol_escape_htmltag($_SERVER["PHP_SELF"]).'?'.dol_escape_htmltag($_SERVER["QUERY_STRING"]).' -->'."\n";
|
||||
|
||||
$param=($sortfield?'&sortfield='.$sortfield:'').($sortorder?'&sortorder='.$sortorder:'');
|
||||
if (! empty($websitekey)) $param.='&website='.$websitekey;
|
||||
if (! empty($pageid)) $param.='&pageid='.$pageid;
|
||||
$param=($sortfield?'&sortfield='.urlencode($sortfield):'').($sortorder?'&sortorder='.urlencode($sortorder):'');
|
||||
if (! empty($websitekey)) $param.='&website='.urlencode($websitekey);
|
||||
if (! empty($pageid)) $param.='&pageid='.urlencode($pageid);
|
||||
|
||||
|
||||
// Dir scan
|
||||
|
||||
@ -195,15 +195,9 @@ function dol_dir_list($path, $types = "all", $recursive = 0, $filter = "", $excl
|
||||
closedir($dir);
|
||||
|
||||
// Obtain a list of columns
|
||||
if (! empty($sortcriteria))
|
||||
if (! empty($sortcriteria) && $sortorder)
|
||||
{
|
||||
$myarray=array();
|
||||
foreach ($file_list as $key => $row)
|
||||
{
|
||||
$myarray[$key] = (isset($row[$sortcriteria])?$row[$sortcriteria]:'');
|
||||
}
|
||||
// Sort the data
|
||||
if ($sortorder) array_multisort($myarray, $sortorder, $file_list);
|
||||
$file_list = dol_sort_array($file_list, $sortcriteria, ($sortorder == SORT_ASC ? 'asc' : 'desc'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user