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.
		
		
		
		
		
			
		
			
				
					
					
						
							110 lines
						
					
					
						
							5.1 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							110 lines
						
					
					
						
							5.1 KiB
						
					
					
				| <div class="row"> | |
|     <div class="col-12"> | |
|         <div class="section-title">Aggiungi notizia</div> | |
|     </div> | |
|     <div class="col-12"> | |
| 
 | |
|         <div class="sheet-box p-4"> | |
| 
 | |
|         <?php | |
|             if($_POST['go']){ | |
| 
 | |
|                 $append = array(); | |
| 
 | |
|                 if($_FILES['files']){ | |
|                     $files = reArrayFiles($_FILES['files']); | |
|                     foreach ($files as $index => $file) { | |
|                         if(is_uploaded_file($file['tmp_name'])){ | |
|                             $filename = date("Ymd")."-".preg_replace('/[^a-zA-Z0-9\-\._]/','_', $file['name']); | |
|                             $filesize = ($file['size'] < 1000000) ? round($file['size'] / 1000)."k" : round($file['size'] / 1000000)."M"; | |
|                             $title = $_POST['titles'][$index]; | |
|                             $path = '/docs/files/news'; | |
| 
 | |
|                             move_uploaded_file($file['tmp_name'], "..$path/$filename"); | |
|                             $qf=mysqli_query($conn, "INSERT INTO files VALUES(null, '$title', '$filename', '".$path."', NOW(), '$filesize')"); | |
|                             $append[$index] = mysqli_insert_id($conn); | |
|                         } | |
|                     } | |
|                 } | |
| 
 | |
|                 if($_POST['section'] != "NONE") { | |
|                   $q=mysqli_query($conn, "INSERT INTO links VALUES(null, | |
|                                             '".addslashes(trim($_POST['title']))."', | |
|                                             '".addslashes(trim($_POST['text']))."', | |
|                                             '".$_POST['section']."')"); | |
|                 } | |
| 
 | |
|                 $q=mysqli_query($conn, "INSERT INTO news VALUES(null, | |
|                                         '".addslashes(trim($_POST['title']))."', '".addslashes(trim($_POST['text']))."', | |
|                                         '".trim(conv_date_en($_POST['date']))."','".implode(',',$append)."')"); | |
| 
 | |
|                 echo '<div class="col-10 text-center mx-auto my-5"> | |
|                         <p><i class="fa fa-check-circle font-alert p-4"></i></p> | |
|                         Notizia aggiunta correttamente! | |
|                     </div>'; | |
| 
 | |
| 
 | |
|             }else{ | |
|         ?> | |
|             <form method="post" enctype="multipart/form-data"> | |
|                 <div class="row"> | |
|                     <div class="col-12 col-sm-6"> | |
|                         <span class="font-12">Data</span> | |
|                         <input type="text" name="date" class="datepicker" value="<?= date("d/m/Y");?>"> | |
|                     </div> | |
|                     <div class="col-12"> | |
|                         <span class="font-12">Titolo notizia</span> | |
|                         <input type="text" name="title"> | |
|                     </div> | |
|                     <div class="col-12 pb-2"> | |
|                         <span class="font-12">Testo notizia</span> | |
|                         <textarea cols="40" rows="6" name="text" class="mce"></textarea> | |
|                     </div> | |
|  | |
|                     <div class="col-12"> | |
|                         <span class="font-12">Allegato/i</span> | |
|                         <div class="files-list"> | |
|                             <div class="list"> | |
|                                 <div class="row master"> | |
|                                     <div class="col-8"> | |
|                                         <input type="text" name="titles[]" placeholder="Nome del file"> | |
|                                     </div> | |
|                                     <div class="col-4"> | |
|                                         <input type="file" name="files[]"> | |
|                                     </div> | |
|                                 </div> | |
|                             </div> | |
|                             <button class="button button-small add-file"><i class="fa fa-plus"></i> aggiungi riga</button> | |
|                         </div> | |
|  | |
|                     </div> | |
|                     <div class="col-12"> | |
|                         <span class="font-12">Link nella sezione</span> | |
|                         <select name="section"> | |
|                             <option value="NONE">- Nessun link -</option> | |
|                             <option value="ecm">ECM</option> | |
|                             <option value="cerca-un-farmaco">Cerca un farmaco</option> | |
|                             <option value="siti-istituzionali">Siti istituzionali</option> | |
|                             <option value="siti-informativi">Siti informativi</option> | |
|                             <option value="farmaci">Farmaci</option> | |
|                             <option value="asl-della-provincia">A.S.L. della Provincia</option> | |
|                             <option value="consulenze">Consulenze</option> | |
|                             <option value="attivita-convenzionate">Attività convenzionate</option> | |
|                             <option value="bilanci-dell-ordine">Bilanci dell'Ordine</option> | |
|                         </select> | |
|                       </div> | |
|                     <div class="col-12 text-right"> | |
|                         <button type="submit" name="go" value="1">Aggiungi notizia</button> | |
|                     </div> | |
|                 </div> | |
|             </form> | |
|  | |
|             <?php | |
|                 } | |
|             ?> | |
|  | |
|         </div> | |
|  | |
|     </div> | |
| </div> | |
| 
 |