/[openfoncier]/trunk/obj/reqmo.class.php
ViewVC logotype

Annotation of /trunk/obj/reqmo.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2656 - (hide annotations)
Mon Dec 30 16:53:38 2013 UTC (11 years, 1 month ago) by nhaye
File size: 28250 byte(s)
Amélioration de la génération des reqmo suite au changement de librairie pdf

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 nhaye 2589 echo "\n<div id=\"".$this->extension."\">\n";
75 nhaye 2563 //
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     "&amp;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     "&amp;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 nhaye 2573 $this->reqmo = $reqmo;
317 nhaye 2563
318     }
319    
320     function displayTable($url = "../scr/requeteur.php") {
321 nhaye 2573 // execution de la requete
322     $res_reqmo = $this->f->db-> query ($this->reqmo['sql']);
323     $this->f->isDatabaseError($res_reqmo);
324    
325     $this->info = $res_reqmo -> tableInfo ();
326 nhaye 2563 //
327     echo "&nbsp;";
328     $param['class']="tab";
329     $param['idcolumntoggle']="requeteur";
330     $this->f->layout->display_table_start($param);
331     //echo "<table class=\"tab-tab\">\n";
332     //
333     echo "<thead><tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">";
334     $key=0;
335     foreach($this->info as $elem) {
336     $param = array(
337     "key" => $key,
338     "info" => $this->info
339     );
340     $this->f->layout->display_table_cellule_entete_colonnes($param);
341     echo "<center>"._($elem['name'])."</center></th>";
342     $key=$key+1;
343     }
344     echo "</tr></thead>\n";
345     //
346     $cptenr = 0;
347 nhaye 2573 while ($row=& $res_reqmo->fetchRow()) {
348 nhaye 2563 //
349     echo "<tr class=\"tab-data ".($cptenr % 2 == 0 ? "odd" : "even")."\">\n";
350     //
351     $cptenr = $cptenr + 1;
352     $i = 0;
353     foreach ($row as $elem) {
354     if (is_numeric($elem)) {
355     echo "<td class='resultrequete' align='right'>";
356     } else {
357     echo "<td class='resultrequete'>";
358     }
359     $tmp="";
360     $tmp=str_replace(chr(13).chr(10), '<br>', $elem);
361     echo $tmp."</td>";
362     $i++;
363     }
364     echo "</tr>\n";
365     }
366     //
367     echo "</tbody></table>\n";
368     if ($cptenr==0){
369     echo "<br>"._('aucun')."&nbsp;"._('enregistrement')."<br>";
370     }
371     $this->displayBoutonRetour($url);
372     }
373    
374     function displayCSV($separateur, $url = "../scr/requeteur.php") {
375 nhaye 2573
376     // execution de la requete
377     $res_reqmo = $this->f->db-> query ($this->reqmo['sql']);
378     $this->f->isDatabaseError($res_reqmo);
379    
380     $this->info = $res_reqmo -> tableInfo ();
381    
382 nhaye 2563 $inf="";
383     foreach ($this->info as $elem) {
384     $inf=$inf.$elem['name'].$separateur;
385     }
386     $inf .= "\n";
387     $cptenr=0;
388 nhaye 2573 while ($row=& $res_reqmo->fetchRow()) {
389 nhaye 2563 $cptenr=$cptenr+1;
390     $i=0;
391     foreach($row as $elem) {
392     //****
393     $tmp="";
394     $tmp=str_replace(chr(13).chr(10), ' / ', $elem);
395     $tmp=str_replace(';', ' ', $tmp);
396     //*****
397     $inf .= $tmp.$separateur;
398     $i++;
399     }
400     $inf .= "\n";
401     }
402     if ($cptenr==0){
403     $inf .="\n"._('aucun')."&nbsp;"._('enregistrement')."\n";
404     }
405     $nom_fichier="export_".$this->obj.".csv";
406     $fic = fopen ("../tmp/".$nom_fichier, "w");
407     fwrite ($fic, $inf);
408     fclose ($fic);
409     echo _("Le fichier a ete exporte, vous pouvez l'ouvrir immediatement en cliquant sur : ");
410     $msg = "<a class=\"om-prev-icon trace-16\" href=\"javascript:traces('".$nom_fichier."');\">";
411     $msg .= _("Telecharger le fichier")." [".$nom_fichier."]";
412     $msg .= "</a>";
413     //
414     $param['lien']=$msg;
415     $this->f->layout->display_lien($param);
416     $msg .= "<br />";
417     $this->displayBoutonRetour($url);
418     }
419    
420 nhaye 2573 function displayPDF($url = "../scr/requeteur.php") {
421     require_once "../core/fpdf_etat.php";
422    
423 nhaye 2656 $pdf = new PDF($this->reqmo['om_sousetat_orientation'], "mm", $this->reqmo['om_sousetat_format'],
424     true,
425     'UTF-8');
426     $pdf->setPrintHeader(false);
427 nhaye 2573 // Ajoute une nouvelle page à l'édition
428     $pdf->AddPage();
429     // On récupère l'enregistrement 'om_sousetat' de la collectivité en cours dans
430     // l'état 'actif'
431     $niveau = $_SESSION['niveau'];
432     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
433     $sql .= " where id='".$this->reqmo["om_sousetat"]."' ";
434     $sql .= " and actif IS TRUE ";
435     $sql .= " and om_collectivite='".$_SESSION['collectivite']."' ";
436     $res2 = $this->f->db->query($sql);
437     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
438     $this->f->isDatabaseError($res2);
439     // Si on obtient aucun résultat
440     if ($res2->numrows() == 0) {
441     // On libère le résultat de la requête précédente
442     $res2->free();
443     //
444     if ($niveau == "") {
445     // On récupère l'identifiant de la collectivité de niveau 2
446     $sql = "select om_collectivite from ".DB_PREFIXE."om_collectivite ";
447     $sql .= " where niveau='2' ";
448     $niveau = $this->f->db->getone($sql);
449     $this->f->addToLog("pdfetat.php: db->getone(\"".$sql."\");", VERBOSE_MODE);
450     $this->f->isDatabaseError($niveau);
451     }
452     // On récupère l'enregistrement 'om_sousetat' de la collectivité de niveau
453     // 2 dans l'état 'actif'
454     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
455     $sql .= " where id='".$this->reqmo["om_sousetat"]."'";
456     $sql .= " and actif IS TRUE ";
457     $sql .= " and om_collectivite='".$niveau."' ";
458     $res2 = $this->f->db->query($sql);
459     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
460     $this->f->isDatabaseError($res2);
461     // Si on obtient aucun résultat
462     if ($res2->numrows() == 0) {
463     // On libère le résultat de la requête précédente
464     $res2->free();
465     // On récupère l'enregistrement 'om_sousetat' de la collectivité de
466     // niveau 2 dans n'importe quel état
467     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
468     $sql .= " where id='".$this->reqmo["om_sousetat"]."' ";
469     $sql .= " and om_collectivite='".$niveau."' ";
470     $res2 = $this->f->db->query($sql);
471     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
472     $this->f->isDatabaseError($res2);
473     }
474     }
475    
476     //
477     while ($sousetat =& $res2->fetchRow(DB_FETCHMODE_ASSOC)) {
478     $idx = "";
479     $_GET['idx'] = "";
480     //
481     $titre = '';
482     $titre = $sousetat['titre'];
483     $titre = str_replace("&aujourdhui", date('d/m/Y'), $titre);
484     $collectivite = isset($collectivite)&&$collectivite != array()?
485     $collectivite:
486     $this->f->collectivite;
487     if (isset($collectivite) && $collectivite != array()) {
488     //
489     foreach (array_keys($collectivite) as $elem) {
490     //
491     $temp = "&".$elem;
492     $titre = str_replace($temp, $collectivite[$elem], $titre);
493     $sql = str_replace($temp, $collectivite[$elem], $sql);
494     if ( strstr($elem, "ged_") === false && strstr($elem, "erp_") === false
495     && strstr($elem, "id_") === false && strstr($elem, "sig_") === false
496     && strstr($elem, "option_") === false ) {
497     $champs_remplacement_etat[] = "&amp;".$elem;
498     }
499     }
500     }
501     //Date au format jour_de_la_semaine jour_du_mois mois_de_l'année
502     //Ex. Lundi 12 Mars
503     $jourSemaine = array(_('Dimanche'),_('Lundi'),_('Mardi'),_('Mercredi'),_('Jeudi'),
504     _('Vendredi'),_('Samedi'));
505     $moisAnnee = array(_('Janvier'),_('Fevrier'),_('Mars'),_('Avril'),_('Mai'),
506     _('Juin'),_('Juillet'),_('Aout'),_('Septembre'),_('Octobre'),_('Novembre')
507     ,_('Decembre'));
508     $titre=str_replace("&jourSemaine",$jourSemaine[date('w')]." ".date('d')." ".$moisAnnee[date('n')-1]." ".date('Y'),$titre);
509     $sousetat['titre'] = $titre;
510     $sousetat['om_sql'] = $this->reqmo['sql'];
511     // imprime les colonnes de la requete
512     $edition = array(
513     'se_font' => 'helvetica',
514     'se_couleurtexte' => array(0,0,0)
515     );
516     $pdf->sousetatdb($this->f->db, $edition, $sousetat);
517     }
518    
519     // Construction du nom du fichier
520     $filename = date("Ymd-His");
521     $filename .= "-reqmo";
522     $filename .= "-".$this->obj;
523     $filename .= ".pdf";
524     $contenu = $pdf->Output($filename, "S");
525    
526     // Métadonnées du fichier csv résultat
527     $metadata['filename'] = $filename;
528     $metadata['size'] = strlen($contenu);
529     $metadata['mimetype'] = "application/pdf";
530     // Création du fichier sur le storage temporaire
531 nhaye 2581 $pdf_res_uid = $this->f->storage->create_temporary($contenu, $metadata);
532     // Affichage du message d'erreur ou de validation
533     if($pdf_res_uid === "OP_FAILURE" ){
534     $this->f->addToMessage("error", _("Erreur de configuration. Contactez votre administrateur."));
535     } else {
536     $msg = _("Le fichier a ete exporte, vous pouvez l'ouvrir immediatement en cliquant sur : ");
537 nhaye 2583 $msg .= "<a class='bold' target='_blanc' href=\"../spg/file.php?uid=".$pdf_res_uid."&mode=temporary\">";
538 nhaye 2581 $msg .= _("Telecharger le fichier")." [".$filename."]";
539     $msg .= "</a>";
540     $this->f->addToMessage("ok", $msg);
541     }
542     $this->f->displayMessages();
543 nhaye 2573 //
544 nhaye 2581 echo "<br />";
545 nhaye 2573 $this->displayBoutonRetour($url);
546     }
547    
548 nhaye 2563 public function display_requeteur_formulaire($param,$f) {
549     //
550     // requeteur formulaire
551     //
552     $db=$param["db"];
553     $extension = $param["extension"];
554     if (file_exists ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc.php")) {
555     include ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc.php");
556     }
557     elseif (file_exists ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc")) {
558     include ("../sql/".$param["phptype"]."/".$this->obj.".".$extension.".inc");
559     }
560     $validation = $param["validation"];
561     $cptemp = $param["cptemp"];
562     $cpts=$param["cpts"];
563     $cptsel=$param["cptsel"];
564     echo "<table cellpadding=\"0\" class=\"formEntete ui-corner-all\">\n";
565     //
566     echo "<tr><td colspan=\"2\">";
567     //
568     echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n";
569     //
570     echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">";
571     echo _("Criteres de la requete");
572     echo "</legend>\n";
573     //
574     echo "<table>";
575     //
576     // On separe tous les champs entre crochets dans la requête
577     $temp = explode ("[", $reqmo["sql"]);
578     //
579     for ($i = 1; $i < sizeof($temp); $i++) {
580     // On vire le crochet de la fin
581     $temp1 = explode("]", $temp[$i]);
582     // On check si alias
583     $temp4 = explode (" as ", $temp1[0]);
584     if (isset($temp4[1])) {
585     $temp1[0] = $temp4[1];
586     }
587     //
588     $temp6 = $temp1[0];
589    
590     if (!isset($reqmo[$temp1[0]])) {
591     // saisie criteres where
592     //
593     if ($cpts == 0) {
594     echo "<tr>\n";
595     } elseif ($cpts == 4) {
596     echo "</tr>\n<tr>\n";
597     $cpts = 0;
598     }
599     //
600     echo "\t<td class=\"tri\">";
601     echo "&nbsp;"._($temp6)."&nbsp;<input type=\"text\" name=\"".$temp1[0]."\" value=\"\" size=\"30\" class=\"champFormulaire\" />";
602     echo "</td>\n";
603     //
604     $cpts++;
605     } else {
606     //
607    
608     if ($reqmo[$temp1[0]] == "checked") {
609     //
610     if ($cptemp == 0) {
611     echo "<tr>\n";
612     echo "\t<td colspan=\"4\"><b>";
613     echo _("Choix des champs a afficher");
614     echo "</b></td>\n";
615     echo "</tr>\n<tr>\n";
616     } elseif ($cptemp == 4) {
617     echo "</tr>\n<tr>\n";
618     $cptemp = 0;
619     }
620     //
621     echo "\t<td colspan='2' class='champs'>";
622     echo "<input type=\"checkbox\" value=\"Oui\" name=\"".$temp1[0]."\" size=\"40\" class=\"champFormulaire\" checked=\"checked\" />";
623     echo "&nbsp;&nbsp;"._($temp6)."&nbsp;";
624     echo "</td>\n";
625     //
626     $cptemp++;
627     } else {
628     //
629     $temp3 = "";
630     $temp3 = $reqmo[$temp1[0]];
631     if(!is_array($temp3)) {
632     $temp3 = substr($temp3, 0, 6);
633     }
634     //
635     if ($temp3 == "select") {
636     //
637     if ($cptsel == 0) {
638     echo "</tr><tr>\n";
639     echo "\t<td colspan=\"4\"><b>";
640     echo _("Choix des criteres de tri");
641     echo "</b></td>\n";
642     echo "</tr>\n";
643     } elseif ($cptsel == 4) {
644     echo "</tr>\n<tr>\n";
645     $cptsel = 0;
646     }
647     //
648     echo "\t<td class=\"tri\">";
649     echo _($temp6)."&nbsp;";
650     echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">";
651     $res1 = $db->query($reqmo[$temp1[0]]);
652     $f->isDatabaseError($res1);
653     while ($row1 =& $res1->fetchRow()) {
654     echo "<option value=\"".$row1[0]."\">".$row1[1]."</option>";
655     }
656     echo "</select>";
657     echo "</td>\n";
658     //
659     $cptsel++;
660     } else {
661     //
662     if ($cptsel == 0) {
663     echo "</tr><tr>\n";
664     echo "\t<td colspan=\"4\"><b>";
665     echo _("Choix des criteres de tri");
666     echo "</b></td>\n";
667     echo "</tr><tr>\n";
668     } elseif ($cptsel == 4) {
669     echo "</tr>\n<tr>\n";
670     $cptsel = 0;
671     }
672     //
673     echo "\t<td class=\"tri\">";
674     echo _($temp6)."&nbsp;";
675     echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">";
676     foreach ($reqmo [$temp1 [0]] as $elem) {
677     echo "<option value='".$elem."'>"._($elem)."</option>";
678     }
679     echo "</select>";
680     echo "</td>\n";
681     //
682     $cptsel++;
683     }
684     }
685     }
686     // re initialisation
687     $temp1[0] = "";
688     }
689     echo "</tr>";
690     echo "</table>";
691     //
692     echo "</fieldset>\n";
693     //
694     //echo "<table>\n";
695     //
696     echo "<tr><td colspan=\"2\">";
697     //
698     echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n";
699     //
700     echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">";
701     echo _("Parametres de sortie");
702     echo "</legend>\n";
703     //
704     echo "<table>";
705     //
706     echo "<tr>";
707     //
708     echo "<td class=\"params\">"._("Choix du format de sortie")."&nbsp;";
709     echo "<select name=\"sortie\" class=\"champFormulaire\">";
710     echo "<option value=\"tableau\">"._("Tableau - Affichage a l'ecran")."</option>";
711     echo "<option value=\"csv\">"._("CSV - Export vers logiciel tableur")."</option>";
712 nhaye 2573
713     if(isset($reqmo["om_sousetat"]) AND $reqmo["om_sousetat"] != "") {
714     echo "<option value=\"pdf\">"._("PDF - Version imprimable")."</option>";
715     }
716 nhaye 2563 echo "</select>";
717     echo "</td>";
718     //
719     echo "</tr>";
720     echo "<tr>";
721     //
722     echo "<td class=\"params\">"._("Separateur de champs (pour le format CSV)")."&nbsp;";
723     echo "<select name=\"separateur\" class=\"champFormulaire\">";
724     echo "<option>;</option>";
725     echo "<option>|</option>";
726     echo "<option>,</option>";
727     echo "</select>";
728     echo "</td>";
729     //
730     echo "</tr>";
731     echo "<tr>";
732     //
733     echo "<td class=\"params\" >"._("Nombre limite d'enregistrements a afficher (pour le format Tableau)")."&nbsp;";
734     echo "<input type=\"text\" name=\"limite\" value=\"100\" size=\"5\" class=\"champFormulaire\" />";
735     echo "</td>";
736     echo "</tr>";
737     echo "</table>";
738     //
739     echo "</fieldset>\n";
740     //
741     echo "</td></tr>\n";
742     // Fermeture de la balise table
743     echo "</table>\n";
744     }
745    
746     }// fin classe
747     ?>

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26