1 |
nhaye |
2563 |
<?php |
2 |
|
|
/** |
3 |
|
|
* Classe permettant de factoriser la génération du rendu des requêtes mémorisées |
4 |
|
|
* |
5 |
|
|
* Requêteur |
6 |
|
|
* principe de REQMO (requête memorisée): |
7 |
|
|
* permet de faire des requêtes memorisées |
8 |
|
|
* la requête est paramétrée en sql/typedebase/langue/obj.reqmo.inc.php |
9 |
|
|
* $reqmo['sql'] = requête paramétrable |
10 |
|
|
* les paramètres sont entre crochets |
11 |
|
|
* type de paramètre = $reqmo['parametre'] |
12 |
|
|
* checked : case à cocher pour que la zone soit prise en compte |
13 |
|
|
* liste : liste de valeur proposé pour paramétrer une sélection ou un tri |
14 |
|
|
* select : liste de valeur proposé pour paramétrer une sélection ou un tri |
15 |
|
|
* d'après une requête dans une table |
16 |
|
|
* $reqmo['libelle'] = libéllé de la requête |
17 |
|
|
* $reqmo['separateur'] = séparateur pour fichier csv |
18 |
|
|
* |
19 |
|
|
* @package openfoncier |
20 |
|
|
* @version SVN : $Id$ |
21 |
|
|
*/ |
22 |
|
|
|
23 |
|
|
class reqmo { |
24 |
|
|
|
25 |
|
|
// utils |
26 |
|
|
var $f = ""; |
27 |
|
|
|
28 |
|
|
// Liste des fichiers reqmo |
29 |
|
|
var $tab_reqmo = array(); |
30 |
|
|
|
31 |
|
|
// Type de rendu |
32 |
|
|
var $sortie = ""; |
33 |
|
|
|
34 |
|
|
var $info; |
35 |
|
|
|
36 |
|
|
var $obj; |
37 |
|
|
|
38 |
|
|
var $extension; |
39 |
|
|
|
40 |
|
|
function __construct($f, $obj, $extension = "reqmo") { |
41 |
|
|
$this->f = $f; |
42 |
|
|
$this->obj = $obj; |
43 |
|
|
$this->extension = $extension; |
44 |
|
|
}// fin constructeur |
45 |
|
|
|
46 |
|
|
private function getReqmoFile() { |
47 |
|
|
$dir = getcwd(); |
48 |
|
|
$dir = substr($dir, 0, strlen($dir) - 4)."/sql/".$this->f->phptype."/"; |
49 |
|
|
$dossier = opendir($dir); |
50 |
|
|
while ($entree = readdir($dossier)) { |
51 |
|
|
if (strstr($entree, $this->extension)) { |
52 |
|
|
|
53 |
|
|
// Si l'extention du fichier $entree est .inc.php |
54 |
|
|
if (strpos($entree, ".inc.php")) { |
55 |
|
|
$filext = strlen($this->extension)+9; |
56 |
|
|
} |
57 |
|
|
// Sinon on considere qu'elle est -> .inc (compatibilite) |
58 |
|
|
else { |
59 |
|
|
$filext = strlen($this->extension)+5; |
60 |
|
|
} |
61 |
|
|
|
62 |
|
|
array_push($this->tab_reqmo, |
63 |
|
|
array('file' => substr($entree, 0, strlen($entree) - $filext))); |
64 |
|
|
} |
65 |
|
|
} |
66 |
|
|
closedir($dossier); |
67 |
|
|
asort($this->tab_reqmo); |
68 |
|
|
|
69 |
|
|
return $this->tab_reqmo; |
70 |
|
|
} |
71 |
|
|
|
72 |
|
|
function displayReqmoList($url = "../scr/requeteur.php") { |
73 |
|
|
$this->getReqmoFile(); |
74 |
|
|
echo "\n<div id=\"reqmo\">\n"; |
75 |
|
|
// |
76 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
77 |
|
|
// |
78 |
|
|
echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
79 |
|
|
echo _("Choix de la requete memorisee"); |
80 |
|
|
echo "</legend>\n"; |
81 |
|
|
// |
82 |
|
|
echo "\t<div class=\"list\">\n"; |
83 |
|
|
if (count($this->tab_reqmo) == 0) { |
84 |
|
|
echo "<p>"; |
85 |
|
|
echo _("Il n'y a aucun element de ce type dans l'application."); |
86 |
|
|
echo "</p>"; |
87 |
|
|
} |
88 |
|
|
// |
89 |
|
|
$this->f->layout->display_start_liste_responsive(); |
90 |
|
|
// |
91 |
|
|
$nbr_elements=0; |
92 |
|
|
foreach ($this->tab_reqmo as $elem) { |
93 |
|
|
$nbr_elements=$nbr_elements+1; |
94 |
|
|
$this->f->layout->display_start_block_liste_responsive($nbr_elements); |
95 |
|
|
echo "<span>\n"; |
96 |
|
|
// |
97 |
|
|
$params = array( |
98 |
|
|
"file" => $elem['file'] |
99 |
|
|
); |
100 |
|
|
// XXX passe plus par le layout dans le cas ou l'url est passée en paramètre |
101 |
|
|
// $this->f->layout->display_reqmo_lien($params); |
102 |
|
|
echo "<a "; |
103 |
|
|
echo " class=\"om-prev-icon reqmo-16\" href=\"".$url."?obj=".$params['file']."\">"; |
104 |
|
|
echo _($params['file']); |
105 |
|
|
echo "</a>"; |
106 |
|
|
|
107 |
|
|
echo "</span>\n"; |
108 |
|
|
$this->f->layout->display_close_block_liste_responsive(); |
109 |
|
|
// |
110 |
|
|
} |
111 |
|
|
$this->f->layout->display_close_liste_responsive(); |
112 |
|
|
echo "\t</div>\n"; |
113 |
|
|
// |
114 |
|
|
echo "</fieldset>\n"; |
115 |
|
|
// |
116 |
|
|
echo "</div>\n"; |
117 |
|
|
|
118 |
|
|
} |
119 |
|
|
|
120 |
|
|
/** |
121 |
|
|
* Ouverture du conteneur de contenu |
122 |
|
|
* @return [type] [description] |
123 |
|
|
*/ |
124 |
|
|
private function openContent() { |
125 |
|
|
/** |
126 |
|
|
* Ouverture du conteneur de la page |
127 |
|
|
*/ |
128 |
|
|
// |
129 |
|
|
echo "\n<div id=\"generator-generate\">\n"; |
130 |
|
|
// |
131 |
|
|
echo "<div id=\"formulaire\">\n\n"; |
132 |
|
|
// |
133 |
|
|
$this->f->layout->display_start_navbar(); |
134 |
|
|
echo "<ul>\n"; |
135 |
|
|
if (isset($reqmo["reqmo_libelle"])) { |
136 |
|
|
echo "\t<li><a href=\"#tabs-1\">". |
137 |
|
|
_("Export de : "). |
138 |
|
|
_($reqmo["reqmo_libelle"])."</a></li>\n"; |
139 |
|
|
} elseif (isset($reqmo["libelle"])) { |
140 |
|
|
echo "\t<li><a href=\"#tabs-1\">". |
141 |
|
|
_("Export de : "). |
142 |
|
|
_($reqmo["libelle"])."</a></li>\n"; |
143 |
|
|
} else { |
144 |
|
|
echo "\t<li><a href=\"#tabs-1\">". |
145 |
|
|
_("Export de : ")._($this->obj). |
146 |
|
|
"</a></li>\n"; |
147 |
|
|
} |
148 |
|
|
echo "</ul>\n"; |
149 |
|
|
// |
150 |
|
|
$this->f->layout->display_stop_navbar(); |
151 |
|
|
echo "\n<div id=\"tabs-1\">\n"; |
152 |
|
|
} |
153 |
|
|
|
154 |
|
|
/** |
155 |
|
|
* Affichage du formulaire de la requête mémorisée |
156 |
|
|
* @param [type] $validation [description] |
157 |
|
|
* @return [type] [description] |
158 |
|
|
*/ |
159 |
|
|
function displayForm( |
160 |
|
|
$validation, |
161 |
|
|
$urlRequet = "../scr/requeteur.php", |
162 |
|
|
$urlRetour = "../scr/reqmo.php") { |
163 |
|
|
|
164 |
|
|
$this->openContent(); |
165 |
|
|
/** |
166 |
|
|
* Ouverture du formulaire |
167 |
|
|
*/ |
168 |
|
|
// Ouverture de la balise formulaire |
169 |
|
|
echo "<form method=\"post\" action=\"".$urlRequet."?obj=".$this->obj. |
170 |
|
|
"&step=1\" name=\"f1\">\n"; |
171 |
|
|
$param["obj"]=$this->obj; |
172 |
|
|
$param["phptype"]= $this->f->phptype; |
173 |
|
|
$param["db"]= $this->f->db; |
174 |
|
|
$param["validation"]=$validation; |
175 |
|
|
$param["cptemp"]= 0; |
176 |
|
|
$param["cpts"]=0; |
177 |
|
|
$param["cptsel"]=0; |
178 |
|
|
$param["extension"]=$this->extension; |
179 |
|
|
// XXX Plus possible d'utiliser cette méthode |
180 |
|
|
// $this->f->layout->display_requeteur_formulaire($param, $this->f); |
181 |
|
|
$this->display_requeteur_formulaire($param, $this->f); |
182 |
|
|
// |
183 |
|
|
// Affichage des actions de controles du formulaire |
184 |
|
|
echo "<div class=\"formControls\">"; |
185 |
|
|
// Bouton de validation du formulaire |
186 |
|
|
$param["input"]="<input type=\"submit\" name=\"valid.reqmo\" value=\"". |
187 |
|
|
_("Executer la requete sur :")." '"._($this->obj)."'\" />"; |
188 |
|
|
$this->f->layout->display_input($param); |
189 |
|
|
// Lien retour |
190 |
|
|
// XXX Plus possible |
191 |
|
|
$param["lien"]="<a href=\"".$urlRetour."\" class=\"retour\">"._("Retour")."</a>"; |
192 |
|
|
$this->f->layout->display_lien_retour($param); |
193 |
|
|
// Fermeture du conteneur des actions de controles du formulaire |
194 |
|
|
echo "</div>"; |
195 |
|
|
// Fermeture de la balise formulaire |
196 |
|
|
echo "\n</form>\n"; |
197 |
|
|
$this->closeContent(); |
198 |
|
|
} |
199 |
|
|
|
200 |
|
|
/** |
201 |
|
|
* Fermeture du conteneur de contenu |
202 |
|
|
* @return [type] [description] |
203 |
|
|
*/ |
204 |
|
|
private function displayBoutonRetour($url) { |
205 |
|
|
// Affichage des actions de controles du formulaire |
206 |
|
|
echo "<div class=\"formControls\">"; |
207 |
|
|
// Lien retour |
208 |
|
|
$param["lien"]="<a href=\"".$url."?obj=".$this->obj. |
209 |
|
|
"&step=0\" class=\"retour\">"._("Retour")."</a>"; |
210 |
|
|
$this->f->layout->display_lien_retour($param); |
211 |
|
|
// Fermeture du conteneur des actions de controles du formulaire |
212 |
|
|
echo "</div>"; |
213 |
|
|
} |
214 |
|
|
|
215 |
|
|
/** |
216 |
|
|
* Fermeture du conteneur de contenu |
217 |
|
|
* @return [type] [description] |
218 |
|
|
*/ |
219 |
|
|
private function closeContent() { |
220 |
|
|
// |
221 |
|
|
echo "</div>\n"; |
222 |
|
|
// |
223 |
|
|
echo "</div>\n"; |
224 |
|
|
// |
225 |
|
|
echo "</div>\n"; |
226 |
|
|
} |
227 |
|
|
|
228 |
|
|
function prepareRequest($reqmo) { |
229 |
|
|
$temp = explode ("[", $reqmo["sql"]); |
230 |
|
|
for($i = 1; $i < count($temp); $i++) { |
231 |
|
|
$temp1 = explode ("]", $temp [$i]); |
232 |
|
|
$temp4 = explode (" as ", $temp1 [0]); |
233 |
|
|
if (isset ($temp4 [1])) { |
234 |
|
|
$temp5 = $temp4 [1]; // uniquement as |
235 |
|
|
} else { |
236 |
|
|
$temp5 = $temp1 [0]; // en entier |
237 |
|
|
} |
238 |
|
|
|
239 |
|
|
if (isset ($_POST [$temp5])) { |
240 |
|
|
$temp2 = $_POST [$temp5]; |
241 |
|
|
} else { |
242 |
|
|
$temp2 = ""; |
243 |
|
|
} |
244 |
|
|
// **** |
245 |
|
|
if(isset($reqmo[$temp5])){ |
246 |
|
|
if($reqmo[$temp5]=="checked") { |
247 |
|
|
if ($temp2 == 'Oui') { |
248 |
|
|
$reqmo ['sql'] = str_replace ("[".$temp1[0]."]", |
249 |
|
|
$temp1[0], |
250 |
|
|
$reqmo['sql']); |
251 |
|
|
} else { |
252 |
|
|
$reqmo['sql']=str_replace("[".$temp1[0]."],", |
253 |
|
|
'', |
254 |
|
|
$reqmo['sql']); |
255 |
|
|
$reqmo['sql']=str_replace(",[".$temp1[0]."]", |
256 |
|
|
'', |
257 |
|
|
$reqmo['sql']); |
258 |
|
|
$reqmo['sql']=str_replace(", [".$temp1[0]."]", |
259 |
|
|
'', |
260 |
|
|
$reqmo['sql']); |
261 |
|
|
$reqmo['sql']=str_replace("[".$temp1[0]."]", |
262 |
|
|
'', |
263 |
|
|
$reqmo['sql']); |
264 |
|
|
} |
265 |
|
|
} else { |
266 |
|
|
$reqmo['sql']=str_replace("[".$temp1[0]."]", |
267 |
|
|
$temp2, |
268 |
|
|
$reqmo['sql']); |
269 |
|
|
} |
270 |
|
|
//**** |
271 |
|
|
} else { |
272 |
|
|
$reqmo['sql']=str_replace("[".$temp1[0]."]", |
273 |
|
|
$temp2, |
274 |
|
|
$reqmo['sql']); |
275 |
|
|
} |
276 |
|
|
//**** |
277 |
|
|
$temp1[0]=""; |
278 |
|
|
} |
279 |
|
|
|
280 |
|
|
$blanc = 0; |
281 |
|
|
$temp = ""; |
282 |
|
|
for($i=0;$i<strlen($reqmo['sql']);$i++) { |
283 |
|
|
if (substr($reqmo['sql'], $i, 1)==chr(13) or |
284 |
|
|
substr($reqmo['sql'], $i, 1)==chr(10) or |
285 |
|
|
substr($reqmo['sql'], $i, 1)==chr(32)) { |
286 |
|
|
if ($blanc==0){ |
287 |
|
|
$temp=$temp.chr(32); |
288 |
|
|
} |
289 |
|
|
$blanc=1; |
290 |
|
|
} else { |
291 |
|
|
$temp=$temp.substr($reqmo['sql'],$i,1); |
292 |
|
|
$blanc=0; |
293 |
|
|
} |
294 |
|
|
} |
295 |
|
|
$reqmo['sql']=$temp ; |
296 |
|
|
$reqmo['sql']=str_replace(',,', ',', $reqmo['sql']); |
297 |
|
|
$reqmo['sql']=str_replace(', ,', ',', $reqmo['sql']); |
298 |
|
|
$reqmo['sql']=str_replace(', from', ' from', $reqmo['sql']); |
299 |
|
|
$reqmo['sql']=str_replace('select ,', 'select ', $reqmo['sql']); |
300 |
|
|
// post limite |
301 |
|
|
if (isset($_POST['limite'])) { |
302 |
|
|
$limite = $_POST['limite']; |
303 |
|
|
} else { |
304 |
|
|
$limite = 100; |
305 |
|
|
} |
306 |
|
|
// post sortie |
307 |
|
|
if (isset ($_POST['sortie'])) { |
308 |
|
|
$sortie= $_POST['sortie']; |
309 |
|
|
} else { |
310 |
|
|
$sortie ='tableau'; |
311 |
|
|
} |
312 |
|
|
// limite uniquement pour tableau |
313 |
|
|
if ($sortie =='tableau') { |
314 |
|
|
$reqmo['sql']= $reqmo['sql']." limit ".$limite; |
315 |
|
|
} |
316 |
|
|
// execution de la requete |
317 |
|
|
$this->res_reqmo = $this->f->db-> query ($reqmo['sql']); |
318 |
|
|
$this->f->isDatabaseError($this->res_reqmo); |
319 |
|
|
|
320 |
|
|
$this->info = $this->res_reqmo -> tableInfo (); |
321 |
|
|
} |
322 |
|
|
|
323 |
|
|
function displayTable($url = "../scr/requeteur.php") { |
324 |
|
|
// |
325 |
|
|
echo " "; |
326 |
|
|
$param['class']="tab"; |
327 |
|
|
$param['idcolumntoggle']="requeteur"; |
328 |
|
|
$this->f->layout->display_table_start($param); |
329 |
|
|
//echo "<table class=\"tab-tab\">\n"; |
330 |
|
|
// |
331 |
|
|
echo "<thead><tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">"; |
332 |
|
|
$key=0; |
333 |
|
|
foreach($this->info as $elem) { |
334 |
|
|
$param = array( |
335 |
|
|
"key" => $key, |
336 |
|
|
"info" => $this->info |
337 |
|
|
); |
338 |
|
|
$this->f->layout->display_table_cellule_entete_colonnes($param); |
339 |
|
|
echo "<center>"._($elem['name'])."</center></th>"; |
340 |
|
|
$key=$key+1; |
341 |
|
|
} |
342 |
|
|
echo "</tr></thead>\n"; |
343 |
|
|
// |
344 |
|
|
$cptenr = 0; |
345 |
|
|
while ($row=& $this->res_reqmo->fetchRow()) { |
346 |
|
|
// |
347 |
|
|
echo "<tr class=\"tab-data ".($cptenr % 2 == 0 ? "odd" : "even")."\">\n"; |
348 |
|
|
// |
349 |
|
|
$cptenr = $cptenr + 1; |
350 |
|
|
$i = 0; |
351 |
|
|
foreach ($row as $elem) { |
352 |
|
|
if (is_numeric($elem)) { |
353 |
|
|
echo "<td class='resultrequete' align='right'>"; |
354 |
|
|
} else { |
355 |
|
|
echo "<td class='resultrequete'>"; |
356 |
|
|
} |
357 |
|
|
$tmp=""; |
358 |
|
|
$tmp=str_replace(chr(13).chr(10), '<br>', $elem); |
359 |
|
|
echo $tmp."</td>"; |
360 |
|
|
$i++; |
361 |
|
|
} |
362 |
|
|
echo "</tr>\n"; |
363 |
|
|
} |
364 |
|
|
// |
365 |
|
|
echo "</tbody></table>\n"; |
366 |
|
|
if ($cptenr==0){ |
367 |
|
|
echo "<br>"._('aucun')." "._('enregistrement')."<br>"; |
368 |
|
|
} |
369 |
|
|
$this->displayBoutonRetour($url); |
370 |
|
|
} |
371 |
|
|
|
372 |
|
|
function displayCSV($separateur, $url = "../scr/requeteur.php") { |
373 |
|
|
$inf=""; |
374 |
|
|
foreach ($this->info as $elem) { |
375 |
|
|
$inf=$inf.$elem['name'].$separateur; |
376 |
|
|
} |
377 |
|
|
$inf .= "\n"; |
378 |
|
|
$cptenr=0; |
379 |
|
|
while ($row=& $this->res_reqmo->fetchRow()) { |
380 |
|
|
$cptenr=$cptenr+1; |
381 |
|
|
$i=0; |
382 |
|
|
foreach($row as $elem) { |
383 |
|
|
//**** |
384 |
|
|
$tmp=""; |
385 |
|
|
$tmp=str_replace(chr(13).chr(10), ' / ', $elem); |
386 |
|
|
$tmp=str_replace(';', ' ', $tmp); |
387 |
|
|
//***** |
388 |
|
|
$inf .= $tmp.$separateur; |
389 |
|
|
$i++; |
390 |
|
|
} |
391 |
|
|
$inf .= "\n"; |
392 |
|
|
} |
393 |
|
|
if ($cptenr==0){ |
394 |
|
|
$inf .="\n"._('aucun')." "._('enregistrement')."\n"; |
395 |
|
|
} |
396 |
|
|
$nom_fichier="export_".$this->obj.".csv"; |
397 |
|
|
$fic = fopen ("../tmp/".$nom_fichier, "w"); |
398 |
|
|
fwrite ($fic, $inf); |
399 |
|
|
fclose ($fic); |
400 |
|
|
echo _("Le fichier a ete exporte, vous pouvez l'ouvrir immediatement en cliquant sur : "); |
401 |
|
|
$msg = "<a class=\"om-prev-icon trace-16\" href=\"javascript:traces('".$nom_fichier."');\">"; |
402 |
|
|
$msg .= _("Telecharger le fichier")." [".$nom_fichier."]"; |
403 |
|
|
$msg .= "</a>"; |
404 |
|
|
// |
405 |
|
|
$param['lien']=$msg; |
406 |
|
|
$this->f->layout->display_lien($param); |
407 |
|
|
$msg .= "<br />"; |
408 |
|
|
$this->displayBoutonRetour($url); |
409 |
|
|
} |
410 |
|
|
|
411 |
|
|
public function display_requeteur_formulaire($param,$f) { |
412 |
|
|
// |
413 |
|
|
// requeteur formulaire |
414 |
|
|
// |
415 |
|
|
$db=$param["db"]; |
416 |
|
|
$extension = $param["extension"]; |
417 |
|
|
if (file_exists ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc.php")) { |
418 |
|
|
include ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc.php"); |
419 |
|
|
} |
420 |
|
|
elseif (file_exists ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc")) { |
421 |
|
|
include ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc"); |
422 |
|
|
} |
423 |
|
|
$validation = $param["validation"]; |
424 |
|
|
$cptemp = $param["cptemp"]; |
425 |
|
|
$cpts=$param["cpts"]; |
426 |
|
|
$cptsel=$param["cptsel"]; |
427 |
|
|
echo "<table cellpadding=\"0\" class=\"formEntete ui-corner-all\">\n"; |
428 |
|
|
// |
429 |
|
|
echo "<tr><td colspan=\"2\">"; |
430 |
|
|
// |
431 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
432 |
|
|
// |
433 |
|
|
echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
434 |
|
|
echo _("Criteres de la requete"); |
435 |
|
|
echo "</legend>\n"; |
436 |
|
|
// |
437 |
|
|
echo "<table>"; |
438 |
|
|
// |
439 |
|
|
// On separe tous les champs entre crochets dans la requête |
440 |
|
|
$temp = explode ("[", $reqmo["sql"]); |
441 |
|
|
// |
442 |
|
|
for ($i = 1; $i < sizeof($temp); $i++) { |
443 |
|
|
// On vire le crochet de la fin |
444 |
|
|
$temp1 = explode("]", $temp[$i]); |
445 |
|
|
// On check si alias |
446 |
|
|
$temp4 = explode (" as ", $temp1[0]); |
447 |
|
|
if (isset($temp4[1])) { |
448 |
|
|
$temp1[0] = $temp4[1]; |
449 |
|
|
} |
450 |
|
|
// |
451 |
|
|
$temp6 = $temp1[0]; |
452 |
|
|
|
453 |
|
|
if (!isset($reqmo[$temp1[0]])) { |
454 |
|
|
// saisie criteres where |
455 |
|
|
// |
456 |
|
|
if ($cpts == 0) { |
457 |
|
|
echo "<tr>\n"; |
458 |
|
|
} elseif ($cpts == 4) { |
459 |
|
|
echo "</tr>\n<tr>\n"; |
460 |
|
|
$cpts = 0; |
461 |
|
|
} |
462 |
|
|
// |
463 |
|
|
echo "\t<td class=\"tri\">"; |
464 |
|
|
echo " "._($temp6)." <input type=\"text\" name=\"".$temp1[0]."\" value=\"\" size=\"30\" class=\"champFormulaire\" />"; |
465 |
|
|
echo "</td>\n"; |
466 |
|
|
// |
467 |
|
|
$cpts++; |
468 |
|
|
} else { |
469 |
|
|
// |
470 |
|
|
|
471 |
|
|
if ($reqmo[$temp1[0]] == "checked") { |
472 |
|
|
// |
473 |
|
|
if ($cptemp == 0) { |
474 |
|
|
echo "<tr>\n"; |
475 |
|
|
echo "\t<td colspan=\"4\"><b>"; |
476 |
|
|
echo _("Choix des champs a afficher"); |
477 |
|
|
echo "</b></td>\n"; |
478 |
|
|
echo "</tr>\n<tr>\n"; |
479 |
|
|
} elseif ($cptemp == 4) { |
480 |
|
|
echo "</tr>\n<tr>\n"; |
481 |
|
|
$cptemp = 0; |
482 |
|
|
} |
483 |
|
|
// |
484 |
|
|
echo "\t<td colspan='2' class='champs'>"; |
485 |
|
|
echo "<input type=\"checkbox\" value=\"Oui\" name=\"".$temp1[0]."\" size=\"40\" class=\"champFormulaire\" checked=\"checked\" />"; |
486 |
|
|
echo " "._($temp6)." "; |
487 |
|
|
echo "</td>\n"; |
488 |
|
|
// |
489 |
|
|
$cptemp++; |
490 |
|
|
} else { |
491 |
|
|
// |
492 |
|
|
$temp3 = ""; |
493 |
|
|
$temp3 = $reqmo[$temp1[0]]; |
494 |
|
|
if(!is_array($temp3)) { |
495 |
|
|
$temp3 = substr($temp3, 0, 6); |
496 |
|
|
} |
497 |
|
|
// |
498 |
|
|
if ($temp3 == "select") { |
499 |
|
|
// |
500 |
|
|
if ($cptsel == 0) { |
501 |
|
|
echo "</tr><tr>\n"; |
502 |
|
|
echo "\t<td colspan=\"4\"><b>"; |
503 |
|
|
echo _("Choix des criteres de tri"); |
504 |
|
|
echo "</b></td>\n"; |
505 |
|
|
echo "</tr>\n"; |
506 |
|
|
} elseif ($cptsel == 4) { |
507 |
|
|
echo "</tr>\n<tr>\n"; |
508 |
|
|
$cptsel = 0; |
509 |
|
|
} |
510 |
|
|
// |
511 |
|
|
echo "\t<td class=\"tri\">"; |
512 |
|
|
echo _($temp6)." "; |
513 |
|
|
echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">"; |
514 |
|
|
$res1 = $db->query($reqmo[$temp1[0]]); |
515 |
|
|
$f->isDatabaseError($res1); |
516 |
|
|
while ($row1 =& $res1->fetchRow()) { |
517 |
|
|
echo "<option value=\"".$row1[0]."\">".$row1[1]."</option>"; |
518 |
|
|
} |
519 |
|
|
echo "</select>"; |
520 |
|
|
echo "</td>\n"; |
521 |
|
|
// |
522 |
|
|
$cptsel++; |
523 |
|
|
} else { |
524 |
|
|
// |
525 |
|
|
if ($cptsel == 0) { |
526 |
|
|
echo "</tr><tr>\n"; |
527 |
|
|
echo "\t<td colspan=\"4\"><b>"; |
528 |
|
|
echo _("Choix des criteres de tri"); |
529 |
|
|
echo "</b></td>\n"; |
530 |
|
|
echo "</tr><tr>\n"; |
531 |
|
|
} elseif ($cptsel == 4) { |
532 |
|
|
echo "</tr>\n<tr>\n"; |
533 |
|
|
$cptsel = 0; |
534 |
|
|
} |
535 |
|
|
// |
536 |
|
|
echo "\t<td class=\"tri\">"; |
537 |
|
|
echo _($temp6)." "; |
538 |
|
|
echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">"; |
539 |
|
|
foreach ($reqmo [$temp1 [0]] as $elem) { |
540 |
|
|
echo "<option value='".$elem."'>"._($elem)."</option>"; |
541 |
|
|
} |
542 |
|
|
echo "</select>"; |
543 |
|
|
echo "</td>\n"; |
544 |
|
|
// |
545 |
|
|
$cptsel++; |
546 |
|
|
} |
547 |
|
|
} |
548 |
|
|
} |
549 |
|
|
// re initialisation |
550 |
|
|
$temp1[0] = ""; |
551 |
|
|
} |
552 |
|
|
echo "</tr>"; |
553 |
|
|
echo "</table>"; |
554 |
|
|
// |
555 |
|
|
echo "</fieldset>\n"; |
556 |
|
|
// |
557 |
|
|
//echo "<table>\n"; |
558 |
|
|
// |
559 |
|
|
echo "<tr><td colspan=\"2\">"; |
560 |
|
|
// |
561 |
|
|
echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n"; |
562 |
|
|
// |
563 |
|
|
echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">"; |
564 |
|
|
echo _("Parametres de sortie"); |
565 |
|
|
echo "</legend>\n"; |
566 |
|
|
// |
567 |
|
|
echo "<table>"; |
568 |
|
|
// |
569 |
|
|
echo "<tr>"; |
570 |
|
|
// |
571 |
|
|
echo "<td class=\"params\">"._("Choix du format de sortie")." "; |
572 |
|
|
echo "<select name=\"sortie\" class=\"champFormulaire\">"; |
573 |
|
|
echo "<option value=\"tableau\">"._("Tableau - Affichage a l'ecran")."</option>"; |
574 |
|
|
echo "<option value=\"csv\">"._("CSV - Export vers logiciel tableur")."</option>"; |
575 |
|
|
echo "</select>"; |
576 |
|
|
echo "</td>"; |
577 |
|
|
// |
578 |
|
|
echo "</tr>"; |
579 |
|
|
echo "<tr>"; |
580 |
|
|
// |
581 |
|
|
echo "<td class=\"params\">"._("Separateur de champs (pour le format CSV)")." "; |
582 |
|
|
echo "<select name=\"separateur\" class=\"champFormulaire\">"; |
583 |
|
|
echo "<option>;</option>"; |
584 |
|
|
echo "<option>|</option>"; |
585 |
|
|
echo "<option>,</option>"; |
586 |
|
|
echo "</select>"; |
587 |
|
|
echo "</td>"; |
588 |
|
|
// |
589 |
|
|
echo "</tr>"; |
590 |
|
|
echo "<tr>"; |
591 |
|
|
// |
592 |
|
|
echo "<td class=\"params\" >"._("Nombre limite d'enregistrements a afficher (pour le format Tableau)")." "; |
593 |
|
|
echo "<input type=\"text\" name=\"limite\" value=\"100\" size=\"5\" class=\"champFormulaire\" />"; |
594 |
|
|
echo "</td>"; |
595 |
|
|
echo "</tr>"; |
596 |
|
|
echo "</table>"; |
597 |
|
|
// |
598 |
|
|
echo "</fieldset>\n"; |
599 |
|
|
// |
600 |
|
|
echo "</td></tr>\n"; |
601 |
|
|
// Fermeture de la balise table |
602 |
|
|
echo "</table>\n"; |
603 |
|
|
} |
604 |
|
|
|
605 |
|
|
}// fin classe |
606 |
|
|
?> |