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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3303 - (hide annotations)
Thu Feb 19 14:17:40 2015 UTC (9 years, 11 months ago) by softime
File size: 29582 byte(s)
* Bug - Erreur de base de données dans les statistiques à la demande sur la
  requête "dossier_detaillee_accordes". C'est corrigé.
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 fmichon 3172 $dir = substr($dir, 0, strlen($dir) - 4)."/sql/".OM_DB_PHPTYPE."/";
49 nhaye 2563 $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["db"]= $this->f->db;
173     $param["validation"]=$validation;
174     $param["cptemp"]= 0;
175     $param["cpts"]=0;
176     $param["cptsel"]=0;
177     $param["extension"]=$this->extension;
178     // XXX Plus possible d'utiliser cette méthode
179     // $this->f->layout->display_requeteur_formulaire($param, $this->f);
180     $this->display_requeteur_formulaire($param, $this->f);
181     //
182     // Affichage des actions de controles du formulaire
183     echo "<div class=\"formControls\">";
184     // Bouton de validation du formulaire
185     $param["input"]="<input type=\"submit\" name=\"valid.reqmo\" value=\"".
186     _("Executer la requete sur :")." '"._($this->obj)."'\" />";
187     $this->f->layout->display_input($param);
188     // Lien retour
189     // XXX Plus possible
190     $param["lien"]="<a href=\"".$urlRetour."\" class=\"retour\">"._("Retour")."</a>";
191     $this->f->layout->display_lien_retour($param);
192     // Fermeture du conteneur des actions de controles du formulaire
193     echo "</div>";
194     // Fermeture de la balise formulaire
195     echo "\n</form>\n";
196     $this->closeContent();
197     }
198    
199     /**
200     * Fermeture du conteneur de contenu
201     * @return [type] [description]
202     */
203     private function displayBoutonRetour($url) {
204     // Affichage des actions de controles du formulaire
205     echo "<div class=\"formControls\">";
206     // Lien retour
207     $param["lien"]="<a href=\"".$url."?obj=".$this->obj.
208     "&amp;step=0\" class=\"retour\">"._("Retour")."</a>";
209     $this->f->layout->display_lien_retour($param);
210     // Fermeture du conteneur des actions de controles du formulaire
211     echo "</div>";
212     }
213    
214     /**
215     * Fermeture du conteneur de contenu
216     * @return [type] [description]
217     */
218     private function closeContent() {
219     //
220     echo "</div>\n";
221     //
222     echo "</div>\n";
223     //
224     echo "</div>\n";
225     }
226    
227     function prepareRequest($reqmo) {
228     $temp = explode ("[", $reqmo["sql"]);
229     for($i = 1; $i < count($temp); $i++) {
230     $temp1 = explode ("]", $temp [$i]);
231     $temp4 = explode (" as ", $temp1 [0]);
232     if (isset ($temp4 [1])) {
233     $temp5 = $temp4 [1]; // uniquement as
234     } else {
235     $temp5 = $temp1 [0]; // en entier
236     }
237    
238 nmeucci 3239 if ($this->f->get_submitted_post_value($temp5) !== null) {
239     $temp2 = $this->f->get_submitted_post_value($temp5);
240 nhaye 2563 } else {
241     $temp2 = "";
242     }
243     // ****
244     if(isset($reqmo[$temp5])){
245     if($reqmo[$temp5]=="checked") {
246     if ($temp2 == 'Oui') {
247     $reqmo ['sql'] = str_replace ("[".$temp1[0]."]",
248     $temp1[0],
249     $reqmo['sql']);
250     } else {
251     $reqmo['sql']=str_replace("[".$temp1[0]."],",
252     '',
253     $reqmo['sql']);
254     $reqmo['sql']=str_replace(",[".$temp1[0]."]",
255     '',
256     $reqmo['sql']);
257     $reqmo['sql']=str_replace(", [".$temp1[0]."]",
258     '',
259     $reqmo['sql']);
260     $reqmo['sql']=str_replace("[".$temp1[0]."]",
261     '',
262     $reqmo['sql']);
263     }
264     } else {
265     $reqmo['sql']=str_replace("[".$temp1[0]."]",
266     $temp2,
267     $reqmo['sql']);
268     }
269     //****
270     } else {
271     $reqmo['sql']=str_replace("[".$temp1[0]."]",
272     $temp2,
273     $reqmo['sql']);
274     }
275     //****
276     $temp1[0]="";
277     }
278    
279     $blanc = 0;
280     $temp = "";
281     for($i=0;$i<strlen($reqmo['sql']);$i++) {
282     if (substr($reqmo['sql'], $i, 1)==chr(13) or
283     substr($reqmo['sql'], $i, 1)==chr(10) or
284     substr($reqmo['sql'], $i, 1)==chr(32)) {
285     if ($blanc==0){
286     $temp=$temp.chr(32);
287     }
288     $blanc=1;
289     } else {
290     $temp=$temp.substr($reqmo['sql'],$i,1);
291     $blanc=0;
292     }
293     }
294     $reqmo['sql']=$temp ;
295     $reqmo['sql']=str_replace(',,', ',', $reqmo['sql']);
296     $reqmo['sql']=str_replace(', ,', ',', $reqmo['sql']);
297     $reqmo['sql']=str_replace(', from', ' from', $reqmo['sql']);
298 softime 3303 $reqmo['sql']=str_replace(', FROM', ' FROM', $reqmo['sql']);
299 nhaye 2563 $reqmo['sql']=str_replace('select ,', 'select ', $reqmo['sql']);
300 softime 3303 $reqmo['sql']=str_replace('SELECT ,', 'SELECT ', $reqmo['sql']);
301 nhaye 2563 // post limite
302 nmeucci 3239 if ($this->f->get_submitted_post_value('limite') !== null) {
303     $limite = $this->f->get_submitted_post_value('limite');
304 nhaye 2563 } else {
305     $limite = 100;
306     }
307     // post sortie
308 nmeucci 3239 if ($this->f->get_submitted_post_value('sortie') !== null) {
309     $sortie= $this->f->get_submitted_post_value('sortie');
310 nhaye 2563 } else {
311     $sortie ='tableau';
312     }
313     // limite uniquement pour tableau
314     if ($sortie =='tableau') {
315     $reqmo['sql']= $reqmo['sql']." limit ".$limite;
316     }
317 nhaye 2573 $this->reqmo = $reqmo;
318 nhaye 2563
319     }
320    
321     function displayTable($url = "../scr/requeteur.php") {
322 nhaye 2573 // execution de la requete
323     $res_reqmo = $this->f->db-> query ($this->reqmo['sql']);
324     $this->f->isDatabaseError($res_reqmo);
325    
326     $this->info = $res_reqmo -> tableInfo ();
327 nhaye 2563 //
328     echo "&nbsp;";
329     $param['class']="tab";
330     $param['idcolumntoggle']="requeteur";
331     $this->f->layout->display_table_start($param);
332     //echo "<table class=\"tab-tab\">\n";
333     //
334     echo "<thead><tr class=\"ui-tabs-nav ui-accordion ui-state-default tab-title\">";
335     $key=0;
336     foreach($this->info as $elem) {
337     $param = array(
338     "key" => $key,
339     "info" => $this->info
340     );
341     $this->f->layout->display_table_cellule_entete_colonnes($param);
342     echo "<center>"._($elem['name'])."</center></th>";
343     $key=$key+1;
344     }
345     echo "</tr></thead>\n";
346     //
347     $cptenr = 0;
348 nhaye 2573 while ($row=& $res_reqmo->fetchRow()) {
349 nhaye 2563 //
350     echo "<tr class=\"tab-data ".($cptenr % 2 == 0 ? "odd" : "even")."\">\n";
351     //
352     $cptenr = $cptenr + 1;
353     $i = 0;
354     foreach ($row as $elem) {
355     if (is_numeric($elem)) {
356     echo "<td class='resultrequete' align='right'>";
357     } else {
358     echo "<td class='resultrequete'>";
359     }
360     $tmp="";
361     $tmp=str_replace(chr(13).chr(10), '<br>', $elem);
362     echo $tmp."</td>";
363     $i++;
364     }
365     echo "</tr>\n";
366     }
367     //
368     echo "</tbody></table>\n";
369     if ($cptenr==0){
370     echo "<br>"._('aucun')."&nbsp;"._('enregistrement')."<br>";
371     }
372     $this->displayBoutonRetour($url);
373     }
374    
375     function displayCSV($separateur, $url = "../scr/requeteur.php") {
376 nhaye 2573
377     // execution de la requete
378     $res_reqmo = $this->f->db-> query ($this->reqmo['sql']);
379     $this->f->isDatabaseError($res_reqmo);
380    
381     $this->info = $res_reqmo -> tableInfo ();
382    
383 nhaye 2563 $inf="";
384     foreach ($this->info as $elem) {
385     $inf=$inf.$elem['name'].$separateur;
386     }
387     $inf .= "\n";
388     $cptenr=0;
389 nhaye 2573 while ($row=& $res_reqmo->fetchRow()) {
390 nhaye 2563 $cptenr=$cptenr+1;
391     $i=0;
392     foreach($row as $elem) {
393     //****
394     $tmp="";
395     $tmp=str_replace(chr(13).chr(10), ' / ', $elem);
396     $tmp=str_replace(';', ' ', $tmp);
397     //*****
398     $inf .= $tmp.$separateur;
399     $i++;
400     }
401     $inf .= "\n";
402     }
403     if ($cptenr==0){
404     $inf .="\n"._('aucun')."&nbsp;"._('enregistrement')."\n";
405     }
406     $nom_fichier="export_".$this->obj.".csv";
407     $fic = fopen ("../tmp/".$nom_fichier, "w");
408     fwrite ($fic, $inf);
409     fclose ($fic);
410     echo _("Le fichier a ete exporte, vous pouvez l'ouvrir immediatement en cliquant sur : ");
411     $msg = "<a class=\"om-prev-icon trace-16\" href=\"javascript:traces('".$nom_fichier."');\">";
412     $msg .= _("Telecharger le fichier")." [".$nom_fichier."]";
413     $msg .= "</a>";
414     //
415     $param['lien']=$msg;
416     $this->f->layout->display_lien($param);
417     $msg .= "<br />";
418     $this->displayBoutonRetour($url);
419     }
420    
421 nhaye 2573 function displayPDF($url = "../scr/requeteur.php") {
422     require_once "../core/fpdf_etat.php";
423    
424 nhaye 2656 $pdf = new PDF($this->reqmo['om_sousetat_orientation'], "mm", $this->reqmo['om_sousetat_format'],
425     true,
426     'UTF-8');
427     $pdf->setPrintHeader(false);
428 nhaye 2573 // Ajoute une nouvelle page à l'édition
429     $pdf->AddPage();
430     // On récupère l'enregistrement 'om_sousetat' de la collectivité en cours dans
431     // l'état 'actif'
432     $niveau = $_SESSION['niveau'];
433     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
434     $sql .= " where id='".$this->reqmo["om_sousetat"]."' ";
435     $sql .= " and actif IS TRUE ";
436     $sql .= " and om_collectivite='".$_SESSION['collectivite']."' ";
437     $res2 = $this->f->db->query($sql);
438     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
439     $this->f->isDatabaseError($res2);
440     // Si on obtient aucun résultat
441     if ($res2->numrows() == 0) {
442     // On libère le résultat de la requête précédente
443     $res2->free();
444     //
445     if ($niveau == "") {
446     // On récupère l'identifiant de la collectivité de niveau 2
447     $sql = "select om_collectivite from ".DB_PREFIXE."om_collectivite ";
448     $sql .= " where niveau='2' ";
449     $niveau = $this->f->db->getone($sql);
450     $this->f->addToLog("pdfetat.php: db->getone(\"".$sql."\");", VERBOSE_MODE);
451     $this->f->isDatabaseError($niveau);
452     }
453     // On récupère l'enregistrement 'om_sousetat' de la collectivité de niveau
454     // 2 dans l'état 'actif'
455     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
456     $sql .= " where id='".$this->reqmo["om_sousetat"]."'";
457     $sql .= " and actif IS TRUE ";
458     $sql .= " and om_collectivite='".$niveau."' ";
459     $res2 = $this->f->db->query($sql);
460     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
461     $this->f->isDatabaseError($res2);
462     // Si on obtient aucun résultat
463     if ($res2->numrows() == 0) {
464     // On libère le résultat de la requête précédente
465     $res2->free();
466     // On récupère l'enregistrement 'om_sousetat' de la collectivité de
467     // niveau 2 dans n'importe quel état
468     $sql = " select * from ".DB_PREFIXE."om_sousetat ";
469     $sql .= " where id='".$this->reqmo["om_sousetat"]."' ";
470     $sql .= " and om_collectivite='".$niveau."' ";
471     $res2 = $this->f->db->query($sql);
472     $this->f->addToLog("pdfetat.php: db->query(\"".$sql."\");", VERBOSE_MODE);
473     $this->f->isDatabaseError($res2);
474     }
475     }
476    
477     //
478     while ($sousetat =& $res2->fetchRow(DB_FETCHMODE_ASSOC)) {
479     $idx = "";
480     $_GET['idx'] = "";
481     //
482     $titre = '';
483     $titre = $sousetat['titre'];
484     $titre = str_replace("&aujourdhui", date('d/m/Y'), $titre);
485     $collectivite = isset($collectivite)&&$collectivite != array()?
486     $collectivite:
487     $this->f->collectivite;
488     if (isset($collectivite) && $collectivite != array()) {
489     //
490     foreach (array_keys($collectivite) as $elem) {
491     //
492     $temp = "&".$elem;
493     $titre = str_replace($temp, $collectivite[$elem], $titre);
494     $sql = str_replace($temp, $collectivite[$elem], $sql);
495     if ( strstr($elem, "ged_") === false && strstr($elem, "erp_") === false
496     && strstr($elem, "id_") === false && strstr($elem, "sig_") === false
497     && strstr($elem, "option_") === false ) {
498     $champs_remplacement_etat[] = "&amp;".$elem;
499     }
500     }
501     }
502     //Date au format jour_de_la_semaine jour_du_mois mois_de_l'année
503     //Ex. Lundi 12 Mars
504     $jourSemaine = array(_('Dimanche'),_('Lundi'),_('Mardi'),_('Mercredi'),_('Jeudi'),
505     _('Vendredi'),_('Samedi'));
506     $moisAnnee = array(_('Janvier'),_('Fevrier'),_('Mars'),_('Avril'),_('Mai'),
507     _('Juin'),_('Juillet'),_('Aout'),_('Septembre'),_('Octobre'),_('Novembre')
508     ,_('Decembre'));
509     $titre=str_replace("&jourSemaine",$jourSemaine[date('w')]." ".date('d')." ".$moisAnnee[date('n')-1]." ".date('Y'),$titre);
510     $sousetat['titre'] = $titre;
511     $sousetat['om_sql'] = $this->reqmo['sql'];
512     // imprime les colonnes de la requete
513     $edition = array(
514     'se_font' => 'helvetica',
515     'se_couleurtexte' => array(0,0,0)
516     );
517     $pdf->sousetatdb($this->f->db, $edition, $sousetat);
518     }
519    
520     // Construction du nom du fichier
521     $filename = date("Ymd-His");
522     $filename .= "-reqmo";
523     $filename .= "-".$this->obj;
524     $filename .= ".pdf";
525     $contenu = $pdf->Output($filename, "S");
526    
527     // Métadonnées du fichier csv résultat
528     $metadata['filename'] = $filename;
529     $metadata['size'] = strlen($contenu);
530     $metadata['mimetype'] = "application/pdf";
531     // Création du fichier sur le storage temporaire
532 nhaye 2581 $pdf_res_uid = $this->f->storage->create_temporary($contenu, $metadata);
533     // Affichage du message d'erreur ou de validation
534     if($pdf_res_uid === "OP_FAILURE" ){
535     $this->f->addToMessage("error", _("Erreur de configuration. Contactez votre administrateur."));
536     } else {
537     $msg = _("Le fichier a ete exporte, vous pouvez l'ouvrir immediatement en cliquant sur : ");
538 nhaye 2583 $msg .= "<a class='bold' target='_blanc' href=\"../spg/file.php?uid=".$pdf_res_uid."&mode=temporary\">";
539 nhaye 2581 $msg .= _("Telecharger le fichier")." [".$filename."]";
540     $msg .= "</a>";
541     $this->f->addToMessage("ok", $msg);
542     }
543     $this->f->displayMessages();
544 nhaye 2573 //
545 nhaye 2581 echo "<br />";
546 nhaye 2573 $this->displayBoutonRetour($url);
547     }
548    
549 nhaye 2563 public function display_requeteur_formulaire($param,$f) {
550     //
551     // requeteur formulaire
552     //
553     $db=$param["db"];
554     $extension = $param["extension"];
555 fmichon 3172 if (file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->obj.".".$extension.".inc.php")) {
556     include ("../sql/".OM_DB_PHPTYPE."/".$this->obj.".".$extension.".inc.php");
557 nhaye 2563 }
558 fmichon 3172 elseif (file_exists ("../sql/".OM_DB_PHPTYPE."/".$this->obj.".".$extension.".inc")) {
559     include ("../sql/".OM_DB_PHPTYPE."/".$this->obj.".".$extension.".inc");
560 nhaye 2563 }
561     $validation = $param["validation"];
562     $cptemp = $param["cptemp"];
563     $cpts=$param["cpts"];
564     $cptsel=$param["cptsel"];
565     echo "<table cellpadding=\"0\" class=\"formEntete ui-corner-all\">\n";
566     //
567     echo "<tr><td colspan=\"2\">";
568     //
569     echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n";
570     //
571     echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">";
572     echo _("Criteres de la requete");
573     echo "</legend>\n";
574     //
575     echo "<table>";
576     //
577     // On separe tous les champs entre crochets dans la requête
578     $temp = explode ("[", $reqmo["sql"]);
579     //
580     for ($i = 1; $i < sizeof($temp); $i++) {
581     // On vire le crochet de la fin
582     $temp1 = explode("]", $temp[$i]);
583     // On check si alias
584     $temp4 = explode (" as ", $temp1[0]);
585     if (isset($temp4[1])) {
586     $temp1[0] = $temp4[1];
587     }
588     //
589     $temp6 = $temp1[0];
590    
591     if (!isset($reqmo[$temp1[0]])) {
592     // saisie criteres where
593     //
594     if ($cpts == 0) {
595     echo "<tr>\n";
596     } elseif ($cpts == 4) {
597     echo "</tr>\n<tr>\n";
598     $cpts = 0;
599     }
600     //
601     echo "\t<td class=\"tri\">";
602     echo "&nbsp;"._($temp6)."&nbsp;<input type=\"text\" name=\"".$temp1[0]."\" value=\"\" size=\"30\" class=\"champFormulaire\" />";
603     echo "</td>\n";
604     //
605     $cpts++;
606     } else {
607     //
608    
609     if ($reqmo[$temp1[0]] == "checked") {
610     //
611     if ($cptemp == 0) {
612     echo "<tr>\n";
613     echo "\t<td colspan=\"4\"><b>";
614     echo _("Choix des champs a afficher");
615     echo "</b></td>\n";
616     echo "</tr>\n<tr>\n";
617     } elseif ($cptemp == 4) {
618     echo "</tr>\n<tr>\n";
619     $cptemp = 0;
620     }
621     //
622     echo "\t<td colspan='2' class='champs'>";
623     echo "<input type=\"checkbox\" value=\"Oui\" name=\"".$temp1[0]."\" size=\"40\" class=\"champFormulaire\" checked=\"checked\" />";
624     echo "&nbsp;&nbsp;"._($temp6)."&nbsp;";
625     echo "</td>\n";
626     //
627     $cptemp++;
628     } else {
629     //
630     $temp3 = "";
631     $temp3 = $reqmo[$temp1[0]];
632     if(!is_array($temp3)) {
633     $temp3 = substr($temp3, 0, 6);
634     }
635     //
636     if ($temp3 == "select") {
637     //
638     if ($cptsel == 0) {
639     echo "</tr><tr>\n";
640     echo "\t<td colspan=\"4\"><b>";
641     echo _("Choix des criteres de tri");
642     echo "</b></td>\n";
643     echo "</tr>\n";
644     } elseif ($cptsel == 4) {
645     echo "</tr>\n<tr>\n";
646     $cptsel = 0;
647     }
648     //
649     echo "\t<td class=\"tri\">";
650     echo _($temp6)."&nbsp;";
651     echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">";
652     $res1 = $db->query($reqmo[$temp1[0]]);
653     $f->isDatabaseError($res1);
654     while ($row1 =& $res1->fetchRow()) {
655     echo "<option value=\"".$row1[0]."\">".$row1[1]."</option>";
656     }
657     echo "</select>";
658     echo "</td>\n";
659     //
660     $cptsel++;
661 vpihour 3219 }
662     //Si un tableau est fourni
663     elseif(is_array($temp3)) {
664 nhaye 2563 //
665     if ($cptsel == 0) {
666     echo "</tr><tr>\n";
667     echo "\t<td colspan=\"4\"><b>";
668     echo _("Choix des criteres de tri");
669     echo "</b></td>\n";
670     echo "</tr><tr>\n";
671     } elseif ($cptsel == 4) {
672     echo "</tr>\n<tr>\n";
673     $cptsel = 0;
674     }
675     //
676     echo "\t<td class=\"tri\">";
677     echo _($temp6)."&nbsp;";
678     echo "<select name=\"".$temp1[0]."\" class=\"champFormulaire\">";
679     foreach ($reqmo [$temp1 [0]] as $elem) {
680     echo "<option value='".$elem."'>"._($elem)."</option>";
681     }
682     echo "</select>";
683     echo "</td>\n";
684     //
685     $cptsel++;
686 vpihour 3219 }
687     // Si un input est fourni
688     else {
689     //
690     if ($cptsel == 0) {
691     echo "</tr><tr>\n";
692     echo "\t<td colspan=\"4\"><b>";
693     echo _("Choix des criteres de tri");
694     echo "</b></td>\n";
695     echo "</tr><tr>\n";
696     } elseif ($cptsel == 4) {
697     echo "</tr>\n<tr>\n";
698     $cptsel = 0;
699     }
700     //
701     echo "\t<td class=\"tri\">";
702     echo _($temp6)."&nbsp;";
703     echo "<input type=\"text\" name=\""._($temp6)."\" placeholder=\"".$reqmo[$temp6]."\" value=\"\" size=\"10\" class=\"champFormulaire\" />";
704     echo "</td>\n";
705     //
706     $cptsel++;
707 nhaye 2563 }
708     }
709     }
710     // re initialisation
711     $temp1[0] = "";
712     }
713     echo "</tr>";
714     echo "</table>";
715     //
716     echo "</fieldset>\n";
717     //
718     //echo "<table>\n";
719     //
720     echo "<tr><td colspan=\"2\">";
721     //
722     echo "<fieldset class=\"cadre ui-corner-all ui-widget-content\">\n";
723     //
724     echo "\t<legend class=\"ui-corner-all ui-widget-content ui-state-active\">";
725     echo _("Parametres de sortie");
726     echo "</legend>\n";
727     //
728     echo "<table>";
729     //
730     echo "<tr>";
731     //
732     echo "<td class=\"params\">"._("Choix du format de sortie")."&nbsp;";
733     echo "<select name=\"sortie\" class=\"champFormulaire\">";
734     echo "<option value=\"tableau\">"._("Tableau - Affichage a l'ecran")."</option>";
735     echo "<option value=\"csv\">"._("CSV - Export vers logiciel tableur")."</option>";
736 nhaye 2573
737     if(isset($reqmo["om_sousetat"]) AND $reqmo["om_sousetat"] != "") {
738     echo "<option value=\"pdf\">"._("PDF - Version imprimable")."</option>";
739     }
740 nhaye 2563 echo "</select>";
741     echo "</td>";
742     //
743     echo "</tr>";
744     echo "<tr>";
745     //
746     echo "<td class=\"params\">"._("Separateur de champs (pour le format CSV)")."&nbsp;";
747     echo "<select name=\"separateur\" class=\"champFormulaire\">";
748     echo "<option>;</option>";
749     echo "<option>|</option>";
750     echo "<option>,</option>";
751     echo "</select>";
752     echo "</td>";
753     //
754     echo "</tr>";
755     echo "<tr>";
756     //
757     echo "<td class=\"params\" >"._("Nombre limite d'enregistrements a afficher (pour le format Tableau)")."&nbsp;";
758     echo "<input type=\"text\" name=\"limite\" value=\"100\" size=\"5\" class=\"champFormulaire\" />";
759     echo "</td>";
760     echo "</tr>";
761     echo "</table>";
762     //
763     echo "</fieldset>\n";
764     //
765     echo "</td></tr>\n";
766     // Fermeture de la balise table
767     echo "</table>\n";
768     }
769    
770     }// fin classe
771     ?>

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26