source: trunk/admin/modules/Elezioni/funzionidata.php@ 407

Last change on this file since 407 was 257, checked in by roby, 6 years ago
File size: 3.5 KB
RevLine 
[2]1<?php
2// *****************************************************************************************************************************
3// Funzioni formattazione data e altro
4// *****************************************************************************************************************************
5
6
[36]7function giorno($min,$max)
[2]8{
9$giorno='';
[79]10if(!$min) $min='1';
[36]11if(!$max) $max='31';
12$giorni=array();
13for($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');
[2]15foreach($giorni as $gi)
16 $giorno .= "<option value=$gi>$gi</option>";
17$giorno .= "</select>";
18echo "$giorno";
19}
20
21
22function mese()
23{
24$mese='';
25$mesi= array('01','02','03','04','05','06','07','08','09','10','11','12');
26foreach($mesi as $me)
27 $mese .= "<option value=$me>$me </option>";
28$mese .= "</select>";
29echo "$mese";
30}
31
32function anno()
33{
34$anno ='';
35$curr=date("Y",time());
36$curr++;
[97]37$anni=array($curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--,$curr--);
[2]38foreach($anni as $an)
39 $anno .= "<option value=$an>$an</option>";
40$anno .= "</select>";
41echo "$anno";
42}
43
[254]44function ore()
[2]45{
46$ora='';
47$ore= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24');
48foreach($ore as $ori)
49 $ora .= "<option value=$ori>$ori</option>";
50$ora .= "</select>";
51echo "$ora";
52}
53
54
55function minuti()
56{
57$minuto='';
58$minuti= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14',
59'15', '16', '17', '18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
60'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50',
61'51','52','53','54','55','56','57','58','59');
62foreach($minuti as $minu)
63 $minuto .= "<option value=$minu>$minu </option>";
64$minuto .= "</select>";
65echo "$minuto";
66}
67
68function secondi()
69{
70$secondo='';
71$secondi= array('00','01','02','03','04','05','06','07','08','09','10','11','12','13','14',
72'15', '16', '17', '18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33',
73'34','35','36','37','38','39','40','41','42','43','44','45','46','47','48','49','50',
74'51','52','53','54','55','56','57','58','59');
75foreach($secondi as $sec)
76 $secondo .= "<option value=$sec>$sec</option>";
77$secondo .= "</select>";
78echo "$secondo";
79}
80
81
82
83function form_data($data)
84
85 {
86 list($anno,$mese,$giorno) = explode("-", $data) ;
87 if ($giorno>0)
88 return("$giorno-$mese-$anno");
89 else
90 return("&nbsp; ");
91 }
92
[139]93function isdisgiunto()
94{
[188]95global $prefix,$dbi,$id_cons,$limite,$id_comune,$ops;
96$sqlcomu="select fascia from ".$prefix."_ele_comuni where id_comune='$id_comune'";
[257]97$res = $dbi->prepare("$sqlcomu");
98$res->execute();
99list($fascia)=$res->fetch(PDO::FETCH_NUM);
[139]100 #voti di lista e di gruppo completamente disgiunti
[257]101 $sql="select infdisgiunto, supdisgiunto from ".$prefix."_ele_conf as t2 left join ".$prefix."_ele_cons_comune as t1 on t1.id_conf=t2.id_conf where id_cons = '$id_cons' ";
102 $result = $dbi->prepare("$sql");
103 $result->execute();
[139]104 $glsep='';
[257]105 if ($result->rowCount()) {
106 list($infdis,$supdis)=$result->fetch(PDO::FETCH_NUM);
[188]107 if((($fascia>$limite and $supdis) or ($fascia<=$limite and $infdis)))
[139]108 $glsep='_lista';
109 }
110return $glsep;
111}
[2]112
[189]113
114
[192]115
[189]116#########################################
117
118?>
Note: See TracBrowser for help on using the repository browser.