diff --git a/controllers/d.admin.php b/controllers/d.admin.php index 298eef8..1c0347e 100755 --- a/controllers/d.admin.php +++ b/controllers/d.admin.php @@ -44,6 +44,7 @@ if(isset($controller->splitted_url[1]) && $user->rankIsHigher("moderator")) { break; case 'wiki-files': if ($user->rankIsHigher("moderator")) { + $head['css'] = "d.index.css;d.admin.css"; $head['title'] = "Fichiers attachés au wiki"; $rows_per_pages = 50; $files_folder = $config['medias_folder']."wiki/"; @@ -112,6 +113,8 @@ else { $notfound = 1; } +// Fonctions de mise en forme + function getFontAwesomeIcon($mimeType) { $icons = [ 'application/pdf' => 'fa-file-pdf', @@ -128,4 +131,23 @@ function getFontAwesomeIcon($mimeType) { 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]; +} + ?> \ No newline at end of file diff --git a/views/css/d.admin.css b/views/css/d.admin.css new file mode 100644 index 0000000..95b052e --- /dev/null +++ b/views/css/d.admin.css @@ -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; +} \ No newline at end of file diff --git a/views/d.admin.wiki-files.html b/views/d.admin.wiki-files.html index b91ec14..0264e01 100755 --- a/views/d.admin.wiki-files.html +++ b/views/d.admin.wiki-files.html @@ -7,7 +7,7 @@ -
+

Fichiers attachés à sur les présents

@@ -40,7 +40,7 @@ '> - + locale)?> date_format,date_create($file['creation_date'], new DateTimeZone("UTC"))) ?> @@ -48,7 +48,6 @@ -