Index: /trunk/aggiornamento-2.0_2011-04-16.sql
===================================================================
--- /trunk/aggiornamento-2.0_2011-04-16.sql	(revision 85)
+++ /trunk/aggiornamento-2.0_2011-04-16.sql	(revision 85)
@@ -0,0 +1,73 @@
+--
+-- MySQL dump 10.10
+--
+-- Host: localhost    Database: eleonline2
+-- ------------------------------------------------------
+-- Server version	5.0.19-standard
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+
+-- MySQL dump 10.11
+--
+-- Host: localhost    Database: elefonte
+-- ------------------------------------------------------
+-- Server version	5.0.51a-3ubuntu5.4
+
+/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
+/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
+/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
+/*!40101 SET NAMES utf8 */;
+/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
+/*!40103 SET TIME_ZONE='+00:00' */;
+/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
+/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
+/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
+/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
+
+--
+-- Table structure for table `soraldo_ele_fasce`
+--
+
+DROP TABLE IF EXISTS `soraldo_ele_fasce`;
+SET @saved_cs_client     = @@character_set_client;
+SET character_set_client = utf8;
+CREATE TABLE `soraldo_ele_fasce` (
+  `id_fascia` int(2) NOT NULL,
+  `abitanti` int(11) NOT NULL,
+  `data_inizio` date NOT NULL,
+  `data_fine` date NOT NULL,
+  `seggi` int(4) NOT NULL,
+  KEY `id_fascia` (`id_fascia`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
+
+--
+-- Dumping data for table `soraldo_ele_fasce`
+--
+
+LOCK TABLES `soraldo_ele_fasce` WRITE;
+/*!40000 ALTER TABLE `soraldo_ele_fasce` DISABLE KEYS */;
+INSERT INTO `soraldo_ele_fasce` VALUES (1,3000,'2000-01-01','2010-12-31',12),(2,10000,'2000-01-01','2010-12-31',16),(3,15000,'2000-01-01','2010-12-31',20),(4,30000,'2000-01-01','2010-12-31',20),(5,100000,'2000-01-01','2010-12-31',30),(6,250000,'2000-01-01','2010-12-31',40),(7,500000,'2000-01-01','2010-12-31',46),(8,1000000,'2000-01-01','2010-12-31',50),(9,100000000,'2000-01-01','2010-12-31',60),(4,30000,'2011-01-01','0000-00-00',16),(1,3000,'2011-01-01','0000-00-00',9),(2,10000,'2011-01-01','0000-00-00',12),(3,15000,'2011-01-01','0000-00-00',16),(5,100000,'2011-01-01','0000-00-00',24),(6,250000,'2011-01-01','0000-00-00',32),(7,500000,'2011-01-01','0000-00-00',36),(8,1000000,'2011-01-01','0000-00-00',40),(9,100000000,'2011-01-01','0000-00-00',48);
+/*!40000 ALTER TABLE `soraldo_ele_fasce` ENABLE KEYS */;
+UNLOCK TABLES;
+/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
+
+/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
+/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
+/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
+/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
+/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
+/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
+/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+
+-- Dump completed on 2011-04-16  9:33:30
Index: /trunk/client/modules/Elezioni/consiglieri.php
===================================================================
--- /trunk/client/modules/Elezioni/consiglieri.php	(revision 84)
+++ /trunk/client/modules/Elezioni/consiglieri.php	(revision 85)
@@ -26,11 +26,9 @@
 $res = mysql_query("SELECT id_conf FROM ".$prefix."_ele_cons_comune where id_cons_gen='$id_cons_gen' and id_comune='$id_comune'" , $dbi);
 list($id_conf) = mysql_fetch_row($res);
-//test prima di modificare il db aggiungendo id_conf
-//echo "$id_conf=2";
-//
+
 
 $res = mysql_query("SELECT limite,consin,infpremio,supsbarramento,suppremio,listinfsbar,listinfconta,listsupconta,supminpremio,infminpremio from ".$prefix."_ele_conf where id_conf='$id_conf'",$dbi);
 list($limite,$consin,$infpremio,$supsbarramento,$suppremio,$listinfsbar,$listinfconta,$listsupconta,$supminpremio,$infminpremio) = mysql_fetch_row($res);
-
+$numcons=0;
 
 echo "<table><tr><td align=\"center\">"._PROIEZCONS."</td></tr></table>";
@@ -38,6 +36,5 @@
 
 function consiglio(){
-global $param,$id_cons_gen, $dbi, $prefix, $id_comune, $gruppo, $numgruppo, $listecol, $id_comune, $limite;
-//$limite=3; //fascia di separazione del maggioritario (15.000 abitanti)
+global $param,$id_cons_gen, $dbi, $prefix, $id_comune, $gruppo, $numgruppo, $listecol, $id_comune, $limite,$numcons;
 $collegate= array();
 $collperd= array();
@@ -49,21 +46,13 @@
 	$x++;
 }
-$res = mysql_query("SELECT t1.tipo_cons,t2.id_cons FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
+$res = mysql_query("SELECT t1.tipo_cons,t2.id_cons,t1.data_fine FROM ".$prefix."_ele_consultazione as t1, ".$prefix."_ele_cons_comune as t2 where t1.id_cons_gen=t2.id_cons_gen and t2.id_cons_gen='$id_cons_gen' and t2.id_comune='$id_comune'" , $dbi);
 if (mysql_num_rows($res)){
-	list($tipo_cons,$id_cons) = mysql_fetch_row($res);
+	list($tipo_cons,$id_cons,$datacons) = mysql_fetch_row($res);
 	$result = mysql_query("select fascia, capoluogo from ".$prefix."_ele_comuni where id_comune='$id_comune'", $dbi);
 	list($fascia,$capoluogo) = mysql_fetch_row($result);
-/*switch ($fascia) {
-        case 1: $numcons=12; break;
-        case 2: $numcons=16; break;
-        case 3: $numcons=20; break;
-        case 4: $numcons=20; break;
-        case 5: $numcons=30; break;
-        case 6: $numcons=40; break;
-        case 7: $numcons=46; break;
-        case 8: $numcons=50; break;
-        case 9: $numcons=60; break;
-} */
-		$result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia=$fascia",$dbi);
+
+		$result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and (data_inizio<'$datacons' and data_fine>'$datacons')",$dbi);
+		if (mysql_num_rows($result)==0)
+			$result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia='$fascia' and data_fine='0000-00-00'",$dbi);
 		list($numcons) = mysql_fetch_row($result);
 
@@ -163,5 +152,5 @@
 
 function consmin($fascia,$grp) {
-global $id_cons, $prefix,$dbi,$num_candlst,$quozienti,$PNE,$CSEC,$consin;
+global $id_cons, $prefix,$dbi,$num_candlst,$quozienti,$PNE,$CSEC,$consin,$numcons;
 global $infpremio,$fisso,$sincons,$votolista;
 if (!isset($fisso)) $fisso=0; #se fisso=1 il premio di maggioranza Ãš fisso
@@ -172,8 +161,6 @@
 $sorteggio=0;
 $num_candlst=array();
-#funzione di calcolo per comuni fino a 15.000 abitanti (piï¿œ esattamente fino al valore di $limite)
-#carica il numero di consiglieri
-		$result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia=$fascia",$dbi);
-		list($numcons) = mysql_fetch_row($result);
+#funzione di calcolo per comuni fino a 15.000 abitanti (piÃ¹ esattamente fino al valore di $limite)
+
 if ($sincons) $numcons--;
 #$numcons--;
@@ -191,6 +178,4 @@
 
 #se votolista==1, Ãš abilitato il voto di lista ed Ãš quello su cui si calcola l'assegnazione dei seggi 
-/* 
-$res_per = mysql_query("SELECT t1.descrizione,t1.num_gruppo,t2.id_lista,t2.num_lista,t2.descrizione,sum(t3.voti) as voti from ".$prefix."_ele_gruppo as t1,  ".$prefix."_ele_lista as t2, ".$prefix."_ele_voti_gruppo as t3 where t1.id_cons='$id_cons' and t1.id_gruppo=t2.id_gruppo and t1.id_gruppo=t3.id_gruppo group by t1.descrizione,t1.num_gruppo,t2.num_lista,t2.descrizione order by voti desc ",$dbi); */
 if ($fisso==1){
 	#seleziona il sindaco
@@ -412,5 +397,5 @@
 global $groups,$lists,$eletti,$ultimo,$quozienti,$num_candlst,$mex,$PNE,$CSEC,$consin;
 global $supsbarramento, $supminpremio, $suppremio;
-global $listsupconta;
+global $listsupconta,$numcons;
 #funzione di calcolo per comuni oltre 15.000 abitanti
 #carica il numero di consiglieri da eleggere$groups=array();
@@ -425,21 +410,5 @@
 $premio=0;
 /* "Ai fini della determinazione nel secondo turno, della cifra elettorale complessiva delle liste collegate deve tenersi conto anche del collegamento intervenuto in vista del ballottaggio" (Cons. St. Sez. V 4 maggio 2001 n. 2519; 20 settembre 2000 n. 4894; 19 marzo 1996 n. 290)   
-
-
-
-
-switch ($fascia) {
-	case 1: $numcons=12; break; 
-	case 2: $numcons=16; break; 
-	case 3: $numcons=20; break; 
-	case 4: $numcons=20; break; 
-	case 5: $numcons=30; break; 
-	case 6: $numcons=40; break; 
-	case 7: $numcons=46; break; 
-	case 8: $numcons=50; break; 
-	case 9: $numcons=60; break; 
-} */
-		$result = mysql_query("SELECT seggi from ".$prefix."_ele_fasce where id_fascia=$fascia",$dbi);
-		list($numcons) = mysql_fetch_row($result);
+ */
 
 #verificare come gestire la situazione in cui il candidato sindaco supera lo sbarramento e il totale delle liste no.
Index: /trunk/client/modules/Elezioni/gruppo.php
===================================================================
--- /trunk/client/modules/Elezioni/gruppo.php	(revision 84)
+++ /trunk/client/modules/Elezioni/gruppo.php	(revision 85)
@@ -432,4 +432,6 @@
 					$res=mysql_fetch_row($res_numsez);
 ##############inserimento percentuale di scrutinio nella sezione
+		$scruvalidi=0;
+		$scrunulli=0;
 		$grpercscru=0;
 		if($op=="gruppo_sezione")
@@ -437,5 +439,5 @@
 		elseif($op=="lista_sezione")
 			$resperc=mysql_query("select sum(validi_lista),sum(nulli+bianchi+contestati_lista+solo_gruppo+voti_nulli_lista) from ".$prefix."_ele_sezioni where id_sez='".$res[1]."'",$dbi);
-		if ($resperc)
+		if (isset($resperc) and $resperc)
 			list($scruvalidi,$scrunulli)=mysql_fetch_row($resperc);
 		$resperc = mysql_query("select sum(voti_complessivi) from ".$prefix."_ele_voti_parziale where id_sez='".$res[1]."' group by data,orario order by data desc, orario desc limit 0,1 ",$dbi);
Index: /trunk/client/temi/facebook/menu.php
===================================================================
--- /trunk/client/temi/facebook/menu.php	(revision 84)
+++ /trunk/client/temi/facebook/menu.php	(revision 85)
@@ -42,5 +42,5 @@
 		    
 		<ul id="nav"><li>
-		 <a href="http://www.eleonline.it"><span style="font-size:18px;font: Comics;"><strong>elebook</strong></span></a>
+		 <a href="http://www.eleonline.it"><span style="font-size:18px;font-family: Comics;"><strong>elebook</strong></span></a>
 		</li>
 		<li>
Index: /trunk/client/temi/facebook/menu/menu-dd.css
===================================================================
--- /trunk/client/temi/facebook/menu/menu-dd.css	(revision 84)
+++ /trunk/client/temi/facebook/menu/menu-dd.css	(revision 85)
@@ -1,5 +1,5 @@
 /*CSS principale per il menu*/
 
-ul#nav{font:  Verdena,Tahoma,sans-serif}
+ul#nav{font-family:  Verdena,Tahoma,sans-serif}
 ul#nav,ul#nav li,ul#nav ul,ul#nav ul li{margin:0;padding:0;list-style-type:none}
 ul#nav{height:26px;line-height:25px;margin-left:5px;
Index: /trunk/client/temi/facebook/style.css
===================================================================
--- /trunk/client/temi/facebook/style.css	(revision 84)
+++ /trunk/client/temi/facebook/style.css	(revision 85)
@@ -532,4 +532,4 @@
 }
 
-# facebook box
-
+/*# facebook box*/
+
Index: /trunk/eleonline2.sql
===================================================================
--- /trunk/eleonline2.sql	(revision 84)
+++ /trunk/eleonline2.sql	(revision 85)
@@ -409,6 +409,7 @@
   `data_fine` date NOT NULL,
   `seggi` int(4) NOT NULL,
-  PRIMARY KEY  (`id_fascia`)
-) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+  KEY `id_fascia` (`id_fascia`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+SET character_set_client = @saved_cs_client;
 
 --
@@ -416,10 +417,9 @@
 --
 
-
+LOCK TABLES `soraldo_ele_fasce` WRITE;
 /*!40000 ALTER TABLE `soraldo_ele_fasce` DISABLE KEYS */;
-LOCK TABLES `soraldo_ele_fasce` WRITE;
-INSERT INTO `soraldo_ele_fasce` VALUES (1,3000,'2000-01-01','0000-00-00',12),(2,10000,'2000-01-01','0000-00-00',16),(3,15000,'2000-01-01','0000-00-00',20),(4,30000,'2000-01-01','0000-00-00',20),(5,100000,'2000-01-01','0000-00-00',30),(6,250000,'2000-01-01','0000-00-00',40),(7,500000,'2000-01-01','0000-00-00',46),(8,1000000,'2000-01-01','0000-00-00',50),(9,100000000,'2000-01-01','0000-00-00',60);
-UNLOCK TABLES;
+INSERT INTO `soraldo_ele_fasce` VALUES (1,3000,'2000-01-01','2010-12-31',12),(2,10000,'2000-01-01','2010-12-31',16),(3,15000,'2000-01-01','2010-12-31',20),(4,30000,'2000-01-01','2010-12-31',20),(5,100000,'2000-01-01','2010-12-31',30),(6,250000,'2000-01-01','2010-12-31',40),(7,500000,'2000-01-01','2010-12-31',46),(8,1000000,'2000-01-01','2010-12-31',50),(9,100000000,'2000-01-01','2010-12-31',60),(4,30000,'2011-01-01','0000-00-00',16),(1,3000,'2011-01-01','0000-00-00',9),(2,10000,'2011-01-01','0000-00-00',12),(3,15000,'2011-01-01','0000-00-00',16),(5,100000,'2011-01-01','0000-00-00',24),(6,250000,'2011-01-01','0000-00-00',32),(7,500000,'2011-01-01','0000-00-00',36),(8,1000000,'2011-01-01','0000-00-00',40),(9,100000000,'2011-01-01','0000-00-00',48);
 /*!40000 ALTER TABLE `soraldo_ele_fasce` ENABLE KEYS */;
+UNLOCK TABLES;
 
 --
