Info sur les Extensions de fichiers
This commit is contained in:
parent
5c14430075
commit
f4a0949365
|
|
@ -31,13 +31,38 @@ class ControleurFichepolice extends Controleur {
|
||||||
|
|
||||||
$nouveau_fichier = "Rien";
|
$nouveau_fichier = "Rien";
|
||||||
|
|
||||||
|
// Extensions autorisees
|
||||||
|
$tabExt = array("avi", "bmp", "doc", "docx", "gif", "jpeg", "jpg", "jpe", "mkv", "mp3", "mp4", "pdf", "png", "pps", "xls", "xlsx", "wav");
|
||||||
|
|
||||||
|
// Mapping couleurs + icônes par type
|
||||||
|
$extStyles = [
|
||||||
|
"pdf" => ["color" => "danger", "icon" => "fas fa-file-pdf", "cat" => "Documents"],
|
||||||
|
"doc" => ["color" => "primary", "icon" => "fas fa-file-word", "cat" => "Documents"],
|
||||||
|
"docx" => ["color" => "primary", "icon" => "fas fa-file-word", "cat" => "Documents"],
|
||||||
|
"xls" => ["color" => "success", "icon" => "fas fa-file-excel", "cat" => "Documents"],
|
||||||
|
"xlsx" => ["color" => "success", "icon" => "fas fa-file-excel", "cat" => "Documents"],
|
||||||
|
"pps" => ["color" => "secondary","icon" => "fas fa-file-powerpoint","cat" => "Documents"],
|
||||||
|
|
||||||
|
"png" => ["color" => "info", "icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
"jpg" => ["color" => "info", "icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
"jpeg" => ["color" => "info", "icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
"jpe" => ["color" => "info", "icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
"gif" => ["color" => "warning", "icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
"bmp" => ["color" => "secondary","icon" => "fas fa-file-image", "cat" => "Images"],
|
||||||
|
|
||||||
|
"avi" => ["color" => "dark", "icon" => "fas fa-file-video", "cat" => "Vidéos"],
|
||||||
|
"mkv" => ["color" => "dark", "icon" => "fas fa-file-video", "cat" => "Vidéos"],
|
||||||
|
"mp4" => ["color" => "dark", "icon" => "fas fa-file-video", "cat" => "Vidéos"],
|
||||||
|
|
||||||
|
"mp3" => ["color" => "secondary","icon" => "fas fa-file-audio", "cat" => "Audio"],
|
||||||
|
"wav" => ["color" => "secondary","icon" => "fas fa-file-audio", "cat" => "Audio"],
|
||||||
|
];
|
||||||
|
|
||||||
if(!empty($_POST))
|
if(!empty($_POST))
|
||||||
{
|
{
|
||||||
define('TARGET', $_SESSION['cheminGed']); // Repertoire cible
|
define('TARGET', $_SESSION['cheminGed']); // Repertoire cible
|
||||||
define('MAX_SIZE', 10000000); // Taille max en octets du fichier
|
define('MAX_SIZE', 10000000); // Taille max en octets du fichier
|
||||||
|
|
||||||
$tabExt = array("avi", "bmp", "doc", "docx", "gif", "jpeg", "jpg", "jpe", "mkv", "mp3", "mp4", "pdf", "png", "pps", "xls", "xlsx", "wav"); // Extensions autorisees
|
|
||||||
|
|
||||||
// Variables
|
// Variables
|
||||||
$extension = '';
|
$extension = '';
|
||||||
|
|
||||||
|
|
@ -138,7 +163,9 @@ class ControleurFichepolice extends Controleur {
|
||||||
'totalquittance' => $totalquittance,
|
'totalquittance' => $totalquittance,
|
||||||
'nb_non_facturees' => $nb_non_facturees,
|
'nb_non_facturees' => $nb_non_facturees,
|
||||||
'geds' => $geds,
|
'geds' => $geds,
|
||||||
'msgErreur' => $msgErreur
|
'msgErreur' => $msgErreur,
|
||||||
|
'tabExt' => $tabExt,
|
||||||
|
'extStyles' => $extStyles
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,10 +121,74 @@
|
||||||
|
|
||||||
<div class="card shadow-sm mb-4">
|
<div class="card shadow-sm mb-4">
|
||||||
<div class="card-body p-4">
|
<div class="card-body p-4">
|
||||||
<h6 class="fw-bold text-uppercase mb-3"><i class="fas fa-folder-open me-2 text-warning"></i><?= _("Documents GED") ?></h6>
|
<h6 class="fw-bold text-uppercase mb-3">
|
||||||
|
<i class="fas fa-folder-open me-2 text-warning"></i><?= _("Documents GED") ?>
|
||||||
|
</h6>
|
||||||
|
|
||||||
<form enctype="multipart/form-data" action="Fichepolice" method="post" class="row g-3">
|
<form enctype="multipart/form-data" action="Fichepolice" method="post" class="row g-3">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<input class="form-control custom-file-input" name="fichier_upload" type="file" id="fichier_upload">
|
<input class="form-control custom-file-input" name="fichier_upload" type="file" id="fichier_upload">
|
||||||
|
|
||||||
|
<!-- Zone d'information sur les extensions -->
|
||||||
|
<div class="alert alert-info mt-2 py-2 small">
|
||||||
|
<strong><?= _("Extensions autorisées :") ?></strong>
|
||||||
|
|
||||||
|
<!-- Documents -->
|
||||||
|
<div class="mt-2">
|
||||||
|
<span class="fw-bold text-dark"><?= _("Documents") ?> :</span>
|
||||||
|
<div class="d-flex flex-wrap mt-1">
|
||||||
|
<?php foreach ($tabExt as $ext): ?>
|
||||||
|
<?php if(isset($extStyles[$ext]) && $extStyles[$ext]["cat"] === "Documents"): ?>
|
||||||
|
<span class="badge bg-<?= $extStyles[$ext]["color"] ?> me-2 mb-2">
|
||||||
|
<i class="<?= $extStyles[$ext]["icon"] ?> me-1"></i><?= strtoupper($ext) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Images -->
|
||||||
|
<div class="mt-2">
|
||||||
|
<span class="fw-bold text-dark"><?= _("Images") ?> :</span>
|
||||||
|
<div class="d-flex flex-wrap mt-1">
|
||||||
|
<?php foreach ($tabExt as $ext): ?>
|
||||||
|
<?php if(isset($extStyles[$ext]) && $extStyles[$ext]["cat"] === "Images"): ?>
|
||||||
|
<span class="badge bg-<?= $extStyles[$ext]["color"] ?> me-2 mb-2">
|
||||||
|
<i class="<?= $extStyles[$ext]["icon"] ?> me-1"></i><?= strtoupper($ext) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Vidéos -->
|
||||||
|
<div class="mt-2">
|
||||||
|
<span class="fw-bold text-dark"><?= _("Vidéos") ?> :</span>
|
||||||
|
<div class="d-flex flex-wrap mt-1">
|
||||||
|
<?php foreach ($tabExt as $ext): ?>
|
||||||
|
<?php if(isset($extStyles[$ext]) && $extStyles[$ext]["cat"] === "Vidéos"): ?>
|
||||||
|
<span class="badge bg-<?= $extStyles[$ext]["color"] ?> me-2 mb-2">
|
||||||
|
<i class="<?= $extStyles[$ext]["icon"] ?> me-1"></i><?= strtoupper($ext) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Audio -->
|
||||||
|
<div class="mt-2">
|
||||||
|
<span class="fw-bold text-dark"><?= _("Audio") ?> :</span>
|
||||||
|
<div class="d-flex flex-wrap mt-1">
|
||||||
|
<?php foreach ($tabExt as $ext): ?>
|
||||||
|
<?php if(isset($extStyles[$ext]) && $extStyles[$ext]["cat"] === "Audio"): ?>
|
||||||
|
<span class="badge bg-<?= $extStyles[$ext]["color"] ?> me-2 mb-2">
|
||||||
|
<i class="<?= $extStyles[$ext]["icon"] ?> me-1"></i><?= strtoupper($ext) ?>
|
||||||
|
</span>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-3">
|
<div class="col-md-3">
|
||||||
<button type="submit" name="submit" class="btn btn-secondary w-100 fw-bold">
|
<button type="submit" name="submit" class="btn btn-secondary w-100 fw-bold">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user