1 |
fraynaud |
3 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 10/02/2011 20:38 |
4 |
|
|
require_once ("../gen/obj/regle.class.php"); |
5 |
|
|
|
6 |
|
|
class regle extends regle_gen { |
7 |
|
|
|
8 |
fraynaud |
46 |
function regle($id,&$db,$debug) { |
9 |
|
|
$this->constructeur($id,$db,$debug); |
10 |
|
|
}// fin constructeur |
11 |
fraynaud |
3 |
|
12 |
fraynaud |
46 |
|
13 |
|
|
function verifier($val,&$db,$DEBUG){ |
14 |
|
|
$this->correct=True; |
15 |
|
|
$imgv=""; |
16 |
|
|
$f=" ! "; |
17 |
fraynaud |
116 |
$imgv="<img src='../app/img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
18 |
fraynaud |
46 |
if ($this->valF['message']==""){ |
19 |
|
|
$this->correct=false; |
20 |
|
|
$this->msg= $this->msg.$imgv." "._("message")." ". |
21 |
|
|
_("obligatoire").$f; |
22 |
|
|
} |
23 |
|
|
if ($this->valF['valeur']==""){ |
24 |
|
|
$this->correct=false; |
25 |
|
|
$this->msg= $this->msg.$imgv." "._("valeur")." ". |
26 |
|
|
_("obligatoire").$f; |
27 |
|
|
} |
28 |
|
|
if ($this->valF['champ']==""){ |
29 |
|
|
$this->correct=false; |
30 |
|
|
$this->msg= $this->msg.$imgv." "._("champ")." ". |
31 |
|
|
_("obligatoire").$f; |
32 |
|
|
} |
33 |
|
|
if ($this->valF['operateur']==""){ |
34 |
|
|
$this->correct=false; |
35 |
|
|
$this->msg=$this->msg.$imgv." "._("operateur")." ". |
36 |
|
|
_("obligatoire").$f; |
37 |
|
|
} |
38 |
|
|
if ($this->valF['sens']==""){ |
39 |
|
|
$this->correct=false; |
40 |
|
|
$this->msg= $this->msg.$imgv." "._("sens")." ". |
41 |
|
|
_("obligatoire").$f; |
42 |
|
|
} |
43 |
|
|
if ($this->valF['ordre']==""){ |
44 |
|
|
$this->correct=false; |
45 |
|
|
$this->msg= $this->msg.$imgv." "._("ordre")." ". |
46 |
|
|
_("obligatoire").$f; |
47 |
|
|
} |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
function setType(&$form,$maj) { |
51 |
|
|
if ($maj < 2) { //ajouter et modifier |
52 |
|
|
$form->setType('sens', 'select'); |
53 |
|
|
$form->setType('ordre', 'select'); |
54 |
|
|
$form->setType('controle', 'hiddenstatic'); |
55 |
|
|
$form->setType('libelle', 'hiddenstatic'); |
56 |
|
|
$form->setType('id', 'hiddenstatic'); |
57 |
|
|
$form->setType('champ', 'select'); |
58 |
|
|
$form->setType('operateur', 'select');; |
59 |
|
|
if ($maj==1){ //modifier |
60 |
|
|
$form->setType('regle', 'hiddenstatic'); |
61 |
|
|
}else |
62 |
|
|
$form->setType('regle', 'hidden'); |
63 |
|
|
}else{ // supprimer |
64 |
|
|
$form->setType('regle', 'hiddenstatic'); |
65 |
|
|
$form->setType('id', 'hiddenstatic'); |
66 |
|
|
} |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
function setSelect(&$form, $maj,$db,$debug) { |
70 |
|
|
// nature |
71 |
|
|
$contenu=array(); |
72 |
|
|
$contenu[0]=array('plus','moins'); |
73 |
|
|
$contenu[1]=array(_('plus'), _('moins')); |
74 |
|
|
$form->setSelect("sens",$contenu); |
75 |
|
|
// |
76 |
|
|
$contenu=array(); |
77 |
|
|
$contenu[0]=array('shon', |
78 |
|
|
'shob', |
79 |
|
|
'terrain_surface', |
80 |
|
|
'lot', |
81 |
|
|
'hauteur', |
82 |
|
|
'piece_nombre', |
83 |
|
|
'batiment_nombre', |
84 |
|
|
'logement_nombre', |
85 |
|
|
'date_notification_delai', |
86 |
|
|
'date_rejet'); |
87 |
|
|
$contenu[1]=array(_('shon'), |
88 |
|
|
_('shob'), |
89 |
|
|
_('terrain_surface'), |
90 |
|
|
_('lot'), |
91 |
|
|
_('hauteur'), |
92 |
|
|
_('piece_nombre'), |
93 |
|
|
_('batiment_nombre'), |
94 |
|
|
_('logement_nombre'), |
95 |
|
|
_('date_notification_delai'), |
96 |
|
|
_('date_rejet') |
97 |
|
|
); |
98 |
|
|
$form->setSelect("champ",$contenu); |
99 |
|
|
// |
100 |
|
|
$contenu=array(); |
101 |
|
|
$contenu[0]=array('1','2','3','4','5','6','7','8','9'); |
102 |
|
|
$contenu[1]=array('1 '._('regle'), |
103 |
|
|
'2 '._('regle'), |
104 |
|
|
'3 '._('regle'), |
105 |
|
|
'4 '._('regle'), |
106 |
|
|
'5 '._('regle'), |
107 |
|
|
'6 '._('regle'), |
108 |
|
|
'7 '._('regle'), |
109 |
|
|
'8 '._('regle'), |
110 |
|
|
'9 '._('regle'),); |
111 |
|
|
$form->setSelect("ordre",$contenu); |
112 |
|
|
// |
113 |
|
|
$contenu=array(); |
114 |
|
|
$contenu[0]=array('==','!=','>','<','<=','>='); |
115 |
|
|
$contenu[1]=array(_('egal'),_('different'),'>','<','<=','>='); |
116 |
|
|
$form->setSelect("operateur",$contenu); |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
function setTaille(&$form, $maj) { |
120 |
|
|
$form->setTaille('regle',8); |
121 |
|
|
$form->setTaille('sens',5); |
122 |
|
|
$form->setTaille('ordre',2); |
123 |
|
|
$form->setTaille('controle',20); |
124 |
|
|
$form->setTaille('id',8); |
125 |
|
|
$form->setTaille('champ',30); |
126 |
|
|
$form->setTaille('operateur',2); |
127 |
|
|
$form->setTaille('valeur',12); |
128 |
|
|
$form->setTaille('message',80); |
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
function setMax(&$form, $maj) { |
132 |
|
|
$form->setMax('regle',8); |
133 |
|
|
$form->setMax('sens',5); |
134 |
|
|
$form->setMax('ordre',2); |
135 |
|
|
$form->setMax('controle',20); |
136 |
|
|
$form->setMax('id',8); |
137 |
|
|
$form->setMax('champ',30); |
138 |
|
|
$form->setMax('operateur',2); |
139 |
|
|
$form->setMax('valeur',12); |
140 |
|
|
$form->setMax('message',80); |
141 |
|
|
} |
142 |
|
|
|
143 |
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
//function retoursousformulaire($idxformulaire,$retourformulaire,$val,$objsf,$premiersf){ |
147 |
|
|
//if (!$this->correct){ |
148 |
|
|
// echo "<a href=\"form.php?obj=". |
149 |
|
|
// $retourformulaire."&idx=".$val['id']. |
150 |
|
|
// "&objsf=".$objsf."&premiersf=".$premiersf."\">"; |
151 |
|
|
// echo"<img src='../img/retour.png' align='top' hspace='10' border='0'>"; |
152 |
|
|
// echo "</a></center></td> </tr>"; |
153 |
|
|
//}else{ |
154 |
|
|
// echo "<tr><td><br></td></tr><tr><td colspan=2><center><a href=\"form.php?obj=". |
155 |
|
|
// $retourformulaire."&idx=".$val['id']. |
156 |
|
|
// "&objsf=".$objsf."&premiersf=".$premiersf."\">"; |
157 |
|
|
// echo"<img src='../img/retour.png' align='top' border='0'>"; |
158 |
|
|
// echo "</a></center></td> </tr>"; |
159 |
|
|
//}} |
160 |
|
|
|
161 |
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){ |
162 |
|
|
if ($validation==0) { |
163 |
|
|
if ($maj == 0){ |
164 |
|
|
$form->setVal('id', $idxformulaire); |
165 |
|
|
$form->setVal('controle', $retourformulaire); |
166 |
|
|
} |
167 |
|
|
}} |
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
fraynaud |
3 |
}// fin classe |
172 |
|
|
?> |