Changeset 6cf441c
- Timestamp:
- Sep 29, 2025, 4:29:45 PM (2 months ago)
- Branches:
- main
- Children:
- 115eec5
- Parents:
- eb87f0a
- Location:
- admin
- Files:
-
- 2 added
- 5 edited
-
includes/query.php (modified) (2 diffs)
-
modules/elenco_rilevazioni.php (added)
-
modules/gestione_affluenza.php (modified) (7 diffs)
-
modules/gestione_enti_comuni.php (modified) (2 diffs)
-
modules/modules.php (modified) (1 diff)
-
modules/salva_orario_affluenza.php (added)
-
principale.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin/includes/query.php
reb87f0a r6cf441c 75 75 { 76 76 global $id_cons_gen,$id_comune,$prefix,$dbi; 77 $sql="select id_comune,descrizione from ".$prefix."_ele_comune order by descrizione";77 $sql="select * from ".$prefix."_ele_comune order by descrizione"; #id_comune,descrizione 78 78 $sth = $dbi->prepare("$sql"); 79 79 $sth->execute(); … … 92 92 } 93 93 94 function elenco_fasce($id) 95 { 96 global $id_cons,$id_comune,$prefix,$dbi; 97 $sql="select * from ".$prefix."_ele_fascia where id_conf='$id' order by id_fascia"; 98 $sth = $dbi->prepare("$sql"); 99 $sth->execute(); 100 $row = $sth->fetchAll(PDO::FETCH_ASSOC); 101 return($row); 102 } 103 104 function elenco_rilevazioni() 105 { 106 global $id_cons_gen,$prefix,$dbi; 107 $sql="select * from ".$prefix."_ele_rilaff where id_cons_gen='$id_cons_gen' order by data,orario"; 108 $sth = $dbi->prepare("$sql"); 109 $sth->execute(); 110 $row = $sth->fetchAll(PDO::FETCH_ASSOC); 111 return($row); 112 } 113 114 function elenco_utenti() 115 { 116 global $id_cons,$id_comune,$prefix,$dbi; 117 $sql="select * from ".$prefix."_author where id_comune='$id_comune' order by aid"; 118 $sth = $dbi->prepare("$sql"); 119 $sth->execute(); 120 $row = $sth->fetchAll(PDO::FETCH_ASSOC); 121 return($row); 122 } 94 123 95 124 function tipo_consultazione($id) -
admin/modules/gestione_affluenza.php
reb87f0a r6cf441c 1 1 <?php 2 2 require_once '../includes/check_access.php'; 3 3 global $id_cons_gen; 4 4 // Connessione al DB (commentata) 5 5 // $conn = new mysqli("localhost", "user", "password", "nome_database"); … … 16 16 // $datiJson = json_encode($affluenze); 17 17 ?> 18 19 <!-- JavaScript carica i dati dal PHP (commentato) -->20 <script>21 // let affluenze = <?= $datiJson ?? '[]' ?>;22 let affluenze = []; // fallback se MySQL non è attivo23 </script>24 18 25 19 <section class="content"> … … 71 65 </tr> 72 66 </thead> 73 <tbody id="affluenzeRows"></tbody> 67 <tbody id="risultato"> 68 <?php include('elenco_rilevazioni.php'); ?> 69 </tbody> 74 70 </table> 75 71 </div> … … 83 79 84 80 <script> 85 aggiornaTabella();86 87 function aggiornaTabella() {88 const tbody = document.getElementById('affluenzeRows');89 tbody.innerHTML = '';90 affluenze.forEach((a, i) => {91 const tr = document.createElement('tr');92 tr.innerHTML = `93 <td>${a.data}</td>94 <td>${a.ora.padStart(2, '0')}:${a.minuto.padStart(2, '0')}</td>95 <td><button type="button" class="btn btn-danger btn-sm" onclick="rimuoviAffluenza(${i})">Elimina</button></td>96 `;97 tbody.appendChild(tr);98 });99 }100 81 101 82 function aggiungiAffluenza(e) { … … 109 90 } 110 91 111 affluenze.unshift({ ora, minuto, data });112 aggiornaTabella();113 92 114 93 // Salvataggio nel DB (commentato) 94 var xmlhttp = new XMLHttpRequest(); 95 xmlhttp.onreadystatechange = function() { 96 if (this.readyState == 4 && this.status == 200) { 97 document.getElementById("risultato").innerHTML = this.responseText; 98 } 99 } 100 xmlhttp.open("GET","../principale.php?funzione=salvaAffluenza&data="+data+"&ora="+ora+"&minuto="+minuto,true); 101 xmlhttp.send(); 115 102 /* 116 103 fetch(window.location.href, { … … 123 110 124 111 function rimuoviAffluenza(index) { 125 const aff = affluenze[index]; 112 var data = document.getElementById ( "data"+index ).innerText 113 var orario = document.getElementById ( "orario"+index ).innerText 114 var xmlhttp = new XMLHttpRequest(); 115 xmlhttp.onreadystatechange = function() { 116 if (this.readyState == 4 && this.status == 200) { 117 document.getElementById("risultato").innerHTML = this.responseText; 118 } 119 } 120 xmlhttp.open("GET","../principale.php?funzione=salvaAffluenza&data="+data+"&ora="+orario+"&minuto=&op=cancella",true); 121 xmlhttp.send(); 126 122 127 123 // Eliminazione nel DB (commentato) … … 132 128 body: JSON.stringify({ action: 'delete', data: aff.data, ora: aff.ora, minuto: aff.minuto }) 133 129 }).then(r => r.text()).then(console.log); 134 */ 135 136 affluenze.splice(index, 1); 137 aggiornaTabella(); 130 131 */ 132 document.getElementById("riga"+index).style.display = 'none' 138 133 } 139 134 </script> -
admin/modules/gestione_enti_comuni.php
reb87f0a r6cf441c 3 3 4 4 $currentUserRole = $_SESSION['ruolo'] ?? 'operatore'; 5 5 $row=configurazione(); 6 $predefinito=$row[0]['siteistat']; 7 $row=elenco_comuni(); 8 foreach($row as $key=>$val) { 9 if($predefinito===$val['id_comune']) $pred=true; else $pred=false; 10 $enti[]=['id'=>($key+1),'denominazione'=>$val['denominazione'],'codice_istat'=>$val['id_comune'],'capoluogo'=>$val['capoluogo'],'indirizzo'=>$val['indirizzo'],'abitanti'=>$val['fascia'],'fax'=>$val['fax'],'email'=>$val['email'],'cap'=>$val['cap'],'centralino'=>$val['centralino'],'stemma'=>$val['stemma'],'predefinito'=>$pred]; 11 } 12 /* 6 13 $enti = [ 7 14 ['id'=>1, 'denominazione'=>'Comune A', 'codice_istat'=>'001', 'capoluogo'=>'Sì', 'indirizzo'=>'Via Roma 1', 'abitanti'=>'3000-10000', 'fax'=>'0123456789', 'email'=>'comuneA@pec.it', 'cap'=>'00100', 'centralino'=>'123456', 'stemma'=>'', 'predefinito' => true], 8 15 ['id'=>2, 'denominazione'=>'Comune B', 'codice_istat'=>'002', 'capoluogo'=>'No', 'indirizzo'=>'Via Milano 2', 'abitanti'=>'10000-15000', 'fax'=>'9876543210', 'email'=>'comuneB@pec.it', 'cap'=>'00200', 'centralino'=>'654321', 'stemma'=>'', 'predefinito' => false], 9 16 ['id'=>3, 'denominazione'=>'Comune C', 'codice_istat'=>'003', 'capoluogo'=>'Sì', 'indirizzo'=>'Via Napoli 3', 'abitanti'=>'15000-30000', 'fax'=>'0112233445', 'email'=>'comuneC@pec.it', 'cap'=>'00300', 'centralino'=>'112233', 'stemma'=>'', 'predefinito' => false], 10 ]; 17 ]; */ 11 18 //require_once '../includes/db_connection.php'; // Assumendo che qui apri la connessione $conn (mysqli) 12 19 … … 172 179 <label for="abitanti">Abitanti*</label> 173 180 <select class="form-control" id="abitanti" name="abitanti" required> 174 <option value="">Seleziona...</option> 175 <option value="3000-10000">3000 - 10000</option> 176 <option value="10000-15000">10000 - 15000</option> 177 <option value="15000-30000">15000 - 30000</option> 178 <option value="30000-50000">30000 - 50000</option> 179 <option value="50000-100000">50000 - 100000</option> 180 <option value="100000+">Oltre 100000</option> 181 <option value="">Seleziona...</option> 182 <?php 183 $row=elenco_fasce(1); 184 $i=1; 185 foreach($row as $key=>$val){ 186 echo "<option value=\"".$val['id_fascia']."\">".number_format($i,0,',','.')." - ".number_format(($val['abitanti']-1),0,',','.')."</option>"; 187 $i=$val['abitanti']; 188 if($val['id_fascia']==8) break; 189 } 190 ?> 191 <option value="9">Oltre 1.000.000</option> 181 192 </select> 182 193 </div> -
admin/modules/modules.php
reb87f0a r6cf441c 50 50 $sth = $dbi->prepare("SET NAMES 'utf8'"); 51 51 $sth->execute(); 52 52 global $id_cons_gen; 53 53 ob_start(); // attiva output buffering 54 include '../includes/header.php'; 54 include '../includes/header.php'; 55 55 include '../includes/menu.php'; 56 56 include 'contenuto.php'; -
admin/principale.php
reb87f0a r6cf441c 70 70 $permessi=ChiSei($id_cons_gen); 71 71 if($permessi<16) return("Errore: non hai i permessi"); 72 require_once 'includes/query.php'; 72 73 switch ($funzione) { 73 74 case 'salvaAffluenze': … … 88 89 case 'salvaColoreTema': 89 90 include("modules/salva_colore_tema.php"); 91 break; 92 case 'salvaAffluenza': 93 include("modules/salva_orario_affluenza.php"); 90 94 break; 91 95 case 101:
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/eleonline4/chrome/common/trac_banner.png)