New: Les liste des documents sont triées par date décroissante
This commit is contained in:
parent
4030ddd8c7
commit
74f036c768
@ -2515,50 +2515,45 @@ class Form
|
|||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affiche lignes
|
// Recupe liste des fichiers
|
||||||
if (is_dir($filedir))
|
$file_list=dolibarr_dir_list($filedir,'files',0,'','\.meta$','date',SORT_DESC);
|
||||||
{
|
|
||||||
$handle=opendir($filedir);
|
// Affiche en-tete tableau si non deja affiché
|
||||||
while (($file = readdir($handle))!==false)
|
if (sizeof($file_list) && ! $headershown)
|
||||||
{
|
{
|
||||||
// Si fichier non lisible ou mauvaise extension, on passe au suivant
|
$headershown=1;
|
||||||
if (! is_readable($filedir."/".$file) ||
|
|
||||||
eregi('\.meta$',$file) ||
|
print_titre($langs->trans("Documents"));
|
||||||
eregi('\.$',$file)
|
print '<table class="border" width="100%">';
|
||||||
) continue;
|
}
|
||||||
|
|
||||||
if (! $headershown)
|
// Boucle sur chaque ligne trouvée
|
||||||
{
|
foreach($file_list as $i => $file)
|
||||||
// Affiche en-tete tableau
|
{
|
||||||
$headershown=1;
|
|
||||||
|
|
||||||
print_titre($langs->trans("Documents"));
|
|
||||||
print '<table class="border" width="100%">';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Défini chemin relatif par rapport au module pour lien download
|
// Défini chemin relatif par rapport au module pour lien download
|
||||||
$relativepath=$filename."/".$file;
|
$relativepath=$filename."/".$file["name"];
|
||||||
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file; }
|
if ($modulepart == 'don') { $relativepath = get_exdir($filename).$file["name"]; }
|
||||||
if ($modulepart == 'export') { $relativepath = $file; }
|
if ($modulepart == 'export') { $relativepath = $file["name"]; }
|
||||||
|
|
||||||
// Défini le type MIME du document
|
// Défini le type MIME du document
|
||||||
if (eregi('\.([^\.]+)$',$file,$reg)) $extension=$reg[1];
|
if (eregi('\.([^\.]+)$',$file["name"],$reg)) $extension=$reg[1];
|
||||||
$mimetype=strtoupper($extension);
|
$mimetype=strtoupper($extension);
|
||||||
if ($extension == 'pdf') $mimetype='PDF';
|
if ($extension == 'pdf') $mimetype='PDF';
|
||||||
if ($extension == 'html') $mimetype='HTML';
|
if ($extension == 'html') $mimetype='HTML';
|
||||||
if (eregi('\-detail\.pdf',$file)) $mimetype='PDF Détaillé';
|
if (eregi('\-detail\.pdf',$file["name"])) $mimetype='PDF Détaillé';
|
||||||
|
|
||||||
print "<tr $bc[$var]>";
|
print "<tr $bc[$var]>";
|
||||||
|
|
||||||
// Affiche colonne type MIME
|
// Affiche colonne type MIME
|
||||||
print '<td nowrap>'.$mimetype.'</td>';
|
print '<td nowrap>'.$mimetype.'</td>';
|
||||||
// Affiche nom fichier avec lien download
|
// Affiche nom fichier avec lien download
|
||||||
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file.'</a>';
|
print '<td><a href="'.DOL_URL_ROOT . '/document.php?modulepart='.$modulepart.'&file='.urlencode($relativepath).'">'.$file["name"].'</a>';
|
||||||
print '</td>';
|
print '</td>';
|
||||||
// Affiche taille fichier
|
// Affiche taille fichier
|
||||||
print '<td align="right">'.filesize($filedir."/".$file). ' bytes</td>';
|
print '<td align="right">'.filesize($filedir."/".$file["name"]). ' bytes</td>';
|
||||||
// Affiche date fichier
|
// Affiche date fichier
|
||||||
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file)).'</td>';
|
print '<td align="right">'.strftime("%d %b %Y %H:%M:%S",filemtime($filedir."/".$file["name"])).'</td>';
|
||||||
|
|
||||||
if ($delallowed)
|
if ($delallowed)
|
||||||
{
|
{
|
||||||
@ -2568,21 +2563,21 @@ class Form
|
|||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if ($headershown)
|
if ($headershown)
|
||||||
{
|
{
|
||||||
// Affiche pied du tableau
|
// Affiche pied du tableau
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
if ($genallowed)
|
if ($genallowed)
|
||||||
{
|
{
|
||||||
print '</form>';
|
print '</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $i;
|
return $i;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user