Changeset 36 for trunk/admin
- Timestamp:
- Mar 19, 2010, 11:37:49 PM (15 years ago)
- Location:
- trunk/admin/modules/Elezioni
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/modules/Elezioni/ele_affluenze.php
r2 r36 67 67 echo "<select name= \"mv\" ><option value=\"00\" selected>00</option>"; minuti(); 68 68 echo "</td><td>"; 69 $aff = mysql_query("SELECT data_inizio FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi);70 list($data ) = mysql_fetch_row($aff);69 $aff = mysql_query("SELECT data_inizio,data_fine FROM ".$prefix."_ele_consultazione where id_cons_gen='$id_cons_gen'", $dbi); 70 list($data,$fine) = mysql_fetch_row($aff); 71 71 list ($anno,$mese,$giorno)=explode('-',$data); 72 echo "<select name= \"gv\" ><option value=\"$giorno\" selected>$giorno</option>"; giorno(); 72 list ($annof,$mesef,$giornof)=explode('-',$fine); 73 echo "<select name= \"gv\" ><option value=\"$giorno\" selected>$giorno</option>"; giorno($giorno,$giornof); 73 74 echo "<select name= \"msv\" ><option value=\"$mese\" selected>$mese</option>"; mese(); 74 75 echo "<select name= \"av\" ><option value=\"$anno\" selected>$anno</option>"; anno() ; -
trunk/admin/modules/Elezioni/funzionidata.php
r2 r36 5 5 6 6 7 function giorno( )7 function giorno($min,$max) 8 8 { 9 9 $giorno=''; 10 $giorni= array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'); 10 if(!$min) $min='01'; 11 if(!$max) $max='31'; 12 $giorni=array(); 13 for($x=$min;$x<=$max;$x++) $giorni[]=$x; 14 #$giorni= array('01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31'); 11 15 foreach($giorni as $gi) 12 16 $giorno .= "<option value=$gi>$gi</option>"; … … 38 42 } 39 43 40 function ore( )44 function ore($min,$max) 41 45 { 42 46 $ora=''; -
trunk/admin/modules/Elezioni/importa.php
r35 r36 42 42 list ($newidg) = mysql_fetch_row($resnew); 43 43 unset($valori); 44 inslista($oldidg,$newidg); 45 } 46 } 47 } 48 49 function inslista($oldidg,$newidg) 44 if($oldidg) 45 $_SESSION['gruppi']['idg_'.$oldidg]=$newidg; 46 # inslista($oldidg,$newidg); 47 } 48 } 49 } 50 51 function inslista()#$oldidg,$newidg 50 52 { 51 53 global $prefix, $dbi; … … 53 55 54 56 foreach ($ar_lista as $rigalista){ 57 if(!isset($rigalista[3])) continue; 55 58 $oldidl=0; 56 $okl=0; 59 $okl=0; 60 $oldidg=$rigalista[3]; 61 $newidg=$_SESSION['gruppi']['idg_'.$oldidg]; 57 62 foreach($rigalista as $key=>$campo){ 58 63 if ($key==0) $valori="'$idcns',"; … … 69 74 list ($newidl) = mysql_fetch_row($reslnew); 70 75 unset($valori); 71 inscandi($oldidl,$newidl); 72 } 73 } 74 } 75 76 function inscandi($oldidl,$newidl) 76 if($oldidl) 77 $_SESSION['liste']['idl_'.$oldidl]=$newidl; 78 79 # inscandi($oldidl,$newidl); 80 } 81 } 82 } 83 84 function inscandi()#$oldidl,$newidl 77 85 { 78 86 global $prefix, $dbi; … … 80 88 81 89 foreach ($ar_candi as $rigacandi){ 90 if(!isset($rigacandi[2])) continue; 82 91 $okc=0; 83 foreach($rigacandi as $key=>$campo){ 92 $oldidl=$rigacandi[2]; 93 $newidl=$_SESSION['liste']['idl_'.$oldidl]; 94 foreach($rigacandi as $key=>$campo){#echo "$key -- $campo<br>"; 84 95 if (count($rigacandi)!=8) {unset($valori);continue;} 85 96 if ($key==0) $valori= "null,"; … … 93 104 } 94 105 } 95 106 #foreach($_SESSION['liste'] as $key=>$val) echo "$key -- $val<br>"; 96 107 } 97 108 … … 112 123 echo "<td align=\"center\"><input type=\"submit\" name=\"add\" value=\""._OK."\"></td></tr></table></form>"; 113 124 //////////////////////////// 114 }else{$datafile=$_FILES['datafile']['tmp_name']; 125 }else{ 126 $idcns=$id_cons; 127 $res_del = mysql_query("delete from ".$prefix."_ele_voti_ref where id_cons=$idcns" ,$dbi); 128 $res_del = mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons=$idcns" ,$dbi); 129 $res_del = mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons=$idcns" ,$dbi); 130 $res_del = mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons=$idcns" ,$dbi); 131 $res_del = mysql_query("update ".$prefix."_ele_sezioni set validi='0', contestati='0', validi_lista='0', nulli='0',bianchi='0',contestati_lista='0', voti_nulli_lista='0' where id_cons=$idcns" ,$dbi); 132 $res_del = mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons=$idcns" ,$dbi); 133 $res_del = mysql_query("delete from ".$prefix."_ele_candidati where id_cons=$idcns" ,$dbi); 134 $res_del = mysql_query("delete from ".$prefix."_ele_lista where id_cons=$idcns" ,$dbi); 135 $res_del = mysql_query("delete from ".$prefix."_ele_gruppo where id_cons=$idcns" ,$dbi); 136 $datafile=$_FILES['datafile']['tmp_name']; 115 137 $arrFile = file($datafile); 116 138 $handle = fopen($datafile, "r"); 117 139 $test=array(); 118 140 $errore=0; 119 141 $fine=0; 120 142 // Set counters 121 143 $currentLine = 0; 122 144 $cntFile = count($arrFile); 123 $tabs=array($prefix."_ele_gruppo",$prefix."_ele_lista",$prefix."_ele_candidati" );145 $tabs=array($prefix."_ele_gruppo",$prefix."_ele_lista",$prefix."_ele_candidati",$prefix."_ele_circoscrizione"); 124 146 $x=0;$k=0; 125 147 $scarto=0; 148 $primog=0; 149 $primol=0; 126 150 $conta=array(); 127 151 $currentLine = 0; … … 136 160 if($k==0) {while (substr($arrFile[$currentLine],1,-2)!=$conf and $currentLine <= $cntFile) $currentLine++; $k++;} 137 161 $currentLine++; 138 while($currentLine <= $cntFile ){162 while($currentLine <= $cntFile and $fine==0){ 139 163 # $appo=substr($arrFile[$currentLine],1,-2); 140 164 if(isset($arrFile[$currentLine])) … … 143 167 if (isset($tabs[($x+1)]) and $appo==$tabs[($x+1)]){ $x++;$conf=$tabs[$x];$currentLine++; continue;} 144 168 $test=explode(':',$appo); if(!is_array($test)) {die("errore di import<br>");} 145 foreach($test as $key=>$val) #echo "$key : $campo ($conf==$prefix._ele_gruppo)"; die();169 foreach($test as $key=>$val) 146 170 if ($conf==$prefix."_ele_gruppo") 147 171 $ar_gruppo[$z][$key]=addslashes(base64_decode($val)); 148 172 elseif ($conf==$prefix."_ele_lista"){ 173 if($primog==0){ 174 $gruppofil= array_filter($ar_gruppo); 175 $numgruppo=count($gruppofil); 176 insgruppo(); 177 $primog=1; 178 unset($ar_gruppo); 179 } 149 180 $ar_lista[$z][$key]=addslashes(base64_decode($val));} 150 elseif ($conf==$prefix."_ele_candidati") 181 elseif ($conf==$prefix."_ele_candidati"){ 182 if($primol==0){ 183 $listafil= array_filter($ar_lista); 184 $numlista=count($listafil); 185 inslista(); 186 $primol=1; 187 unset($ar_lista); 188 } 151 189 $ar_candi[$z][$key]=addslashes(base64_decode($val)); 152 elseif ($appo==$prefix."_ele_circoscrizione") 153 {$fine=0;break;} 154 $currentLine++; 190 } 191 elseif ($conf==$prefix."_ele_circoscrizione"){ 192 inscandi(); 193 unset($ar_candi); 194 $fine=1; 195 break; 196 } 197 $currentLine++; 155 198 $z++; 156 199 } 157 200 fclose($handle); 158 $idcns=$id_cons; #$ar_gruppo[0][0]; 159 $res_del = mysql_query("delete from ".$prefix."_ele_voti_ref where id_cons=$idcns" ,$dbi); 160 $res_del = mysql_query("delete from ".$prefix."_ele_voti_candidati where id_cons=$idcns" ,$dbi); 161 $res_del = mysql_query("delete from ".$prefix."_ele_voti_lista where id_cons=$idcns" ,$dbi); 162 $res_del = mysql_query("delete from ".$prefix."_ele_voti_gruppo where id_cons=$idcns" ,$dbi); 163 $res_del = mysql_query("update ".$prefix."_ele_sezioni set validi='0', contestati='0', validi_lista='0', nulli='0',bianchi='0',contestati_lista='0', voti_nulli_lista='0' where id_cons=$idcns" ,$dbi); 164 $res_del = mysql_query("delete from ".$prefix."_ele_voti_parziale where id_cons=$idcns" ,$dbi); 165 $res_del = mysql_query("delete from ".$prefix."_ele_candidati where id_cons=$idcns" ,$dbi); 166 $res_del = mysql_query("delete from ".$prefix."_ele_lista where id_cons=$idcns" ,$dbi); 167 $res_del = mysql_query("delete from ".$prefix."_ele_gruppo where id_cons=$idcns" ,$dbi); 168 $gruppofil= array_filter($ar_gruppo); 169 $numgruppo=count($gruppofil); 170 $listafil= array_filter($ar_lista); 171 $numlista=count($listafil); 201 202 203 172 204 if ($numgruppo){ 173 insgruppo();205 # insgruppo(); 174 206 Header("Location: admin.php?op=gruppo&id_cons_gen=$id_cons_gen"); 175 207 }
Note:
See TracChangeset
for help on using the changeset viewer.