Mise en forme du tableau
This commit is contained in:
@@ -44,6 +44,7 @@ if(isset($controller->splitted_url[1]) && $user->rankIsHigher("moderator")) {
|
|||||||
break;
|
break;
|
||||||
case 'wiki-files':
|
case 'wiki-files':
|
||||||
if ($user->rankIsHigher("moderator")) {
|
if ($user->rankIsHigher("moderator")) {
|
||||||
|
$head['css'] = "d.index.css;d.admin.css";
|
||||||
$head['title'] = "Fichiers attachés au wiki";
|
$head['title'] = "Fichiers attachés au wiki";
|
||||||
$rows_per_pages = 50;
|
$rows_per_pages = 50;
|
||||||
$files_folder = $config['medias_folder']."wiki/";
|
$files_folder = $config['medias_folder']."wiki/";
|
||||||
@@ -112,6 +113,8 @@ else {
|
|||||||
$notfound = 1;
|
$notfound = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fonctions de mise en forme
|
||||||
|
|
||||||
function getFontAwesomeIcon($mimeType) {
|
function getFontAwesomeIcon($mimeType) {
|
||||||
$icons = [
|
$icons = [
|
||||||
'application/pdf' => 'fa-file-pdf',
|
'application/pdf' => 'fa-file-pdf',
|
||||||
@@ -128,4 +131,23 @@ function getFontAwesomeIcon($mimeType) {
|
|||||||
return $icons[$mimeType] ?? 'fa-file'; // Default
|
return $icons[$mimeType] ?? 'fa-file'; // Default
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatBytes($bytes, $locale = 'en', $precision = 2) {
|
||||||
|
$unitMap = [
|
||||||
|
'en' => ['B', 'KB', 'MB', 'GB', 'TB', 'PB'],
|
||||||
|
'fr' => ['o', 'Ko', 'Mo', 'Go', 'To', 'Po']
|
||||||
|
];
|
||||||
|
|
||||||
|
$locale = explode('_', $locale)[0];
|
||||||
|
$units = $unitMap[$locale] ?? $unitMap['en'];
|
||||||
|
|
||||||
|
if ($bytes == 0) {
|
||||||
|
return '0 ' . $units[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
$power = floor(log($bytes, 1024));
|
||||||
|
$formatted = round($bytes / pow(1024, $power), $precision);
|
||||||
|
|
||||||
|
return $formatted . ' ' . $units[$power];
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
77
views/css/d.admin.css
Normal file
77
views/css/d.admin.css
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
/*********************************/
|
||||||
|
/** Wiki files page **/
|
||||||
|
/*********************************/
|
||||||
|
|
||||||
|
#wiki_files table {
|
||||||
|
width: 100%;
|
||||||
|
margin: 30px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files table, #wiki_files td {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
#wiki_files th {
|
||||||
|
border: 1px solid #aaa;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
#wiki_files th a {
|
||||||
|
color: inherit !important;
|
||||||
|
}
|
||||||
|
#wiki_files th i {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files td, #wiki_files th {
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files tr:nth-child(even) {
|
||||||
|
background: #efefef;
|
||||||
|
}
|
||||||
|
#wiki_files tr:nth-child(odd) {
|
||||||
|
background: #e1e1e1;
|
||||||
|
}
|
||||||
|
#wiki_files tr.first {
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
#wiki_files tr:hover {
|
||||||
|
background: #f5f5f5;
|
||||||
|
}
|
||||||
|
#wiki_files tr.first:hover {
|
||||||
|
background: #ccc;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files .username {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files .icon {
|
||||||
|
border: 1px solid #999;
|
||||||
|
border-radius: 3px;
|
||||||
|
margin: 0 3px 0 0;
|
||||||
|
padding: 4px 0;
|
||||||
|
line-height: 20px;
|
||||||
|
text-align: center;
|
||||||
|
width: 28px;
|
||||||
|
background: #ccc;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files .icon.avatar {
|
||||||
|
padding: 0;
|
||||||
|
height: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#wiki_files .pagebuttons {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
#wiki_files .pagebuttons a {
|
||||||
|
background: #efefef;
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 5px;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
#wiki_files .pagebuttons .previous {
|
||||||
|
margin-right: -1px;
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<? include('blocks/d.nav.html'); ?>
|
<? include('blocks/d.nav.html'); ?>
|
||||||
|
|
||||||
<section>
|
<section id="wiki_files">
|
||||||
<h1><?=$head['title']?></h1>
|
<h1><?=$head['title']?></h1>
|
||||||
|
|
||||||
<p class="subtitle">Fichiers attachés <?=$first?> à <?=$last?> sur les <?=$filenb?> présents</p>
|
<p class="subtitle">Fichiers attachés <?=$first?> à <?=$last?> sur les <?=$filenb?> présents</p>
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
<a href="<?=$config['rel_root_folder']?>medias/wiki/<?=$file['name']?>"><?=$file['name']?></a>
|
<a href="<?=$config['rel_root_folder']?>medias/wiki/<?=$file['name']?>"><?=$file['name']?></a>
|
||||||
</td>
|
</td>
|
||||||
<td><i class='fas <?=getFontAwesomeIcon($file['type'])?>'></i> <?=$file['type']?></td>
|
<td><i class='fas <?=getFontAwesomeIcon($file['type'])?>'></i> <?=$file['type']?></td>
|
||||||
<td><?=$file['size']?></td>
|
<td><?=formatBytes($file['size'], $user->locale)?></td>
|
||||||
<td><? echo datefmt_format($user->date_format,date_create($file['creation_date'], new DateTimeZone("UTC"))) ?></td>
|
<td><? echo datefmt_format($user->date_format,date_create($file['creation_date'], new DateTimeZone("UTC"))) ?></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="<?=$file['name']?>"><span class="external-link"><i class="fas fa-trash"></i></span></a>
|
<a href="<?=$file['name']?>"><span class="external-link"><i class="fas fa-trash"></i></span></a>
|
||||||
@@ -48,7 +48,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
<? } ?>
|
<? } ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class="pagebuttons">
|
<div class="pagebuttons">
|
||||||
<? if ($page != 0) { ?><a class="previous" href="<?=$config['rel_root_folder']?>admin/wiki-files/<?=$page?>?orderby=<?=$orderby?>&order=<?=$order?>"><i class="fas fa-chevron-left fa-fw"></i></a><? }
|
<? if ($page != 0) { ?><a class="previous" href="<?=$config['rel_root_folder']?>admin/wiki-files/<?=$page?>?orderby=<?=$orderby?>&order=<?=$order?>"><i class="fas fa-chevron-left fa-fw"></i></a><? }
|
||||||
if (($page+1)*$rows_per_pages < $filenb) { ?><a class="next" href="<?=$config['rel_root_folder']?>admin/wiki-files/<?=$page+2?>?orderby=<?=$orderby?>&order=<?=$order?>"><i class="fas fa-chevron-right fa-fw"></i></a><? } ?>
|
if (($page+1)*$rows_per_pages < $filenb) { ?><a class="next" href="<?=$config['rel_root_folder']?>admin/wiki-files/<?=$page+2?>?orderby=<?=$orderby?>&order=<?=$order?>"><i class="fas fa-chevron-right fa-fw"></i></a><? } ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user