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

Diff of /trunk/obj/consultation.class.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 494 by vpihour, Thu Oct 11 14:25:08 2012 UTC revision 497 by vpihour, Fri Oct 12 15:35:11 2012 UTC
# Line 4  Line 4 
4  require_once ("../gen/obj/consultation.class.php");  require_once ("../gen/obj/consultation.class.php");
5    
6  class consultation extends consultation_gen {  class consultation extends consultation_gen {
7            var $maj;
8      function consultation($id,&$db,$debug) {      function consultation($id,&$db,$debug) {
9          $this->constructeur($id,$db,$debug);          $this->constructeur($id,$db,$debug);
10      }// fin constructeur      }// fin constructeur
# Line 20  class consultation extends consultation_ Line 20  class consultation extends consultation_
20      function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){      function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire){
21          if ($validation==0) {          if ($validation==0) {
22              if ($maj == 0){              if ($maj == 0){
23                $form->setVal("dossier", $idxformulaire);                  $form->setVal("dossier", $idxformulaire);
24                                    $form->setVal("date_envoi",date('d/m/Y'));
25              }              }
26                            else
27                                    if ( $maj == 1 )
28                                            $form->setVal("date_retour",date('d/m/Y'));
29          }          }
30      }      }
31    
# Line 33  class consultation extends consultation_ Line 37  class consultation extends consultation_
37                  $form->setType('service', 'select');                  $form->setType('service', 'select');
38                  $form->setType('date_limite', 'hidden');                  $form->setType('date_limite', 'hidden');
39                  $form->setType('date_retour', 'hidden');                  $form->setType('date_retour', 'hidden');
40                  $form->setType('avis_decision', 'hidden');                  $form->setType('avis_consultation', 'hidden');
41                                    $form->setType('motivation', 'hidden');
42                                    $form->setType('fichier', 'hidden');
43                                    $form->setType('lu', 'hidden');
44                                    $form->setType('date_reception', 'hidden');
45              }else{   // modify              }else{   // modify
46                  $form->setType('date_envoi', 'hiddenstaticdate');                  $form->setType('date_envoi', 'hiddenstaticdate');
47                                    $form->setType('date_limite', 'hiddenstaticdate');
48                  $form->setType('service', 'selectdisabled');                  $form->setType('service', 'selectdisabled');
                 $form->setType('date_limite', 'date2');  
49                  $form->setType('date_retour', 'date2');                  $form->setType('date_retour', 'date2');
50                  $form->setType('avis_decision', 'select');                  $form->setType('avis_consultation', 'select');
51                                    $form->setType('motivation', 'textarea');
52                                    $form->setType('fichier', 'upload');
53              }              }
54              $form->setType('consultation', 'hiddenstatic');              $form->setType('consultation', 'hiddenstatic');
55              $form->setType('dossier', 'hiddenstatic');              $form->setType('dossier', 'hiddenstatic');
56          }          }
57                    else {
58                $form->setType('date_limite', 'hidden');
59                $form->setType('date_retour', 'hidden');
60                $form->setType('avis_consultation', 'hidden');
61                            $form->setType('motivation', 'hidden');
62                            $form->setType('fichier', 'hidden');
63                            $form->setType('lu', 'hidden');
64                            $form->setType('date_reception', 'hidden');
65                    }
66      }      }
67    
68      // TRIGGER AVANT MODIFICATION DE DONNEES      // TRIGGER AVANT MODIFICATION DE DONNEES
# Line 57  class consultation extends consultation_ Line 76  class consultation extends consultation_
76              $this->msg=$this->msg."<br>"._("delai")." ".              $this->msg=$this->msg."<br>"._("delai")." ".
77                 _("retour")." ".$delai." "._("mois")." -> ".                 _("retour")." ".$delai." "._("mois")." -> ".
78                 _("retour")." ".$this->valF['date_limite']."<br>";                 _("retour")." ".$this->valF['date_limite']."<br>";
79                            $this->valF['lu'] = true;
80                            
81                            /*require("../php/phpmailer/class.phpmailer.php");
82    
83                            $mail = new PHPMailer();
84                            
85                            $mail->IsSMTP();                                      // set mailer to use SMTP
86                            $mail->Host = "smtp.gmail.com";  // specify main and backup server
87                            $mail->SMTPAuth = true;     // turn on SMTP authentication
88                            $mail->Username = "";  // SMTP username
89                            $mail->Password = ""; // SMTP password
90                            
91                            $mail->From = "[email protected]";
92                            $mail->FromName = "Mailer";
93                            $mail->AddAddress("[email protected]", "Vi");
94                            $mail->AddReplyTo("[email protected]", "Information");
95                            
96                            $mail->WordWrap = 50;                                 // set word wrap to 50 characters
97                            $mail->IsHTML(true);                                  // set email format to HTML
98                            
99                            $mail->Subject = "Here is the subject";
100                            $mail->Body    = "This is the HTML message body <b>in bold!</b>";
101                            $mail->AltBody = "This is the body in plain text for non-HTML mail clients";
102                            
103                            if(!$mail->Send())
104                            {
105                               echo "Message could not be sent. <p>";
106                               echo "Mailer Error: " . $mail->ErrorInfo;
107                               exit;
108                            }
109                            
110                            echo "Message has been sent";*/
111          }          }
112      }      }
113    
# Line 98  class consultation extends consultation_ Line 149  class consultation extends consultation_
149              $jour = $jourmax;              $jour = $jourmax;
150          return $annee."-".$mois."-".$jour ;          return $annee."-".$mois."-".$jour ;
151      }      }
152    
153            // =============================================
154        // Ajout du fielset
155        // Add fieldset
156        // =============================================
157            function setLayout(&$form, $maj){
158                    if ( $maj < 2 ) {
159                            //Champs sur lequel s'ouvre le fieldset
160                            $form->setBloc('dossier','D',"");
161                            $form->setFieldset('dossier','D',_('Consultation'));
162                    
163          //Date du jour par défaut dans le champ "date d'envoi"                          //Champs sur lequel se ferme le fieldset
164          function setVal(&$form, $maj, $validation, &$db, $DEBUG=null){                          $form->setFieldset('date_envoi','F','');
165                  parent::setVal($form, $maj, $validation, $db, $DEBUG=null);                          $form->setBloc('date_envoi','F');
166                  if ($validation==0) {                          if ( $maj == 1 ){
167                          if ($maj == 0){                                  //Champs sur lequel s'ouvre le fieldset
168                                  $form->setVal("date_envoi", date('Y-m-d'));                                  $form->setBloc('date_reception','D',"");
169                                    $form->setFieldset('date_reception','D',_('Retour d\'avis'));
170                    
171                                    //Champs sur lequel se ferme le fieldset
172                                    $form->setFieldset('lu','F','');
173                                    $form->setBloc('lu','F');
174                          }                          }
175                  }                  }
176                            
177            }
178            
179            function setSelect(&$form, $maj,&$db,$debug) {
180            parent::setSelect($form, $maj,$db,$debug);
181                    if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php"))
182                    include ("../sql/".$db->phptype."/".$this->table.".form.inc.php");
183            if($maj<2){
184                $contenu=array();
185                $sql = " SELECT service, abrege, libelle FROM ".DB_PREFIXE."service";
186                            $res = $db->query($sql);
187                            if (database::isError($res))
188                    die($res->getMessage());
189                            $contenu[0][0]="";
190                    $contenu[1][0]=_('choisir')." "._('service');
191                            $k=1;
192                    while ($row=& $res->fetchRow()){
193                        if($maj==0){ // ajouter
194                            $contenu[0][$k]=$row[0];
195                            $contenu[1][$k]=$row[1]." ".$row[2];
196                            $k++;
197                        }else{
198                            // select hiddenstatic
199                            $contenu[0][$k]=$row[0];
200                            $contenu[1][$k]=$row[1]." ".$row[2];
201                            $k++;
202                        }
203                    }
204                    $form->setSelect("service",$contenu);
205                    }
206          }          }
207                    
208            //Formatage des intitulés des champs.
209            function setLib(&$form,$maj) {
210            parent::setLib($form,$maj);
211                    $form->setLib('date_reception','date de reception');
212                    $form->setLib('avis_consultation','avis');
213                    $form->setLib('fichier','retour d\'avis');
214        }
215  }// fin classe  }// fin classe
216  ?>  ?>

Legend:
Removed from v.494  
changed lines
  Added in v.497

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26