|
@ -1,6 +1,6 @@ |
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col-12"> |
|
|
<div class="col-12"> |
|
|
<div class="section-title">Elimina notizia</div> |
|
|
|
|
|
|
|
|
<div class="section-title">Elimina file</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="col-12"> |
|
|
<div class="col-12"> |
|
|
|
|
|
|
|
@ -9,114 +9,63 @@ |
|
|
<?php |
|
|
<?php |
|
|
if($_POST['go']){ |
|
|
if($_POST['go']){ |
|
|
|
|
|
|
|
|
$append = array(); |
|
|
|
|
|
|
|
|
|
|
|
$qa=mysqli_query($conn, "SELECT append FROM news WHERE id=".trim($getQ[3])); |
|
|
|
|
|
$ra=mysqli_fetch_array($qa); |
|
|
|
|
|
$currentAppend = explode(',',$ra['append']); |
|
|
|
|
|
|
|
|
foreach ($_POST['files'] as $index => $file) { |
|
|
|
|
|
|
|
|
$fullAppend = $currentAppend; |
|
|
|
|
|
|
|
|
$qf=mysqli_query($conn, "SELECT * FROM files WHERE id='$file'"); |
|
|
|
|
|
$rf = mysqli_fetch_array($qf); |
|
|
|
|
|
|
|
|
if($_POST['filesDel']){ |
|
|
|
|
|
foreach ($_POST['filesDel'] as $fileID) { |
|
|
|
|
|
if (($index = array_search($fileID, $fullAppend)) !== false) { |
|
|
|
|
|
unset($fullAppend[$index]); |
|
|
|
|
|
$qtf=mysqli_query($conn, "SELECT * FROM files WHERE id=".$fileID); |
|
|
|
|
|
$rtf=mysqli_fetch_array($qtf); |
|
|
|
|
|
@unlink("..".$rtf['path']."/".$rtf['filename']); |
|
|
|
|
|
$qtf=mysqli_query($conn, "DELETE FROM files WHERE id=".$fileID); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@unlink("..".$rf['path']."/".$rf['filename']); |
|
|
|
|
|
mysqli_query($conn, "DELETE FROM files WHERE id='$file'"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
$q=mysqli_query($conn, "DELETE FROM news WHERE id=".trim($getQ[3])); |
|
|
|
|
|
|
|
|
|
|
|
echo '<div class="col-10 text-center mx-auto my-5"> |
|
|
echo '<div class="col-10 text-center mx-auto my-5"> |
|
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p> |
|
|
<p><i class="fa fa-check-circle font-alert p-4"></i></p> |
|
|
Notizia eliminata correttamente! |
|
|
|
|
|
|
|
|
File eliminato correttamente! |
|
|
</div>'; |
|
|
</div>'; |
|
|
|
|
|
|
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
if($getQ[3]){ |
|
|
|
|
|
|
|
|
|
|
|
$q=mysqli_query($conn, "SELECT * FROM news WHERE id = ".trim($getQ[3])); |
|
|
|
|
|
$r=mysqli_fetch_array($q); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}else{ |
|
|
?> |
|
|
?> |
|
|
<form method="post" enctype="multipart/form-data"> |
|
|
<form method="post" enctype="multipart/form-data"> |
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Data</span> |
|
|
|
|
|
<p><?= conv_date($r['date']);?></p> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12"> |
|
|
<div class="col-12"> |
|
|
<span class="font-12 text-grey">Titolo notizia</span> |
|
|
|
|
|
<p><?= $r['title'];?></p> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 pb-2"> |
|
|
|
|
|
<span class="font-12 text-grey">Testo notizia</span> |
|
|
|
|
|
<p><?= $r['text'];?></p> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-12"> |
|
|
|
|
|
<span class="font-12">Allegato/i</span> |
|
|
|
|
|
<div class="files-list"> |
|
|
|
|
|
<div class="admin-list"> |
|
|
|
|
|
<?php |
|
|
|
|
|
$qca=mysqli_query($conn, "SELECT * FROM files WHERE id IN(".$r['append'].")"); |
|
|
|
|
|
$cnt=0; |
|
|
|
|
|
while($rca=mysqli_fetch_array($qca)){ |
|
|
|
|
|
$cnt++; |
|
|
|
|
|
$bg = ($cnt%2) ? "bg-light-grey" : "bg-white"; |
|
|
|
|
|
echo "<div class=\"admin-list-item $bg\"><span>".$rca['title']."</span> |
|
|
|
|
|
<div class=\"right\"> |
|
|
|
|
|
<input type=\"checkbox\" value=\"".$rca['id']."\" id=\"check_".$rca['id']."\" name=\"filesDel[]\" checked> |
|
|
|
|
|
<label for=\"check_".$rca['id']."\" class=\"font-10 px-3\">Elimina</label> |
|
|
|
|
|
</div></div>"; |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 text-right"> |
|
|
|
|
|
<button type="submit" name="go" value="1">Elimina notizia</button> |
|
|
|
|
|
|
|
|
<span class="font-12">Carica in</span> |
|
|
|
|
|
<select name="path" onChange="this.form.submit()"> |
|
|
|
|
|
<option value="">- Seleziona una sezione - </option> |
|
|
|
|
|
<option value="/docs/modulistica/pubblica" <?php if($_POST['path']=="/docs/modulistica/pubblica"){echo "selected";}?>>Modulistica pubblica</option> |
|
|
|
|
|
<option value="/docs/modulistica/privata" <?php if($_POST['path']=="/docs/modulistica/privata"){echo "selected";}?>>Modulistica privata</option> |
|
|
|
|
|
</select> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
</form> |
|
|
|
|
|
|
|
|
|
|
|
<form method="post" enctype="multipart/form-data"> |
|
|
|
|
|
<input type="hidden" name="path" value="<?= $_POST['path'];?>"> |
|
|
|
|
|
<div class="col-12 p-0 admin-list"> |
|
|
|
|
|
<?php |
|
|
|
|
|
if($_POST['path']){ |
|
|
|
|
|
|
|
|
|
|
|
$q = mysqli_query($conn, "SELECT * FROM files WHERE path='".$_POST['path']."' 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\">".$r['title']."</div> |
|
|
|
|
|
<div class=\"col-4\"> ".$r['filename']."</div> |
|
|
|
|
|
<div class=\"col-3\"> ".conv_date($r['date'])."</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 |
|
|
<?php |
|
|
}else{ |
|
|
|
|
|
|
|
|
|
|
|
?> |
|
|
|
|
|
<form method="post" class="form-mod" data-path="<?= $BASE_URL;?>/sheets/news/del"> |
|
|
|
|
|
<div class="col-12 col-sm-10 mx-auto"> |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col"> |
|
|
|
|
|
<span class="font-12">Seleziona una notizia</span> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="row"> |
|
|
|
|
|
<div class="col"> |
|
|
|
|
|
<select name="id" class="id"> |
|
|
|
|
|
<?php |
|
|
|
|
|
$qn=mysqli_query($conn, "SELECT * FROM news ORDER BY date DESC"); |
|
|
|
|
|
while($rn=mysqli_fetch_array($qn)){ |
|
|
|
|
|
echo "<option value=\"".$rn['id']."\">".conv_date($rn['date'])." - ".$rn['title']."</option>"; |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-auto"> |
|
|
|
|
|
<button type="submit">Elimina</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
|
|
|
</form> |
|
|
|
|
|
|
|
|
|
|
|
<?php |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
?> |
|
|
?> |
|
|