diff --git a/lib/documents.lib.php b/lib/documents.lib.php
index 6c915114..22b67b46 100644
--- a/lib/documents.lib.php
+++ b/lib/documents.lib.php
@@ -258,19 +258,14 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str
if ($conf->global->$manualPdfGenerationConf > 0) {
$out .= '
| ';
}
-
$out .= '';
$out .= '';
- $out .= '' . $langs->trans('Name');
- $out .= ' | ';
- $out .= '' . $langs->trans('Size');
- $out .= ' | ';
- $out .= '' . $langs->trans('Date');
- $out .= ' | ';
- $out .= '' . $langs->trans('PDF');
- $out .= ' | ';
- $out .= '' . $langs->trans('Action');
- $out .= ' | ';
+ $out .= get_document_title_field($sortfield, $sortorder, 'Name');
+ $out .= get_document_title_field($sortfield, $sortorder, 'Size', true, 'right');
+ $out .= get_document_title_field($sortfield, $sortorder, 'Date', true, 'right');
+ $out .= get_document_title_field($sortfield, $sortorder, 'PDF', false, 'right');
+ $out .= get_document_title_field($sortfield, $sortorder, 'Action', false, 'right');
+// $out .= '';
$out .= '
';
// Execute hooks
@@ -444,6 +439,24 @@ function saturne_show_documents(string $modulepart, $modulesubdir, $filedir, str
return $out;
}
+function get_document_title_field(string $sortfield, string $sortorder, string $name, bool $sortable = true, string $morehtml = ''): string {
+ global $langs;
+
+ $out = '';
+ if ($sortable) {
+ $out .= '';
+ $out .= ($sortfield == strtolower($name) ? '' : '');
+ }
+ $out .= $langs->trans($name);
+ if ($sortable) {
+ $out .= ' ' . ($sortfield == strtolower($name) ? ($sortorder == 'asc' ? '' : '') : '');
+ $out .= ($sortfield == strtolower($name) ? '' : '');
+ $out .= '';
+ }
+ $out .=' | ';
+ return $out;
+}
+
/**
* Exclude index.php files from list of models for document generation
*