[2] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /************************************************************************/
|
---|
| 4 | /* Eleonline - Raccolta e diffusione dei dati elettorali */
|
---|
| 5 | /* by Roberto Gigli & Luciano Apolito */
|
---|
| 6 | /* http://www.eleonline.it */
|
---|
| 7 | /* info@eleonline.it luciano@aniene.net rgigli@libero.it */
|
---|
| 8 | /************************************************************************/
|
---|
| 9 | /* Modulo Autorizzazione Comuni */
|
---|
| 10 | /* Amministrazione */
|
---|
| 11 | /************************************************************************/
|
---|
| 12 | # e' l'unico file in cui Ú presente un controllo su tipo_cons, per ora va bene così. Per toglierlo va inserito un campo-flag in ele_tipo per indicare se per il tipo di consultazione si dovra' procedere al calcolo dell'assegnazione dei seggi
|
---|
| 13 | if (!defined('ADMIN_FILE')) {
|
---|
| 14 | die ("You can't access this file directly...");
|
---|
| 15 | }
|
---|
[257] | 16 | global $dbi;
|
---|
[2] | 17 | $aid=$_SESSION['aid'];
|
---|
| 18 | $prefix=$_SESSION['prefix'];
|
---|
| 19 | $id_comune=$_SESSION['id_comune'];
|
---|
| 20 | $id_cons_gen=intval($_GET['id_cons_gen']);
|
---|
| 21 | $perms=ChiSei(0);
|
---|
| 22 | if ($perms<128 or !$id_cons_gen) die("$perms Non hai i permessi per inserire dati, o non hai scelto la consultazione!");
|
---|
[257] | 23 | $sql="SELECT t1.tipo_cons,t1.descrizione,t2.id_cons,t2.id_conf FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_comune='$id_comune' ";
|
---|
| 24 | $res = $dbi->prepare("$sql");
|
---|
| 25 | $res->execute();
|
---|
| 26 | # $gru = $sth->fetch(PDO::FETCH_BOTH);
|
---|
| 27 | list($tipo_cons,$descr_cons,$id_cons,$id_conf) = $res->fetch(PDO::FETCH_NUM);
|
---|
[2] | 28 |
|
---|
[257] | 29 | $sql="SELECT genere FROM ".$prefix."_ele_tipo where tipo_cons='$tipo_cons' ";
|
---|
| 30 | $res = $dbi->prepare("$sql");
|
---|
| 31 | $res->execute();
|
---|
| 32 | list($genere) = $res->fetch(PDO::FETCH_NUM);
|
---|
[2] | 33 |
|
---|
| 34 | include("modules/Elezioni/funzionidata.php");
|
---|
| 35 | include("modules/Elezioni/ele.php");
|
---|
| 36 | if (isset($_GET['descr_comu'])) get_magic_quotes_gpc() ? $descr_comu=$param['descr_comu']:$descr_comu=addslashes($param['descr_comu']); else $descr_comu='';
|
---|
| 37 | if (isset($_GET['do'])) get_magic_quotes_gpc() ? $do=$param['do']:$do=addslashes($param['do']); else $do='';
|
---|
| 38 | if (isset($_GET['ok'])) $ok=intval($_GET['ok']); else $ok='';
|
---|
| 39 | if (isset($_GET['id_cons_comu'])) $id_cons_comu=intval($_GET['id_cons_comu']); else $id_cons_comu='';
|
---|
| 40 | if (isset($_GET['id_collegio'])) $id_collegio=intval($_GET['id_collegio']); else $id_collegio='';
|
---|
| 41 | if (isset($_GET['idcomune'])) $idcomune=intval($_GET['idcomune']); else $idcomune='';
|
---|
| 42 | if (isset($_GET['idcomunenew'])) $idcomunenew=intval($_GET['idcomunenew']); else $idcomunenew='';
|
---|
| 43 | if (isset($_GET['chiusa'])) $chiusa=intval($_GET['chiusa']); else $chiusa='';
|
---|
| 44 | if (isset($_GET['id_conf'])) $id_conf=intval($_GET['id_conf']); else $id_conf=0;
|
---|
[189] | 45 | if (isset($_GET['idfascia'])) $idfascia=intval($_GET['idfascia']); else $idfascia=0;
|
---|
[2] | 46 | if (isset($_GET['min'])) $min=intval($_GET['min']); else $min=0;
|
---|
[86] | 47 | if (isset($_GET['help'])) $help=intval($_GET['help']);
|
---|
| 48 | if (isset($_GET['pwd4'])) $pwd4=intval($_GET['pwd4']);
|
---|
[185] | 49 | if (isset($_GET['preferenze'])) $preferenze=intval($_GET['preferenze']); else $preferenze=1;
|
---|
[189] | 50 | if (isset($_GET['vismf'])) $vismf=intval($_GET['vismf']); else $vismf=0;
|
---|
[235] | 51 | if (isset($_GET['sg'])) $sg=intval($_GET['sg']); else $sg=0;
|
---|
[254] | 52 | if (isset($_GET['disgiunto'])) $disgiunto=intval($_GET['disgiunto']); else $disgiunto=0;
|
---|
[2] | 53 |
|
---|
| 54 | $offset=15;
|
---|
| 55 | $hiddenInfo = "<input type=\"hidden\" name=\"min\" value=\"$min\">";
|
---|
| 56 |
|
---|
| 57 |
|
---|
| 58 | /******************************************************/
|
---|
| 59 | /*Funzione di visualizzazione globale */
|
---|
| 60 | /*****************************************************/
|
---|
[77] | 61 | //
|
---|
[2] | 62 | function all() {
|
---|
[254] | 63 | global $user, $admin, $bgcolor1, $bgcolor2, $prefix,$descr_cons, $dbi,$id_cons,$desc,$indirizzo,$centralino,$fax,$id_cons_gen,$id_collegio,$idcomune,$chiusa,$id_conf,$tipo_cons,$language,$help,$preferenze,$idfascia,$vismf,$sg,$disgiunto,$id_cons_comu;
|
---|
[2] | 64 | $aid=$_SESSION['aid'];
|
---|
[86] | 65 | $prefix=$_SESSION['prefix'];
|
---|
| 66 | ############# Controllo flag per cancellazione consultazione
|
---|
[87] | 67 | echo "<SCRIPT type=\"text/javascript\">\n\n<!--\n"
|
---|
| 68 | ."//-->\n";
|
---|
| 69 | echo "function del_cons() {\n";
|
---|
| 70 | echo "if (document.getElementById('pwd3').checked==false) {\n";
|
---|
| 71 | echo "if (document.getElementById('chiusa').selectedIndex==3) document.getElementById('chiusa').options[0].selected=true \n";
|
---|
| 72 | echo "document.getElementById('pwd4').checked=false \n";
|
---|
| 73 | echo "document.getElementById('trspunta').style.visibility='hidden' \n";
|
---|
| 74 | echo "} \n";
|
---|
| 75 | echo "else document.getElementById('trspunta').style.visibility='visible' \n";
|
---|
| 76 | echo "if (document.getElementById('chiusa').selectedIndex!=3) { \n";
|
---|
| 77 | echo "document.getElementById('add').value=\""._MODIFY."\" \n";
|
---|
| 78 | echo "document.getElementById('do').value=\"update\" \n";
|
---|
| 79 | echo "}else{\n";
|
---|
| 80 | echo "if (document.getElementById('pwd4').checked==false) \n";
|
---|
| 81 | echo "document.getElementById('add').value=\""._DELETE." "._DATI."\" \n";
|
---|
| 82 | echo "else document.getElementById('add').value=\""._DELETE." "._CONSULTA."\" \n";
|
---|
| 83 | echo "document.getElementById('do').value=\"delete\" \n";
|
---|
| 84 | echo "} \n";
|
---|
| 85 | echo "} \n";
|
---|
| 86 | echo "</script>\n";
|
---|
| 87 |
|
---|
[192] | 88 | echo "<script type=\"text/javascript\" language=\"JavaScript\" >\n\n<!--\n"
|
---|
| 89 | ."//-->\n";
|
---|
| 90 | echo "function showdate(str,posiz,tempo)\n";
|
---|
| 91 | echo "{\n";
|
---|
| 92 | echo "if (str==\"\")\n";
|
---|
| 93 | echo " {\n";
|
---|
| 94 | echo " document.getElementById(posiz).innerHTML=\"\";\n";
|
---|
| 95 | echo " return;\n";
|
---|
| 96 | echo " }\n";
|
---|
| 97 | echo "if (window.XMLHttpRequest)\n";
|
---|
| 98 | echo " {// code for IE7+, Firefox, Chrome, Opera, Safari\n";
|
---|
| 99 | echo " xmlhttp=new XMLHttpRequest();\n";
|
---|
| 100 | echo " }\n";
|
---|
| 101 | echo "else\n";
|
---|
| 102 | echo " {// code for IE6, IE5\n";
|
---|
| 103 | echo " xmlhttp=new ActiveXObject(\"Microsoft.XMLHTTP\");\n";
|
---|
| 104 | echo " }\n";
|
---|
| 105 | echo "xmlhttp.onreadystatechange=function()\n";
|
---|
| 106 | echo " {\n";
|
---|
| 107 | echo " if (xmlhttp.readyState==4 && xmlhttp.status==200 && posiz!=null)\n";
|
---|
| 108 | echo " {\n";
|
---|
| 109 | echo " document.getElementById(posiz).innerHTML=xmlhttp.responseText;\n";
|
---|
| 110 | echo " }\n";
|
---|
| 111 | echo " }\n";
|
---|
| 112 | echo "xmlhttp.open(\"GET\",str,true);\n";
|
---|
| 113 | echo "xmlhttp.send();\n";
|
---|
[87] | 114 |
|
---|
[192] | 115 | echo "}\n";
|
---|
| 116 | echo "</script>\n";
|
---|
| 117 |
|
---|
[77] | 118 | #########################
|
---|
[86] | 119 | if (isset($help)) include("language/$language/ele_associazioni.html");
|
---|
| 120 | OpenTable();
|
---|
[77] | 121 | echo "<tr><td><hr><br>";
|
---|
[257] | 122 | $sql="SELECT descrizione FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'";
|
---|
| 123 | $res = $dbi->prepare("$sql");
|
---|
| 124 | $res->execute();
|
---|
| 125 | list ($descr_cons) = $res->fetch(PDO::FETCH_NUM);
|
---|
[2] | 126 | //inserire avviso su mancanza dei permessi
|
---|
| 127 | echo "<form name=\"model\" action=\"admin.php\">";
|
---|
[77] | 128 | echo "<table width=\"100%\" border=\"3\">";
|
---|
[2] | 129 | echo "<tr align=\"center\"><td bgcolor=\"$bgcolor1\"><b>"._CONSULTA."</b></td>";
|
---|
| 130 | echo "<td bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
|
---|
[185] | 131 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
|
---|
[189] | 132 | echo "<td bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
|
---|
| 133 | if($tipo_cons==3){
|
---|
| 134 | echo "<td bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
|
---|
| 135 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>";
|
---|
| 136 | }
|
---|
| 137 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>";
|
---|
[235] | 138 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._ASOLO_GRUPPO."</b></td>";
|
---|
[254] | 139 | echo "<td bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DISGIUNTO."</b></td>";
|
---|
[189] | 140 | echo "</tr>";
|
---|
[77] | 141 | echo "<tr align=\"center\"><td>";
|
---|
[189] | 142 | echo "<input type=\"hidden\" name=\"op\" value=\"associazioni\">";
|
---|
[77] | 143 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">$descr_cons</td>";
|
---|
[257] | 144 | $sql = "SELECT id_comune, descrizione from ".$prefix."_ele_comuni order by descrizione asc";
|
---|
| 145 | $rescomu = $dbi->prepare("$sql");
|
---|
| 146 | $rescomu->execute();
|
---|
[86] | 147 | echo "<td>";
|
---|
| 148 | if($idcomune) {
|
---|
[257] | 149 | while ($listele=$rescomu->fetch(PDO::FETCH_BOTH))
|
---|
[86] | 150 | if($listele['id_comune']==$idcomune) {
|
---|
| 151 | echo $listele['descrizione'];
|
---|
| 152 | echo "<input type=\"hidden\" name=\"idcomunenew\" value=\"$idcomune\">";
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | }else{
|
---|
[77] | 156 | echo "<select name=\"idcomunenew\">";
|
---|
[2] | 157 | echo "<option value=\"0\"> ";
|
---|
[257] | 158 | while(list($id,$descr_comu)=$rescomu->fetch(PDO::FETCH_NUM)){
|
---|
[2] | 159 | $sel= ($id == $idcomune) ? "selected":"";
|
---|
| 160 | echo "<option value=\"$id\" $sel>$descr_comu";
|
---|
| 161 | }
|
---|
[86] | 162 | echo "</select>";
|
---|
| 163 | }
|
---|
[77] | 164 | echo "</td>";
|
---|
[185] | 165 | echo "<td><input type=\"text\" name=\"preferenze\" value=\"$preferenze\" size=\"2\"></td>";
|
---|
[2] | 166 | $selez['0']='';
|
---|
| 167 | $selez['1']='';
|
---|
[86] | 168 | $selez['2']='';
|
---|
[77] | 169 | $selez['3']='';
|
---|
[2] | 170 | $selez[$chiusa]="selected";
|
---|
[87] | 171 | echo "<td><select name=\"chiusa\" id=\"chiusa\" onChange=\"javascript:del_cons()\">";
|
---|
[2] | 172 | echo "<option value=\"0\" ".$selez[0].">"._ATTIVA;
|
---|
| 173 | echo "<option value=\"1\" ".$selez[1].">"._CHIUSA;
|
---|
| 174 | echo "<option value=\"2\" ".$selez[2].">"._NULLA;
|
---|
[86] | 175 |
|
---|
[77] | 176 | if($idcomune) echo "<option value=\"3\" ".$selez[3].">"._ELIMINA;
|
---|
[2] | 177 | echo "</select></td>";
|
---|
| 178 | if($tipo_cons==3){
|
---|
[189] | 179 | if($idcomune) {
|
---|
[257] | 180 | $sql="SELECT id_fascia from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomune'";
|
---|
| 181 | $rescomu = $dbi->prepare("$sql");
|
---|
| 182 | $rescomu->execute();
|
---|
| 183 | if($rescomu->rowCount())
|
---|
| 184 | list($fasciacom)=$rescomu->fetch(PDO::FETCH_NUM);
|
---|
[189] | 185 | } else $fasciacom=0;
|
---|
[257] | 186 | $sql="SELECT id_conf, descrizione from ".$prefix."_ele_conf order by id_conf desc";
|
---|
| 187 | $rescomu = $dbi->prepare("$sql");
|
---|
| 188 | $rescomu->execute();
|
---|
[189] | 189 | echo "<td><select name=\"id_conf\" id=\"id_conf\" onchange=\"javascript:showdate('modules/Elezioni/ele_desc_fasce.php?fascia=$fasciacom&id_conf=' + model.id_conf.options[model.id_conf.selectedIndex].value,'fasceconf');\">";
|
---|
[2] | 190 | echo "<option value=\"0\"> ";
|
---|
[257] | 191 | while(list($id,$descr_conf)=$rescomu->fetch(PDO::FETCH_NUM)){
|
---|
[2] | 192 | $sel='';
|
---|
[208] | 193 | if ($idcomune and $id == $id_conf) $sel="selected";
|
---|
[2] | 194 | echo "<option value=\"$id\" $sel>$descr_conf";
|
---|
| 195 | }
|
---|
| 196 | echo "</select></td>";
|
---|
[189] | 197 | if(!$id_conf) $id_conf=1;
|
---|
[257] | 198 | $sql="SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'";
|
---|
| 199 | $rescomu = $dbi->prepare("$sql");
|
---|
| 200 | $rescomu->execute();
|
---|
[189] | 201 |
|
---|
| 202 | echo "<td id=\"fasceconf\"><select name=\"idfascia\">";
|
---|
| 203 | echo "<option value=\"0\"> ";
|
---|
| 204 | $inffascia=0;
|
---|
[257] | 205 | while(list($id,$abitanti)=$rescomu->fetch(PDO::FETCH_NUM)){
|
---|
[189] | 206 | $sel='';
|
---|
| 207 | if ($idcomune and $id == $fasciacom) $sel="selected"; elseif ($id==1) $sel="selected";
|
---|
| 208 | echo "<option value=\"$id\" $sel>$inffascia - $abitanti";
|
---|
| 209 | $inffascia=$abitanti;
|
---|
| 210 | }
|
---|
| 211 | echo "</select></td>";
|
---|
| 212 |
|
---|
| 213 |
|
---|
[2] | 214 | }
|
---|
| 215 | unset($sel);
|
---|
[257] | 216 | $sql = "SELECT vismf,vismf,solo_gruppo,disgiunto from ".$prefix."_ele_cons_comune where id_cons='$id_cons_comu'";
|
---|
| 217 | $rescomu = $dbi->prepare("$sql");
|
---|
| 218 | $rescomu->execute();
|
---|
| 219 | list($vismf,$sg,$disgiunto)=$rescomu->fetch(PDO::FETCH_NUM);
|
---|
[189] | 220 | echo "<td><select name=\"vismf\">";
|
---|
| 221 | if ($vismf==0) $sel="selected"; else $sel="";
|
---|
| 222 | echo "<option value=\"0\" $sel>No";
|
---|
| 223 | if ($vismf==1) $sel="selected"; else $sel="";
|
---|
| 224 | echo "<option value=\"1\" $sel>Si";
|
---|
| 225 | echo "</select></td>";
|
---|
[235] | 226 | echo "<td><select name=\"sg\">";
|
---|
| 227 | if ($sg==0) $sel="selected"; else $sel="";
|
---|
| 228 | echo "<option value=\"0\" $sel>No";
|
---|
| 229 | if ($sg==1) $sel="selected"; else $sel="";
|
---|
| 230 | echo "<option value=\"1\" $sel>Si";
|
---|
| 231 | echo "</select></td>";
|
---|
[254] | 232 | echo "<td><select name=\"disgiunto\">";
|
---|
| 233 | if ($disgiunto==0) $sel="selected"; else $sel="";
|
---|
| 234 | echo "<option value=\"0\" $sel>No";
|
---|
| 235 | if ($disgiunto==1) $sel="selected"; else $sel="";
|
---|
| 236 | echo "<option value=\"1\" $sel>Si";
|
---|
| 237 | echo "</select></td>";
|
---|
| 238 |
|
---|
[77] | 239 | echo "<td><input type=\"hidden\" name=\"ok\" value=0>";
|
---|
[2] | 240 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
|
---|
| 241 | if ($idcomune) {
|
---|
[87] | 242 | echo "<input type=\"hidden\" id=\"do\" name=\"do\" value=\"update\">";
|
---|
[2] | 243 | echo "<input type=\"hidden\" name=\"idcomune\" value=\"$idcomune\">";
|
---|
[87] | 244 | echo "<input type=\"submit\" id=\"add\" name=\"add\" value=\""._MODIFY."\" ></td></tr>";
|
---|
[185] | 245 | echo "<tr><td colspan=\"5\"><fieldset><legend>"._SPUNTALABEL1."</legend><label id=\"prov1\">"._SPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd3\" name=\"pwd3\" value=\"\" onclick=\"javascript:del_cons()\"></label></fieldset></td></tr>";
|
---|
[87] | 246 | echo "<tr id=\"trspunta\" style=\"visibility:hidden\"><td colspan=\"4\"><fieldset><legend>"._SPUNTALABEL2."</legend><label id=\"prov\">"._VIASPUNTAELIMINA." <input type=\"checkbox\" id=\"pwd4\" name=\"pwd4\" value=\"1\" onclick=\"javascript:del_cons()\"></label></fieldset>";
|
---|
[2] | 247 | }else{
|
---|
| 248 | echo "<input type=\"hidden\" name=\"do\" value=\"add\">";
|
---|
[77] | 249 | echo "<input type=\"submit\" name=\"add\" value=\""._ADD."\">";
|
---|
[2] | 250 | }
|
---|
[86] | 251 | $i=0;
|
---|
[77] | 252 | echo "</td></tr></table></form>";
|
---|
| 253 | echo "<hr><br><table width=\"100%\" border=\"3\">";
|
---|
[254] | 254 | echo "<tr align=\"center\"><td width=\"15%\" bgcolor=\"$bgcolor1\"><b>"._CONSULTA."TEST:$id_cons_comu</b></td>";
|
---|
[189] | 255 | echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._DEFCOMUNE."</b></td>";
|
---|
[185] | 256 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._PREFERENZE."</b></td>";
|
---|
| 257 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\"><b>"._STATO."</b></td>";
|
---|
[189] | 258 | if($tipo_cons==3){
|
---|
| 259 | echo "<td width=\"20%\" bgcolor=\"$bgcolor1\"><b>"._CONF."</b></td>";
|
---|
| 260 | echo "<td width=\"20%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._FASCIA."</b></td>";
|
---|
| 261 | }
|
---|
| 262 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._VISAFFMF."</b></td>";
|
---|
[254] | 263 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._ASOLO_GRUPPO."</b></td>";
|
---|
| 264 | echo "<td width=\"10%\" bgcolor=\"$bgcolor1\" align=\"center\"><b>"._DISGIUNTO."</b></td>";
|
---|
[256] | 265 | echo "<td width=\"10\" bgcolor=\"$bgcolor1\"><b> "._FUNZIONI."</b></td></tr>";
|
---|
[86] | 266 |
|
---|
[257] | 267 | $sql="SELECT '',t1.id_comune,'',t1.id_cons, t2.descrizione, t1.chiusa, t1.id_conf, preferenze,t1.id_fascia,t1.vismf,t1.solo_gruppo,t1.disgiunto FROM ".$prefix."_ele_cons_comune as t1, ".$prefix."_ele_comuni as t2 where t1.id_cons_gen='$id_cons_gen' and t1.id_comune=t2.id_comune order by t2.descrizione";
|
---|
| 268 | $resmod = $dbi->prepare("$sql");
|
---|
| 269 | $resmod->execute();
|
---|
| 270 | while (list($id_collegio,$id_comune2,$descr_coll,$id_cons_comu,$descr_comu, $chiusa,$id_conf,$preferenze2,$fasciacom,$vismf2,$sg2,$disgiunto2) = $resmod->fetch(PDO::FETCH_NUM)){ //elenco dei modelli inseriti
|
---|
| 271 | $sql="SELECT descrizione FROM ".$prefix."_ele_conf where id_conf='$id_conf'";
|
---|
| 272 | $resconf = $dbi->prepare("$sql");
|
---|
| 273 | $resconf->execute();
|
---|
| 274 | list($descr_conf) = $resconf->fetch(PDO::FETCH_NUM);
|
---|
[2] | 275 | $i++;
|
---|
[86] | 276 | $bgcolor1=($bgcolor1==$_SESSION['bgcolor1'])?$_SESSION['bgcolor2']:$_SESSION['bgcolor1'];
|
---|
[256] | 277 | echo "<tr align=\"center\" bgcolor=\"$bgcolor1\">";
|
---|
| 278 | echo "<td><b>$descr_cons</b></td>";
|
---|
| 279 | echo "<td><b>$descr_comu</b></td>";
|
---|
| 280 | echo "<td><b>$preferenze2</b></td>";
|
---|
[2] | 281 | $stato['0']=_ATTIVA;
|
---|
| 282 | $stato['1']=_CHIUSA;
|
---|
| 283 | $stato['2']=_NULLA;
|
---|
[256] | 284 | echo "<td><b>".$stato[$chiusa]."</b></td>";
|
---|
[189] | 285 | if($tipo_cons==3){
|
---|
[256] | 286 | echo "<td><b>".$descr_conf."</b></td>";
|
---|
[257] | 287 | $sql="SELECT id_fascia,abitanti from ".$prefix."_ele_fasce where id_conf='$id_conf'";
|
---|
| 288 | $rescomu = $dbi->prepare("$sql");
|
---|
| 289 | $rescomu->execute();
|
---|
[189] | 290 | $inffascia=0;
|
---|
[257] | 291 | if ($rescomu->rowCount()==0) echo "<td></td>";
|
---|
| 292 | while(list($id,$abitanti)=$rescomu->fetch(PDO::FETCH_NUM)){
|
---|
[189] | 293 | $sel='';
|
---|
| 294 | if ($id == $fasciacom)
|
---|
[256] | 295 | echo "<td>$inffascia - $abitanti</td>";
|
---|
[189] | 296 | $inffascia=$abitanti;
|
---|
| 297 | }
|
---|
| 298 |
|
---|
| 299 | }
|
---|
[254] | 300 | if ($vismf2==0) $sel=_NO; else $sel=_SI;
|
---|
[256] | 301 | echo "<td>$sel</td>";
|
---|
[254] | 302 | if ($sg2==0) $sel=_NO; else $sel=_SI;
|
---|
[256] | 303 | echo "<td>$sel</td>";
|
---|
[254] | 304 | if ($disgiunto2==0) $sel=_NO; else $sel=_SI;
|
---|
[256] | 305 | echo "<td>$sel</td>";
|
---|
| 306 | echo "<td>";
|
---|
| 307 | echo "<form name=\"modello$i\" action=\"admin.php\">"
|
---|
| 308 | ."<input type=\"hidden\" name=\"op\" value=\"associazioni\">";
|
---|
| 309 | echo "<input type=\"hidden\" name=\"id_conf\" value=\"$id_conf\">";
|
---|
| 310 | echo "<input type=\"hidden\" name=\"idcomune\" value=\"$id_comune2\">";
|
---|
| 311 | echo "<input type=\"hidden\" name=\"id_cons_comu\" value=\"$id_cons_comu\">";
|
---|
| 312 | echo "<input type=\"hidden\" name=\"id_cons_gen\" value=\"$id_cons_gen\">";
|
---|
| 313 | echo "<input type=\"hidden\" name=\"desc\" value=\"$descr_cons\">";
|
---|
| 314 | echo "<input type=\"hidden\" name=\"preferenze\" value=\"$preferenze2\">";
|
---|
| 315 | echo "<input type=\"hidden\" name=\"chiusa\" value=\"$chiusa\">";
|
---|
| 316 | echo "<input type=\"hidden\" name=\"ok\" value=0><input type=\"submit\" name=\"edit$i\" value=\""._EDIT."\">"
|
---|
| 317 | ."</form></td></tr>\n";
|
---|
[2] | 318 | }
|
---|
[256] | 319 | echo "</table></td></tr></table>";
|
---|
[86] | 320 | CloseTable();
|
---|
[2] | 321 | }
|
---|
| 322 |
|
---|
[185] | 323 | function associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$id_comune,$chiusa,$id_conf,$preferenze) {
|
---|
[254] | 324 | global $admin, $bgcolor1, $bgcolor2, $prefix, $dbi, $descr_cons,$genere,$id_cons_gen,$idcomunenew,$pwd4,$idfascia,$vismf,$sg,$disgiunto;
|
---|
[86] | 325 | $delcons=0;
|
---|
[2] | 326 | if ($do !="" and $id_cons_gen>0 and $idcomunenew>0) {
|
---|
[257] | 327 | $sql="SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'";
|
---|
| 328 | $rescomu = $dbi->prepare("$sql");
|
---|
| 329 | $rescomu->execute();
|
---|
| 330 | $max = $rescomu->rowCount(); //esiste autorizzazione?
|
---|
| 331 | list($delcons)=$rescomu->fetch(PDO::FETCH_NUM);
|
---|
| 332 | if (!$max){ //se no la inserisce
|
---|
| 333 | $sql="insert into ".$prefix."_ele_cons_comune (chiusa,id_comune,id_cons_gen,id_conf,preferenze,id_fascia,vismf,solo_gruppo,disgiunto) values ('0','$idcomunenew','$id_cons_gen','$id_conf','$preferenze','$idfascia','$vismf','$sg','$disgiunto')";
|
---|
| 334 | $result = $dbi->prepare("$sql");
|
---|
| 335 | $result->execute();
|
---|
| 336 | $sql="SELECT id_cons from ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$idcomunenew'";
|
---|
| 337 | $rescomu = $dbi->prepare("$sql");
|
---|
| 338 | $rescomu->execute();
|
---|
| 339 | list($id_cons_comu)=$rescomu->fetch(PDO::FETCH_NUM);
|
---|
| 340 | $sql="SELECT id_cons FROM ".$prefix."_ele_comuni where id_comune='$idcomunenew' ";
|
---|
| 341 | $res = $dbi->prepare("$sql");
|
---|
| 342 | $res->execute();
|
---|
| 343 | list($id_cons_pred)=$res->fetch(PDO::FETCH_NUM);
|
---|
| 344 | if (!$id_cons_pred) {
|
---|
| 345 | $sql="update ".$prefix."_ele_comuni set id_cons='$id_cons_comu' where id_comune='$idcomunenew' ";
|
---|
| 346 | $res = $dbi->prepare("$sql");
|
---|
| 347 | $res->execute();
|
---|
| 348 | }
|
---|
[2] | 349 | }
|
---|
| 350 | if ($do == "update") {
|
---|
| 351 | if ($idcomunenew>0) $newid=", id_comune = $idcomunenew ";
|
---|
| 352 | else $newid='';
|
---|
| 353 | $result = mysql_query("update ".$prefix."_ele_comu_collegi set id_collegio= '$id_collegio' $newid where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'", $dbi) || die(mysql_error());
|
---|
[257] | 354 | $result = $dbi->prepare("$sql");
|
---|
| 355 | $result->execute();
|
---|
| 356 | if (!$result->rowCount()) return;
|
---|
| 357 | $sql="update ".$prefix."_ele_cons_comune set id_conf='$id_conf', chiusa= '$chiusa', preferenze='$preferenze',id_fascia='$idfascia',vismf='$vismf',solo_gruppo='$sg',disgiunto='$disgiunto' where id_comune='$id_comune' and id_cons_gen='$id_cons_gen'";
|
---|
| 358 | $result = $dbi->prepare("$sql");
|
---|
| 359 | $result->execute();
|
---|
[2] | 360 | Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen");
|
---|
| 361 | }elseif ($do == "add") {
|
---|
[95] | 362 | if ($id_collegio){
|
---|
[257] | 363 | $sql="insert into ".$prefix."_ele_comu_collegi (id_collegio,id_cons,id_comune,id_cons_gen) values ('$id_collegio','$id_cons_comu','$idcomunenew','$id_cons_gen')";
|
---|
| 364 | $result = $dbi->prepare("$sql");
|
---|
| 365 | $result->execute();
|
---|
[95] | 366 | }
|
---|
[2] | 367 | Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen");
|
---|
[86] | 368 | }elseif ($do == "delete" and $delcons>0) {
|
---|
[77] | 369 | $idcns=$delcons;
|
---|
[257] | 370 | $sql="delete from ".$prefix."_ele_voti_ref where id_cons=$idcns";
|
---|
| 371 | $result = $dbi->prepare("$sql");
|
---|
| 372 | $result->execute();
|
---|
| 373 | $sql="delete from ".$prefix."_ele_voti_candidati where id_cons=$idcns";
|
---|
| 374 | $result = $dbi->prepare("$sql");
|
---|
| 375 | $result->execute();
|
---|
| 376 | $sql="delete from ".$prefix."_ele_voti_lista where id_cons=$idcns";
|
---|
| 377 | $result = $dbi->prepare("$sql");
|
---|
| 378 | $result->execute();
|
---|
| 379 | $sql="delete from ".$prefix."_ele_voti_gruppo where id_cons=$idcns";
|
---|
| 380 | $result = $dbi->prepare("$sql");
|
---|
| 381 | $result->execute();
|
---|
| 382 | $sql="delete from ".$prefix."_ele_voti_parziale where id_cons=$idcns";
|
---|
| 383 | $result = $dbi->prepare("$sql");
|
---|
| 384 | $result->execute();
|
---|
| 385 | $sql="delete from ".$prefix."_ele_controllosez where id_cons=$idcns";
|
---|
| 386 | $result = $dbi->prepare("$sql");
|
---|
| 387 | $result->execute();
|
---|
[86] | 388 | if ($pwd4==1){
|
---|
[257] | 389 | $sql="delete from ".$prefix."_ele_candidati where id_cons=$idcns";
|
---|
| 390 | $result = $dbi->prepare("$sql");
|
---|
| 391 | $result->execute();
|
---|
| 392 | $sql="delete from ".$prefix."_ele_lista where id_cons=$idcns";
|
---|
| 393 | $result = $dbi->prepare("$sql");
|
---|
| 394 | $result->execute();
|
---|
| 395 | $sql="delete from ".$prefix."_ele_gruppo where id_cons=$idcns";
|
---|
| 396 | $result = $dbi->prepare("$sql");
|
---|
| 397 | $result->execute();
|
---|
| 398 | $sql="delete from ".$prefix."_ele_sezioni where id_cons=$idcns";
|
---|
| 399 | $result = $dbi->prepare("$sql");
|
---|
| 400 | $result->execute();
|
---|
| 401 | $sql="delete from ".$prefix."_ele_cons_comune where id_cons=$idcns";
|
---|
| 402 | $result = $dbi->prepare("$sql");
|
---|
| 403 | $result->execute();
|
---|
| 404 | $sql="SELECT id_cons FROM ".$prefix."_ele_comuni where id_comune='$id_comune' ";
|
---|
| 405 | $res = $dbi->prepare("$sql");
|
---|
| 406 | $res->execute();
|
---|
| 407 | list($id_cons_pred)=$res->fetch(PDO::FETCH_NUM);
|
---|
[95] | 408 | if ($idcns==$id_cons_pred) {
|
---|
[257] | 409 | $sql="select id_cons from ".$prefix."_ele_cons_comune where id_comune=$id_comune order by id_cons desc limit 0,1";
|
---|
| 410 | $res = $dbi->prepare("$sql");
|
---|
| 411 | $res->execute();
|
---|
| 412 | list($id_cons_pred)=$res->fetch(PDO::FETCH_NUM);
|
---|
| 413 | $sql="update ".$prefix."_ele_comuni set id_cons='$id_cons_pred' where id_comune='$id_comune' ";
|
---|
| 414 | $res = $dbi->prepare("$sql");
|
---|
| 415 | $res->execute();
|
---|
[95] | 416 | }
|
---|
[86] | 417 | }else{
|
---|
[257] | 418 | $sql="update ".$prefix."_ele_sezioni set validi='0', nulli='0', bianchi='0', contestati='0', solo_gruppo='0', autorizzati_m='0', autorizzati_f='0', voti_nulli='0', validi_lista='0', contestati_lista='0', voti_nulli_lista='0' where id_cons=$idcns";
|
---|
| 419 | $result = $dbi->prepare("$sql");
|
---|
| 420 | $result->execute();
|
---|
[86] | 421 | }
|
---|
[77] | 422 | Header("Location: admin.php?op=associazioni&id_cons_gen=$id_cons_gen");
|
---|
[2] | 423 | }
|
---|
| 424 | }
|
---|
| 425 | }
|
---|
| 426 |
|
---|
[86] | 427 |
|
---|
| 428 |
|
---|
| 429 |
|
---|
[2] | 430 |
|
---|
| 431 | //****************************
|
---|
| 432 | // switch
|
---|
| 433 | //****************************
|
---|
| 434 | if ($op=="associazioni"){
|
---|
[185] | 435 | associazioni($ok, $do,$descr_comu,$id_cons_comu,$id_collegio,$idcomune,$chiusa,$id_conf,$preferenze);
|
---|
[2] | 436 | }
|
---|
| 437 | ele();
|
---|
| 438 | if (isset($_GET['id_cons_gen'])) $id_cons_gen=intval($_GET['id_cons_gen']); else $id_cons_gen='0';
|
---|
| 439 | all();
|
---|
| 440 | include("footer.php");
|
---|
| 441 |
|
---|
| 442 | ?>
|
---|
| 443 |
|
---|
[87] | 444 |
|
---|