/[openfoncier]/trunk/app/bible_auto.php
ViewVC logotype

Annotation of /trunk/app/bible_auto.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 88 - (hide annotations)
Thu Aug 25 09:59:07 2011 UTC (13 years, 5 months ago) by fraynaud
File size: 3891 byte(s)
Réorganisation du dossier spécifique de l'application

1 fraynaud 88 <?php
2     /**
3     * Ce script permet de mettre un texte de la bible dans un formulaire instruction
4     * champs file d'un formulaire - automatique
5     *
6     * @package openmairie_foncier
7     * @version SVN : $Id: voir.php 336 2010-12-15 17:26:37Z fraynaud $
8     */
9     require_once "../obj/utils.class.php";
10     $f = new utils("nohtml");
11     /**
12     * Affichage de la structure HTML
13     */
14     $f->setFlag("htmlonly");
15     $f->display();
16     $f->displayStartContent();
17     // *** get
18     $formatDate="AAAA-MM-JJ";
19     $idx=$_GET['idx'];
20     $evenement=$_GET['ev'];
21     $DEBUG=1;
22     // *** extraction consultation
23     $consultation=$f->db->getOne("select consultation from evenement where evenement=".$evenement);
24     $f->isDatabaseError($res);
25     if($consultation=='Oui'){
26     $sql="select date_retour,avis.libelle as avis,
27     service.libelle as service
28     from consultation inner join service
29     on consultation.service =service.service
30     left join avis on consultation.avis = avis.avis
31     where dossier ='".$idx."'";
32     if ($DEBUG==1)
33     echo $sql;
34     $res = $f->db->query($sql);
35     $f->isDatabaseError($res);
36     if ($DEBUG == 1)
37     echo "La requete ".$sql." est executee";
38     $temp="";
39     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
40     // date retour
41     if ($row['date_retour']<>""){
42     if ($formatDate=="AAAA-MM-JJ"){
43     $date = explode("-", $row['date_retour']);
44     // controle de date
45     if (sizeof($date) == 3 and (checkdate($date[1],$date[2],$date[0]))) {
46     $date_retour_f= $date[2]."/".$date[1]."/".$date[0];
47     $correct=true;
48     }else{
49     $msg= $msg."<br>La date ".$row['date_retour']." n'est pas une date.";
50     $correct=false;
51     }
52     }
53     }
54     $temp="Vu l'avis ".$row['avis']." du service ".$row['service'];
55     if($correct==true)
56     $temp=$temp." du ".$date_retour_f;
57     ?>
58     <script language="javascript">
59     opener.document.f2.complement.value = opener.document.f2.complement.value+"<?php echo $temp;?>"+"\r\n";
60     </script>
61     <?php
62     } // while
63     } // consultation
64    
65     // *** bible automatique complement 1
66     $sql="select * from bible where evenement =".$evenement.
67     " and complement=1 and automatique='Oui' and (nature='".
68     substr($idx,0,2)."' or nature ='T')";
69     if ($DEBUG==1)
70     echo $sql;
71     $res = $f->db->query($sql);
72     $f->isDatabaseError($res);
73     if ($DEBUG == 1)
74     echo "La requete ".$sql." est executee";
75     $temp="";
76     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
77     $temp=$row['contenu'];
78     $temp0=str_replace("\r\n","|",$temp);
79     $temp0=str_replace("\r","|",$temp0);
80     $temp0=str_replace("\n","|",$temp0);
81     $temp1=explode("|",$temp0);
82     for($i=0;$i<sizeof($temp1);$i++){
83     $temp2=$temp1[$i];
84     ?>
85     <script language="javascript">
86     opener.document.f2.complement.value = opener.document.f2.complement.value+"<?php echo $temp2;?>"+"\r\n";
87     </script>
88     <?php
89     }
90     } // fin while
91    
92     // *** bible automatique complement 2
93     $sql="select * from bible where evenement =".$evenement.
94     " and complement=2 and automatique ='Oui' and (nature='".
95     substr($idx,0,2)."' or nature ='T')";
96     if ($DEBUG==1)
97     echo $sql;
98     $res = $f->db->query($sql);
99     $f->isDatabaseError($res);
100     if ($DEBUG == 1)
101     echo "La requete ".$sql." est executee";
102     $temp="";
103     while ($row=& $res->fetchRow(DB_FETCHMODE_ASSOC)){
104     $temp=$row['contenu'] ;
105     $temp0=str_replace("\r\n","|",$temp);
106     $temp0=str_replace("\r","|",$temp0);
107     $temp0=str_replace("\n","|",$temp0);
108     //echo "***".$temp0."***<br>";
109     $temp1=explode("|",$temp0);
110     for($i=0;$i<sizeof($temp1);$i++){
111     $temp2=$temp1[$i];
112     ?>
113     <script language="javascript">
114     opener.document.f2.complement2.value = opener.document.f2.complement2.value+"<?php echo $temp2;?>"+"\r\n";
115     </script>
116     <?php
117     }// for
118     } // fin while
119    
120     ?>
121     <script language="javascript">
122     this.close();
123     </script>

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26