Changeset 453
- Timestamp:
- Apr 5, 2025, 1:07:00 AM (8 months ago)
- Location:
- trunk
- Files:
-
- 2 added
- 11 edited
-
admin/versione.php (modified) (1 diff)
-
client/temi/bootstrap/pagine/electionday.php (added)
-
client/temi/bootstrap/pagine/grafici/affluenza.php (modified) (1 diff)
-
client/temi/bootstrap/pagine/grafici/votanti_referendum.php (modified) (1 diff)
-
client/temi/bootstrap/pagine/grafici/voti_referendum.php (modified) (5 diffs)
-
client/temi/bootstrap/pagine/grafici/votidigruppo.php (modified) (1 diff)
-
client/temi/bootstrap/pagine/grafici/votidilista.php (modified) (1 diff)
-
client/temi/bootstrap/pagine/listaecandidati.php (modified) (6 diffs)
-
client/temi/bootstrap/pagine/referendumpersezioni.php (modified) (3 diffs)
-
client/temi/bootstrap/pagine/tab_link_opendata.php (added)
-
client/temi/bootstrap/query.php (modified) (4 diffs)
-
client/variabili.php (modified) (1 diff)
-
client/versione.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/versione.php
r452 r453 1 1 <?php 2 2 3 $versione = "3.0 rev 45 2";3 $versione = "3.0 rev 453"; 4 4 $version_number = $versione; 5 5 $datarel = "04 aprile 2025"; -
trunk/client/temi/bootstrap/pagine/grafici/affluenza.php
r450 r453 67 67 <h4 class="fw-semibold text-primary mobile-expanded mt-2">Affluenza</h4> 68 68 </div> 69 <?php include 'temi/bootstrap/pagine/tab_link_opendata.php'; ?> 69 70 <div class="table-responsive overflow-x"> 70 71 <table class="table mb-0"> -
trunk/client/temi/bootstrap/pagine/grafici/votanti_referendum.php
r451 r453 3 3 $quesiti=elenco_gruppi('gruppo'); 4 4 if(isset($_GET['num_gruppo'])) $num_gruppo=intval($_GET['num_gruppo']); else $num_gruppo=1; 5 foreach($quesiti as $val) if($val['num_gruppo']==$num_gruppo) {$id_gruppo=$val['id_gruppo']; $nome_quesito= $val['descrizione'];}5 foreach($quesiti as $val) if($val['num_gruppo']==$num_gruppo) {$id_gruppo=$val['id_gruppo']; $nome_quesito='Quesito '. $val['num_gruppo'];} 6 6 $rowscrutinate=voti_referendum($id_gruppo); 7 7 $sezionitotali=sezioni_totali(); -
trunk/client/temi/bootstrap/pagine/grafici/voti_referendum.php
r450 r453 1 1 <?php 2 $quesiti=elenco_gruppi('gruppo'); 3 if(isset($_GET['num_gruppo'])) $num_gruppo=intval($_GET['num_gruppo']); else $num_gruppo=1; 4 foreach($quesiti as $val) if($val['num_gruppo']==$num_gruppo) {$id_gruppo=$val['id_gruppo']; $nome_quesito=$val['descrizione'];} 5 $rowscrutinate=voti_referendum($id_gruppo); 6 $sezionitotali=sezioni_totali(); 7 $scrutinate=0; 8 $si=0; 9 $no=0; 10 foreach($rowscrutinate as $val) 11 if($val['si']+$val['no']!=0) { 12 $scrutinate++; 13 $si+=$val['si']; 14 $no+=$val['no']; 15 } 16 $si=number_format($si,0,'','.'); 17 $no=number_format($no,0,'','.'); 18 $tot=$si+$no; 19 $perc_si=number_format($si/$tot*100,2); 20 $perc_no=number_format($no/$tot*100,2); 2 $quesiti = elenco_gruppi('gruppo'); 3 $num_gruppo = isset($_GET['num_gruppo']) ? intval($_GET['num_gruppo']) : 1; 4 5 $id_gruppo = null; 6 $nome_quesito = ''; 7 8 foreach ($quesiti as $val) { 9 if ($val['num_gruppo'] == $num_gruppo) { 10 $id_gruppo = $val['id_gruppo']; 11 $nome_quesito = $val['descrizione']; 12 break; 13 } 14 } 15 16 $rowscrutinate = voti_referendum($id_gruppo); 17 $sezionitotali = sezioni_totali(); 18 $scrutinate = $si_raw = $no_raw = 0; 19 20 foreach ($rowscrutinate as $val) { 21 if ($val['si'] + $val['no'] != 0) { 22 $scrutinate++; 23 $si_raw += $val['si']; 24 $no_raw += $val['no']; 25 } 26 } 27 28 $tot = $si_raw + $no_raw; 29 $perc_si = $tot > 0 ? number_format($si_raw / $tot * 100, 2) : 0; 30 $perc_no = $tot > 0 ? number_format($no_raw / $tot * 100, 2) : 0; 31 32 $si = number_format($si_raw, 0, '', '.'); 33 $no = number_format($no_raw, 0, '', '.'); 21 34 22 35 $quesito = [ 23 'Quesito ' .$num_gruppo => [[$perc_si, $si], [$perc_no, $no]],36 'Quesito ' . $num_gruppo => [[$perc_si, $si], [$perc_no, $no]], 24 37 ]; 25 38 26 39 $labels = array_keys($quesito); 27 $scrutinate =10;28 $sezionitotali=15;29 40 ?> 30 41 … … 35 46 #chartContainer { 36 47 width: 100%; 37 height: 500px; /* Altezza fissa che si adatta con le barre */48 height: 500px; 38 49 margin: 0 auto; 39 50 } … … 41 52 @media (max-width: 768px) { 42 53 #chartContainer { 43 height: 700px; /* Maggiore altezza per dispositivi mobili */54 height: 700px; 44 55 } 45 56 } 46 57 </style> 47 <!-- Blocco select quesito referndum--> 48 <div class="container pb-2">49 <label for="defaultSelect">Seleziona Quesito</label>50 <select id="defaultSelect" onchange="location = this.value;">51 <!-- option selected>Selezione Quesito</option -->52 <?php 53 $desc=''; 54 foreach($quesiti as $key=>$val) { 55 if ($num_gruppo==$val[1]) {$id_gruppo=$val['id_gruppo']; $sel='selected';} else {$sel='';} 56 ?>57 <option <?php echo $sel; ?> value=" <?php echo "modules.php?op=53&id_comune=$id_comune&file=index&id_cons_gen=$id_cons_gen&num_gruppo=".$val[1];?>">Quesito <?php echo $val['num_gruppo'];?></option>58 <?php }?>59 </select>60 </div> 61 <!-- fine Blocco select quesito referndum-->58 59 <!-- Blocco select quesito referendum --> 60 <div class="container pb-2"> 61 <label for="defaultSelect">Seleziona Quesito</label> 62 <select id="defaultSelect" onchange="location = this.value;"> 63 <?php foreach ($quesiti as $val) : ?> 64 <option value="modules.php?op=53&id_comune=<?= $id_comune; ?>&file=index&id_cons_gen=<?= $id_cons_gen; ?>&num_gruppo=<?= $val['num_gruppo']; ?>" 65 <?= $num_gruppo == $val['num_gruppo'] ? 'selected' : ''; ?>> 66 Quesito <?= $val['num_gruppo']; ?> 67 </option> 68 <?php endforeach; ?> 69 </select> 70 </div> 71 72 <!-- Tabella risultati --> 62 73 <div class="container"> 63 74 <div class="row text-center"> 64 75 <h4 class="fw-semibold text-primary mobile-expanded mt-2">Risultati Referendum</h4> 65 76 </div> 66 <div class="table-responsive overflow-x"> 67 <table class="table mb-0"> 68 <thead class="title-content"> 69 <tr> 70 <th>Risultati Referendum</th> 71 <?php if ($scrutinate == $sezionitotali) {?> 72 <th class="text-end">Dati finali</th> 73 <?php } else {?> 74 <th class="text-end"><span>Sezioni scrutinate: <?php echo $scrutinate; ?> su <?php echo $sezionitotali; ?></span> 75 </th> 76 <?php }?> 77 </tr> 78 </thead> 79 </table> 80 </div> 77 <div class="table-responsive overflow-x"> 78 <table class="table mb-0"> 79 <thead class="title-content"> 80 <tr> 81 <th>Risultati Referendum</th> 82 <th class="text-end"> 83 <?= $scrutinate == $sezionitotali ? 'Dati finali' : "Sezioni scrutinate: $scrutinate su $sezionitotali"; ?> 84 </th> 85 </tr> 86 </thead> 87 </table> 88 </div> 89 81 90 <div id="chartContainer"> 82 91 <canvas id="risultatiChart"></canvas> … … 87 96 var ctx = document.getElementById('risultatiChart').getContext('2d'); 88 97 89 var labels = <?php echo json_encode($labels); ?>; 90 var quesiti = <?php echo json_encode($quesito); ?>; 91 98 var labels = <?= json_encode($labels); ?>; 99 var quesiti = <?= json_encode($quesito); ?>; 92 100 const predefinedColors = ['rgb(54, 162, 235)', 'rgb(255, 99, 132)']; 93 101 … … 107 115 ]; 108 116 109 var chartHeight = Math.max(500, labels.length * 80); // Altezza del grafico dinamica117 var chartHeight = Math.max(500, labels.length * 80); 110 118 document.getElementById('chartContainer').style.height = chartHeight + 'px'; 111 119 112 var risultatiChart = new Chart(ctx, { 113 type: 'bar', 114 data: { 115 labels: labels, 116 datasets: datasets 120 var risultatiChart = new Chart(ctx, { 121 type: 'bar', 122 data: { 123 labels: labels, 124 datasets: datasets 125 }, 126 options: { 127 responsive: true, 128 maintainAspectRatio: false, 129 indexAxis: 'y', 130 scales: { 131 x: { beginAtZero: true, max: 100 }, 132 y: { 133 ticks: { stepSize: 1 }, 134 barThickness: "flex", // Adatta lo spessore automaticamente 135 maxBarThickness: 50 // Imposta un limite massimo per evitare che le barre diventino troppo grandi 136 } 137 117 138 }, 118 options: { 119 responsive: true, 120 maintainAspectRatio: false, 121 indexAxis: 'y', 122 scales: { 123 x: { 124 beginAtZero: true, 125 max: 100 126 }, 127 y: { 128 ticks: { 129 stepSize: 1 130 }, 131 barThickness: 60, // Maggiore spessore delle barre 132 } 133 }, 134 plugins: { 135 legend: { 136 display: true 137 }, 138 tooltip: { 139 callbacks: { 140 label: function (context) { 141 var datasetIndex = context.datasetIndex; 142 var dataIndex = context.dataIndex; 143 144 var tipoVoto = context.dataset.label; 145 var percentuale = context.raw; 146 var voti = quesiti[context.label][datasetIndex][1]; 147 148 return tipoVoto + ': ' + percentuale + '% (' + voti + ' voti)'; 149 } 139 plugins: { 140 legend: { display: true }, 141 tooltip: { 142 callbacks: { 143 label: function (context) { 144 var datasetIndex = context.datasetIndex; 145 var dataIndex = context.dataIndex; 146 var tipoVoto = context.dataset.label; 147 var percentuale = context.raw; 148 var voti = quesiti[context.label][datasetIndex][1]; 149 return tipoVoto + ': ' + percentuale + '% (' + voti + ' voti)'; 150 150 } 151 151 } 152 152 } 153 } ,154 plugins: [155 {156 id: 'insideBarPercentage',157 afterDatasetDraw: function (chart) {158 const ctx = chart.ctx;159 chart.data.datasets.forEach(function (dataset, datasetIndex) {160 if (!chart.isDatasetVisible(datasetIndex)) return;153 } 154 }, 155 plugins: [{ 156 id: 'outsideBarLabels', 157 afterDatasetDraw: function (chart) { 158 const ctx = chart.ctx; 159 chart.data.datasets.forEach(function (dataset, datasetIndex) { 160 if (!chart.isDatasetVisible(datasetIndex)) return; 161 161 162 dataset.data.forEach(function (value, index) {163 const meta = chart.getDatasetMeta(datasetIndex).data[index];164 const x = meta.base + (meta.width / 2);165 const y = meta.y;162 dataset.data.forEach(function (value, index) { 163 const meta = chart.getDatasetMeta(datasetIndex).data[index]; 164 const x = meta.x + 10; // Sposta il testo fuori dalla barra 165 const y = meta.y; 166 166 167 const text = value + '% (' + quesiti[chart.data.labels[index]][datasetIndex][1] + ' voti)'; 168 const isSmallBar = value < 10; 169 const fontSize = isSmallBar ? 10 : 16; 167 const text = value + '% (' + quesiti[chart.data.labels[index]][datasetIndex][1] + ' voti)'; 170 168 171 ctx.save();172 ctx.fillStyle = '#000000';173 ctx.font = `bold ${fontSize}px Titillium Web, Arial`;174 ctx.textAlign = 'center';175 ctx.textBaseline = 'middle';176 ctx.fillText(text, x, y);177 ctx.restore();178 });179 });180 }181 }182 ] 183 }); 169 ctx.save(); 170 ctx.fillStyle = '#000000'; 171 ctx.font = 'bold 16px Titillium Web, Arial'; 172 ctx.textAlign = 'left'; // Allinea il testo fuori dalla barra 173 ctx.textBaseline = 'middle'; 174 ctx.fillText(text, x, y); 175 ctx.restore(); 176 }); 177 }); 178 } 179 }] 180 }); 181 184 182 </script> -
trunk/client/temi/bootstrap/pagine/grafici/votidigruppo.php
r448 r453 3 3 $scrutinate = scrutinate('gruppo'); 4 4 $sezionitotali = sezioni_totali(); 5 $dati = voti_ tot_gruppo();5 $dati = voti_gruppo_graf(); 6 6 # t2.num_gruppo,t2.descrizione,sum(t1.voti) 7 7 $descr = []; -
trunk/client/temi/bootstrap/pagine/grafici/votidilista.php
r447 r453 3 3 $scrutinate=scrutinate('lista'); 4 4 $sezionitotali=sezioni_totali(); 5 $dati = voti_ tot_lista();5 $dati = voti_lista_graf(); #voti_tot_lista(); 6 6 # t1.id_lista,t2.num_gruppo,t2.num_lista,t2.descrizione,sum(t1.voti) 7 7 $descr = []; -
trunk/client/temi/bootstrap/pagine/listaecandidati.php
r441 r453 17 17 $row=scrutinio_schede($tab); 18 18 $schede_scrutinate=$row[0][0]; 19 include 'electionday.php'; //Pagina Election Day 19 20 if(!$schede_scrutinate) $schede_scrutinate=0; 20 21 // Blocco affluenza mettere spoglioattivo==0 dopo aver sistemato le affluenze $tab … … 46 47 $numeroorari=count($rowora); 47 48 $giorno=array('domenica','lunedì','martedì','mercoledì','giovedì','venerdì','sabato'); 49 48 50 #<!--Tabella affluenza --> 49 51 #<!--mettere $spoglioattivo==0 dopo aver sistemato tutto e funzionante--> … … 157 159 <thead class="title-content"> 158 160 <tr> 159 <th>Voti per <?php echo _GRUPPO;?> e Preferenze </th>161 <th>Voti per <?php echo _GRUPPO;?> e Preferenze </th> 160 162 <?php if ($spoglioattivo==1) {?> 161 163 <?php if ($scrutinate == $sezionitotali) {?> … … 429 431 <div class="col-auto me-2"> 430 432 <strong>Elettori:</strong> 431 <?php if(!isset($elet[0][2])) $elet[0][2]=0; number_format($elet[0][2], 0, ".", ".") ?>433 <?php if(!isset($elet[0][2])) $elet[0][2]=0; echo number_format($elet[0][2], 0, ".", ".") ?> 432 434 </div> 433 435 <!-- Votanti --> … … 444 446 </div> 445 447 <!-- Schede --> 446 <?php if (($row[0][0] + $row[0][1] + $row[0][3]) > 0): ?>448 <?php $row=voti_totali(); if (($row[0][0] + $row[0][1] + $row[0][3]) > 0): ?> 447 449 <?php 448 450 $schede = ['valide' => 0, 'nulle' => 1, 'bianche' => 2, 'contestate' => 3]; … … 453 455 <div class="col-auto me-2"> 454 456 <strong>Schede <?= $nome ?>:</strong> 455 <?php number_format($conteggio, 0, ".", ".") ?>456 (<?php number_format($percentuale, 2) ?>%)457 <?php echo number_format($conteggio, 0, ".", ".") ?> 458 (<?php echo number_format($percentuale, 2) ?>%) 457 459 </div> 458 460 <?php endforeach; ?> -
trunk/client/temi/bootstrap/pagine/referendumpersezioni.php
r442 r453 83 83 <tbody> 84 84 <?php 85 $tot uomini=0;$totdonne=0;$totespressi=0;$totvalidi=0;$totnulli=0;$totbianchi=0;$totcontestati=0;85 $totsi=0;$totno=0;$totuomini=0;$totdonne=0;$totespressi=0;$totvalidi=0;$totnulli=0;$totbianchi=0;$totcontestati=0; 86 86 $seztemp=elenco_sezioni(0); 87 87 foreach($seztemp as $sez) $sezioni[$sez['num_sez']]=$sez['id_sez']; … … 95 95 else 96 96 $aff=ultime_affluenze_sezione($row[$sezioni[$i]]['id_sez']); 97 $tot uomini+=$aff[0]['voti_uomini'];$totdonne+=$aff[0]['voti_donne'];$totespressi+=$aff[0]['voti_complessivi'];$totvalidi+=$row[$sezioni[$i]]['validi'];$totnulli+=$row[$sezioni[$i]]['nulli'];$totbianchi+=$row[$sezioni[$i]]['bianchi'];$totcontestati+=$row[$sezioni[$i]]['contestati']; ?>97 $totsi+=$row[$sezioni[$i]]['si'];$totno+=$row[$sezioni[$i]]['no'];$totuomini+=$aff[0]['voti_uomini'];$totdonne+=$aff[0]['voti_donne'];$totespressi+=$aff[0]['voti_complessivi'];$totvalidi+=$row[$sezioni[$i]]['validi'];$totnulli+=$row[$sezioni[$i]]['nulli'];$totbianchi+=$row[$sezioni[$i]]['bianchi'];$totcontestati+=$row[$sezioni[$i]]['contestati']; ?> 98 98 <tr> 99 99 <th scope="row"><?php echo $i;?></th> … … 110 110 <tr class="primary-bg-c4 white-color align-middle text-end"> 111 111 <td scope="row">Totale</td> 112 <td><?php echo $tot uomini ?></th>113 <th><?php echo $tot donne?></th>112 <td><?php echo $totsi ?></th> 113 <th><?php echo $totno ?></th> 114 114 <th><?php echo $totvalidi ?></th> 115 115 <th><?php echo $totnulli ?></th> -
trunk/client/temi/bootstrap/query.php
r452 r453 605 605 global $id_cons,$prefix,$dbi,$circo,$idcirc; 606 606 if($idlista) $filtro="and t2.id_lista=$idlista"; else $filtro=''; 607 $sql="select t2.id_cand, t2.num_lista,t2.num_cand,concat(t2.cognome,' ', t2.nome) as descrizione,sum(t1.voti) as votisum,t2.id_lista,t2.eletto from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' $filtro group by t2.id_cand,t2.num_lista,t2.num_cand,descrizione,t2.id_lista,t2.eletto order by votisum desc ";607 $sql="select t2.id_cand, t2.num_lista,t2.num_cand,concat(t2.cognome,' ', t2.nome) as descrizione,sum(t1.voti) as votisum,t2.id_lista,t2.eletto from ".$prefix."_ele_voti_candidati as t1 left join ".$prefix."_ele_candidati as t2 on t1.id_cand=t2.id_cand where t1.id_cons='$id_cons' $filtro group by t2.id_cand,t2.num_lista,t2.num_cand,descrizione,t2.id_lista,t2.eletto order by votisum desc,t2.num_cand"; 608 608 $sth = $dbi->prepare("$sql"); 609 609 $sth->execute(); … … 912 912 }else 913 913 $filtro=''; 914 $sql="SELECT sum(validi) ,sum(nulli),sum(bianchi),sum(contestati)FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $filtro";914 $sql="SELECT sum(validi) as valide,sum(nulli) as nulle,sum(bianchi) as bianche,sum(contestati) as contestate FROM ".$prefix."_ele_sezioni where id_cons='$id_cons' $filtro"; 915 915 $sth = $dbi->prepare("$sql"); 916 916 $sth->execute(); … … 944 944 } 945 945 946 function voti_lista_graf() 947 { 948 global $id_cons,$prefix,$dbi,$circo,$idcirc; 949 if($circo) $cond="and t2.id_circ='$idcirc'"; else $cond=''; 950 $sql="select t1.id_lista,t2.num_gruppo,t2.num_lista,t2.descrizione,sum(t1.voti) as votisum from ".$prefix."_ele_voti_lista as t1 left join ".$prefix."_ele_lista as t2 on t1.id_lista=t2.id_lista where t1.id_cons='$id_cons' $cond group by t1.id_lista,t2.num_gruppo,t2.num_lista,t2.descrizione order by votisum desc,t2.num_lista"; 951 $sth = $dbi->prepare("$sql"); 952 $sth->execute(); 953 $row = $sth->fetchAll(); 954 return($row); 955 956 } 957 946 958 function voti_tot_gruppo() 947 959 { … … 956 968 } 957 969 970 function voti_gruppo_graf() 971 { 972 global $id_cons,$prefix,$dbi,$circo,$idcirc; 973 if($circo) $cond="and t2.id_circ='$idcirc'"; else $cond=''; 974 $sql="select t2.num_gruppo,t2.descrizione,sum(t1.voti) as votisum from ".$prefix."_ele_voti_gruppo as t1 left join ".$prefix."_ele_gruppo as t2 on t1.id_gruppo=t2.id_gruppo where t1.id_cons='$id_cons' $cond group by t2.num_gruppo,t2.descrizione order by votisum desc,t2.num_gruppo"; 975 $sth = $dbi->prepare("$sql"); 976 $sth->execute(); 977 $row = $sth->fetchAll(); 978 return($row); 979 980 } 981 958 982 function voti_tot_referendum() 959 983 { -
trunk/client/variabili.php
r431 r453 5 5 ### Variabili di programma 6 6 # 7 $offsetliste=16; # Risultati numero di liste visualizzate nella pagina 8 $offsetgruppi=15; # Risultati numero di gruppi visualizzati nella pagina 9 $numcandvis=16; # Numero di candidati visualizzati per pagina 10 $numsezvis=26; # Numero di sezioni visualizzate per pagina 11 $datigenvis=20; # Elementi visualizzati in scheda Dati generali 12 7 $offsetliste=16; # Risultati numero di liste visualizzate nella pagina 8 $offsetgruppi=15; # Risultati numero di gruppi visualizzati nella pagina 9 $numcandvis=16; # Numero di candidati visualizzati per pagina 10 $numsezvis=26; # Numero di sezioni visualizzate per pagina 11 $datigenvis=20; # Elementi visualizzati in scheda Dati generali 12 $giorniviselday=29; # Massimo numero di giorni in cui viene visualizzata la sezione Election day 13 # (visualizza i pulsanti di accesso diretto alle singole consultazioni) 13 14 14 15 #La variabile $arcon stabilisce l'ordine di visualizzazione delle consultazioni nel menu bootstrap -
trunk/client/versione.php
r452 r453 1 1 <?php 2 $versione = "3.0 rev 45 2";2 $versione = "3.0 rev 453"; 3 3 $version_number = $versione; 4 4 $datarel = "04 aprile 2025";
Note:
See TracChangeset
for help on using the changeset viewer.
