Files
awo-hamburg-intranet/module/filegallery/show_filegallery.inc.php
2026-02-17 14:56:23 +01:00

149 lines
6.0 KiB
PHP

<?php
require_once("filegallery.config.inc.php");
?>
<div class="filegallery_content">
<div class="sitepart_<?= $sitepart_id ?>">
<?
$query = "SELECT * FROM filegallery_line WHERE header_id = '" . $sitepart_id . "' ORDER BY sorting ASC";
$result = @mysqli_query($GLOBALS['mysql_con'], $query);
if (@mysqli_num_rows($result) > 0) {
while ($filegalleryContent = @mysqli_fetch_array($result)) {
$description = $filegalleryContent['description'];
$filename = $filegalleryContent['filename'];
$extension = $filegalleryContent['extension'];
$id = $filegalleryContent['id'];
if ($filename == "") {
continue;
}
// datei laden
$fileInfo = new SplFileInfo(ROOT_PATH . "userdata/" . $filename);
if (!$fileInfo->isReadable()) {
continue;
}
$icon = "";
switch ($extension) {
case "7z":
case "cap":
case "rar":
case "zip":
$iconclass = "file-archive-o";
break;
case "mp3":
$iconclass = "file-audio-o";
break;
case "htm":
case "html":
$iconclass = "file-code-o";
break;
case "xls":
case "xlsx":
case "xlsm":
$iconclass = "file-excel-o";
break;
case "pdf":
$iconclass = "file-pdf-o";
break;
case "ai":
case "bmp":
case "cdr":
case "eps":
case "iso":
case "jpg":
case "jpeg":
case "raw":
case "tif":
$iconclass = "file-photo-o";
break;
case "":
$iconclass = "file-text-o";
break;
case "doc":
case "docx":
case "dot":
$iconclass = "file-word-o";
break;
case "mov":
case "mp4":
case "mpg":
case "wmv":
$iconclass = "file-video-o";
break;
case "flv":
case "swf":
case "gif":
$iconclass = "spinner";
break;
case "stp":
$iconclass = "paint-brush";
break;
case "exe":
$iconclass = "cog";
break;
default:
$iconclass = "file-o";
}
/*$icon = PATH_ICON_FRONTEND_FILEGALLERY . "32px/" . $extension . ".png";
if (!file_exists(ROOT_PATH . $icon)) {
$icon = PATH_ICON_FRONTEND_FILEGALLERY . "32px/_blank.png";
}*/
// $icon_pdf = '
// <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-eye" viewBox="0 0 16 16">
// <path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8M1.173 8a13 13 0 0 1 1.66-2.043C4.12 4.668 5.88 3.5 8 3.5s3.879 1.168 5.168 2.457A13 13 0 0 1 14.828 8q-.086.13-.195.288c-.335.48-.83 1.12-1.465 1.755C11.879 11.332 10.119 12.5 8 12.5s-3.879-1.168-5.168-2.457A13 13 0 0 1 1.172 8z"/>
// <path d="M8 5.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5M4.5 8a3.5 3.5 0 1 1 7 0 3.5 3.5 0 0 1-7 0"/>
// </svg>';
$icon_pdf = '';
$icon_download = '
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-download" viewBox="0 0 16 16">
<path d="M.5 9.9a.5.5 0 0 1 .5-.5h4V1.5a.5.5 0 0 1 1 0v7.9h4a.5.5 0 0 1 0 1H6v4.1a.5.5 0 0 1-1 0V10H.5a.5.5 0 0 1-.5-.5z"/>
<path d="M5.354 11.354a.5.5 0 0 0 .707 0l2-2a.5.5 0 1 0-.707-.707L6 9.793V1.5a.5.5 0 0 0-1 0v8.293L3.646 8.647a.5.5 0 1 0-.707.707l2 2z"/>
</svg>';
$link = "/userdata/" . $filename;
if (trim($description) == "") {
$description = $filename;
}
$showDescription = $description;
// if ($extension == "pdf") {
// // Wenn PDF, verwende das Auge-Symbol
// echo "<div class='filegallery_content_file'>
// <a data-path='".$link."' href='?file=".$id."'>".$icon_pdf . $showDescription . "</a>
// </div>";
// } else {
if ($extension == "pdf") {
// Wenn PDF, verwende das Auge-Symbol
echo "<div class='filegallery_content_file'>
<a data-path='".$link."' href='" . $link . "'>".$icon_pdf . $showDescription . "</a>
</div>";
} else {
// Andernfalls, verwende das Herunterladen-Symbol
echo "<div class='filegallery_content_file'>
<a data-path='".$link."' href='" . $link . "' target='_blank'>".$icon_download . $showDescription . "</a>
</div>";
}
}
}
?>
</div>
</div>