|
@ -9,17 +9,43 @@ |
|
|
<?php |
|
|
<?php |
|
|
if($_POST['go']){ |
|
|
if($_POST['go']){ |
|
|
|
|
|
|
|
|
$q=mysqli_query($conn, "UPDATE news SET id=".trim($_POST['id']).", |
|
|
|
|
|
email='".addslashes(trim($_POST['email']))."', last_name='".addslashes(trim($_POST['last_name']))."', |
|
|
|
|
|
first_name='".addslashes(trim($_POST['first_name']))."', birth_date='".addslashes(trim($_POST['birth_date']))."', |
|
|
|
|
|
birth_place='".addslashes(trim($_POST['birth_place']))."', register_date='".addslashes(trim($_POST['register_date']))."', |
|
|
|
|
|
address='".addslashes(trim($_POST['address']))."', zip_code='".addslashes(trim($_POST['zip_code']))."', |
|
|
|
|
|
city='".addslashes(trim($_POST['city']))."', province='".addslashes(trim($_POST['province']))."', |
|
|
|
|
|
degree_place='".addslashes(trim($_POST['degree_place']))."', degree_date='".addslashes(trim($_POST['degree_date']))."', |
|
|
|
|
|
degree='".addslashes(trim($_POST['degree']))."', qualification_date='".addslashes(trim($_POST['qualification_date']))."', |
|
|
|
|
|
qualification_place='".addslashes(trim($_POST['qualification_place']))."', enabled=".$_POST['enabled'].", |
|
|
|
|
|
specializations='".addslashes(nl2br($_POST['specializations']))."' |
|
|
|
|
|
WHERE id=".trim($getQ[3]).""); |
|
|
|
|
|
|
|
|
$append = array(); |
|
|
|
|
|
|
|
|
|
|
|
$qa=mysqli_query($conn, "SELECT append FROM news WHERE id=".trim($getQ[3])); |
|
|
|
|
|
$ra=mysqli_fetch_array($qa); |
|
|
|
|
|
$currentAppend = explode(',',$ra['append']); |
|
|
|
|
|
|
|
|
|
|
|
if($_FILES['files']){ |
|
|
|
|
|
$files = reArrayFiles($_FILES['files']); |
|
|
|
|
|
foreach ($files as $index => $file) { |
|
|
|
|
|
if(is_uploaded_file($file['tmp_name'])){ |
|
|
|
|
|
$filename = preg_replace('/[^a-zA-Z0-9\-\._]/','', $file['name']); |
|
|
|
|
|
$filesize = ($file['size'] < 1000000) ? round($file['size'] / 1000)."k" : round($file['size'] / 1000000)."M"; |
|
|
|
|
|
move_uploaded_file($file['tmp_name'], "../docs/files/news/$filename"); |
|
|
|
|
|
$qf=mysqli_query($conn, "INSERT INTO files VALUES(null, '$filename', '$filename', '/docs/files/news', NOW(), '$filesize')"); |
|
|
|
|
|
$append[$index] = mysqli_insert_id($conn); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$fullAppend = array_filter(array_merge($append,$currentAppend)); |
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$q=mysqli_query($conn, "UPDATE news SET |
|
|
|
|
|
title='".addslashes(trim($_POST['title']))."', text='".addslashes(trim($_POST['text']))."', |
|
|
|
|
|
date='".trim(conv_date_en($_POST['date']))."', append='".implode(',',$fullAppend)."' |
|
|
|
|
|
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> |
|
@ -32,109 +58,50 @@ |
|
|
|
|
|
|
|
|
$q=mysqli_query($conn, "SELECT * FROM news WHERE id = ".trim($getQ[3])); |
|
|
$q=mysqli_query($conn, "SELECT * FROM news WHERE id = ".trim($getQ[3])); |
|
|
$r=mysqli_fetch_array($q); |
|
|
$r=mysqli_fetch_array($q); |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
<form method="post"> |
|
|
|
|
|
|
|
|
<form method="post" enctype="multipart/form-data"> |
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col-12 col-sm-6"> |
|
|
<div class="col-12 col-sm-6"> |
|
|
<span class="font-12">N° Iscrizione all'Albo</span> |
|
|
|
|
|
<input type="text" name="id" value="<?= $r['id'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Data di iscrizione all'Albo</span> |
|
|
|
|
|
<input type="text" name="register_date" class="datepicker" value="<?= $r['register_date'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Username <span class="font-10">(modificabile solo dall'utente)</span></span> |
|
|
|
|
|
<input type="text" name="usr" value="<?= $r['usr'];?>" readonly disabled> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Password <span class="font-10">(modificabile solo dall'utente)</span></span> |
|
|
|
|
|
<input type="text" value="" placeholder="[password nascosta]" readonly disabled> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Email</span> |
|
|
|
|
|
<input type="text" name="email" value="<?= $r['email'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-12"><hr></div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Cognome</span> |
|
|
|
|
|
<input type="text" name="last_name" value="<?= $r['last_name'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Nome</span> |
|
|
|
|
|
<input type="text" name="first_name" value="<?= $r['first_name'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Data di nascita</span> |
|
|
|
|
|
<input type="text" name="birth_date" class="datepicker" value="<?= $r['birth_date'];?>"> |
|
|
|
|
|
|
|
|
<span class="font-12">Data</span> |
|
|
|
|
|
<input type="text" name="date" class="datepicker" value="<?= conv_date($r['date']);?>"> |
|
|
</div> |
|
|
</div> |
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Luogo di nascita</span> |
|
|
|
|
|
<input type="text" name="birth_place" value="<?= $r['birth_place'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-9 col-sm-9"> |
|
|
|
|
|
<span class="font-12">Indirizzo</span> |
|
|
|
|
|
<input type="text" name="address" value="<?= $r['address'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-3 col-sm-3"> |
|
|
|
|
|
<span class="font-12">C.A.P.</span> |
|
|
|
|
|
<input type="text" name="zip_code" value="<?= $r['zip_code'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-8 col-sm-8"> |
|
|
|
|
|
<span class="font-12">Comune</span> |
|
|
|
|
|
<input type="text" name="city" value="<?= $r['city'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-4 col-sm-4"> |
|
|
|
|
|
<span class="font-12">Provincia</span> |
|
|
|
|
|
<input type="text" name="province" value="<?= $r['province'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-12"><hr></div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Laureato/a a</span> |
|
|
|
|
|
<input type="text" name="degree_place" value="<?= $r['degree_place'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Laureato/a il</span> |
|
|
|
|
|
<input type="text" name="degree_date" class="datepicker" value="<?= $r['degree_date'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Laureato/a in</span> |
|
|
|
|
|
<input type="text" name="degree" value="<?= $r['degree'];?>"> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-12 col-sm-6"> |
|
|
|
|
|
<span class="font-12">Abilitato/a nel</span> |
|
|
|
|
|
<select name="qualification_date"> |
|
|
|
|
|
<?php for($i=date('Y');$i>=date('Y')-70;$i--){ |
|
|
|
|
|
echo "<option value=\"$i\" "; |
|
|
|
|
|
if($r['qualification_date']==$i){echo "selected";} |
|
|
|
|
|
echo ">$i</option>";} |
|
|
|
|
|
?> |
|
|
|
|
|
</select> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="col-9 col-sm-9"> |
|
|
|
|
|
<span class="font-12">Abilitato/a presso</span> |
|
|
|
|
|
<input type="text" name="qualification_place" value="<?= $r['qualification_place'];?>"> |
|
|
|
|
|
|
|
|
<div class="col-12"> |
|
|
|
|
|
<span class="font-12">Titolo notizia</span> |
|
|
|
|
|
<input type="text" name="title" value="<?= $r['title'];?>"> |
|
|
</div> |
|
|
</div> |
|
|
<div class="col-3 col-sm-3"> |
|
|
|
|
|
<span class="font-12">Attivazione account</span> |
|
|
|
|
|
<select name="enabled"> |
|
|
|
|
|
<option value="1" <?php if($r['enabled']==1){echo "selected";}?>>Account attivo</option> |
|
|
|
|
|
<option value="0" <?php if($r['enabled']==0){echo "selected";}?>>Account NON attivo</option> |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
<div class="col-12 pb-2"> |
|
|
|
|
|
<span class="font-12">Testo notizia</span> |
|
|
|
|
|
<textarea cols="40" rows="6" name="text" class="mce"><?= $r['text'];?></textarea> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
<div class="col-12"> |
|
|
<div class="col-12"> |
|
|
<span class="font-12">Specializzazioni</span> |
|
|
|
|
|
<textarea cols="40" rows="6" name="specializations"><?= strip_tags($r['specializations']);?></textarea> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<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[]\"> |
|
|
|
|
|
<label for=\"check_".$rca['id']."\" class=\"font-10 px-3\">Elimina</label> |
|
|
|
|
|
</div></div>"; |
|
|
|
|
|
} |
|
|
|
|
|
?> |
|
|
|
|
|
</div> |
|
|
|
|
|
<div class="list"> |
|
|
|
|
|
<input type="file" name="files[]" class="file"><label></label> |
|
|
|
|
|
</div> |
|
|
|
|
|
<button class="button button-small add-file"><i class="fa fa-plus"></i> aggiungi riga</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
<div class="col-12 text-right"> |
|
|
<div class="col-12 text-right"> |
|
|
<button type="submit" name="go" value="1">Modifica utente</button> |
|
|
|
|
|
|
|
|
<button type="submit" name="go" value="1">Modifica notizia</button> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</form> |
|
|
</form> |
|
@ -144,15 +111,22 @@ |
|
|
|
|
|
|
|
|
?> |
|
|
?> |
|
|
<form method="post" class="form-mod" data-path="<?= $BASE_URL;?>/sheets/news/mod"> |
|
|
<form method="post" class="form-mod" data-path="<?= $BASE_URL;?>/sheets/news/mod"> |
|
|
<div class="col-12 col-sm-6 mx-auto"> |
|
|
|
|
|
|
|
|
<div class="col-12 col-sm-10 mx-auto"> |
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col"> |
|
|
<div class="col"> |
|
|
<span class="font-12">N° Iscrizione all'Albo</span> |
|
|
|
|
|
|
|
|
<span class="font-12">Seleziona una notizia</span> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
<div class="row"> |
|
|
<div class="row"> |
|
|
<div class="col"> |
|
|
<div class="col"> |
|
|
<input type="text" class="id" name="id"> |
|
|
|
|
|
|
|
|
<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> |
|
|
<div class="col-auto"> |
|
|
<div class="col-auto"> |
|
|
<button type="submit">Modifica</button> |
|
|
<button type="submit">Modifica</button> |
|
|