You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
94 lines
4.1 KiB
94 lines
4.1 KiB
<div class="row">
|
|
<div class="col-12">
|
|
<div class="section-title">Elenco files</div>
|
|
</div>
|
|
<div class="col-12">
|
|
|
|
<div class="sheet-box p-4">
|
|
<?php
|
|
if($_POST['go']){
|
|
|
|
foreach ($_POST['files'] as $index => $file) {
|
|
|
|
$qf=mysqli_query($conn, "SELECT * FROM ftp WHERE id='$file'");
|
|
$rf = mysqli_fetch_array($qf);
|
|
|
|
@unlink("../docs/ftp/".$rf['filename']);
|
|
mysqli_query($conn, "DELETE FROM ftp WHERE id='$file'");
|
|
}
|
|
|
|
|
|
echo '<div class="col-10 text-center mx-auto my-5">
|
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p>
|
|
File eliminato correttamente!
|
|
</div>';
|
|
|
|
} else {
|
|
?>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="row">
|
|
<div class="col-8">
|
|
<span class="font-12">Visualizza in</span>
|
|
<select name="municipality" onChange="this.form.submit()">
|
|
<option value="">- Seleziona un comune - </option>
|
|
|
|
<?php
|
|
$q = mysqli_query($conn, "SELECT * FROM comuni ORDER BY comune ASC");
|
|
$cnt=0;
|
|
while($r = mysqli_fetch_array($q)){
|
|
echo '<option value="'.$r['id'].'" '.($_POST['municipality'] == $r['id'] ? 'selected' : '').'>'.$r['comune'].'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
<div class="col-4">
|
|
<span class="font-12">Anno</span>
|
|
<select name="year" onChange="this.form.submit()">
|
|
<option value="">- Seleziona l'anno - </option>
|
|
|
|
<?php
|
|
for($i = 2019; $i <= date('Y'); $i++){
|
|
echo '<option value="'.$i.'" '.($_POST['year'] == $i ? 'selected' : '').'>'.$i.'</option>';
|
|
}
|
|
?>
|
|
</select>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
<form method="post" enctype="multipart/form-data">
|
|
<div class="col-12 p-0 admin-list">
|
|
|
|
<?php
|
|
if($_POST['municipality']){
|
|
|
|
$q = mysqli_query($conn, "SELECT * FROM ftp WHERE municipality='".$_POST['municipality']."' AND year='".$_POST['year']."' ORDER BY date DESC");
|
|
$cnt=0;
|
|
while($r = mysqli_fetch_array($q)){
|
|
$cnt++;
|
|
$bg = ($cnt%2) ? "bg-light-grey" : "bg-white";
|
|
echo "<div class=\"admin-list-item row no-gutters font-12 $bg\">
|
|
<div class=\"col-4\"><a target=\"_black\" href=\"$BASE_URL/../docs/ftp/".$r['filename']."\">".$r['title']."</a></div>
|
|
<div class=\"col-4\"><a target=\"_black\" href=\"$BASE_URL/../docs/ftp/".$r['filename']."\">".substr($r['filename'],15)."</a></div>
|
|
<div class=\"col-2\"> ".conv_date($r['date'])."</div>
|
|
<div class=\"col-1 text-right\"> ".$r['size']."</div>
|
|
<div class=\"col-1 text-right\">
|
|
<input type=\"checkbox\" name=\"files[]\" id=\"".$r['id']."\" value=\"".$r['id']."\"><label for=\"".$r['id']."\"><i class=\"fa fa-trash\"></i></label>
|
|
</div>
|
|
</div>";
|
|
}
|
|
}
|
|
?>
|
|
</div>
|
|
<div class="col-12 text-right">
|
|
<button type="submit" name="go" value="1">Elimina file/s</button>
|
|
</div>
|
|
</form>
|
|
|
|
<?php
|
|
}
|
|
?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|