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

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

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

revision 1154 by vpihour, Mon Jan 7 15:26:13 2013 UTC revision 1185 by vpihour, Wed Jan 9 11:20:26 2013 UTC
# Line 9  class rapport_instruction extends rappor Line 9  class rapport_instruction extends rappor
9      function rapport_instruction($id,&$db,$debug) {      function rapport_instruction($id,&$db,$debug) {
10          $this->constructeur($id,$db,$debug);          $this->constructeur($id,$db,$debug);
11      }// fin constructeur      }// fin constructeur
12        
13        // Modification du style de certains champs
14        function setType(&$form,$maj) {
15            parent::setType($form,$maj);
16            
17            // Numero de dossier d'instruction non modifiable
18            $form->setType('dossier_instruction', 'hiddenstatic');
19            
20            // Select pour le proposition de décision
21            $form->setType('proposition_decision', 'select');
22        }
23        
24        // Pré-remplir les champs
25        function setVal(&$form, $maj, $validation, &$db) {
26            
27            parent::setVal($form, $maj,$validation,$db);
28            
29            if($maj == 1) {
30                
31                // Analyse réglementaire
32                // Choisi par l'administrateur
33                $analyse_reglementaire = ( strstr($this->getVal('analyse_reglementaire'), $this->f->getParameter('rapport_instruction_analyse_reglementaire')) == FALSE )
34                    ? $this->getVal('analyse_reglementaire')."\n".$this->f->getParameter('rapport_instruction_analyse_reglementaire')
35                    : $this->getVal('analyse_reglementaire');
36                    
37                $form->setVal("analyse_reglementaire",$analyse_reglementaire);
38                
39                // Description du projet
40                // Libellé des travaux du dossier en cours
41                // Création de la requête
42                $sql = "SELECT
43                            travaux.libelle as libelle
44                        FROM
45                            ".DB_PREFIXE."dossier
46                        LEFT JOIN
47                            ".DB_PREFIXE."travaux
48                            ON
49                                dossier.travaux = travaux.travaux
50                        WHERE
51                            dossier.dossier = '".$this->getVal('dossier_instruction')."'";
52                            
53                // Exécution de la requête
54                $this->f->addToLog("setVal(): db->query(\"".$sql."\");", VERBOSE_MODE);
55                $res = $db->query($sql);
56                $this->f->isDatabaseError();
57                
58                while ($row=&$res->fetchrow(DB_FETCHMODE_ASSOC)){
59                    
60                    $description_projet = $this->getVal('description_projet');
61                    if ( $row['libelle'] != "" ){
62                        
63                        $description_projet .= ( strstr($this->getVal('description_projet'), $row['libelle']) == FALSE )
64                        ? "\n".$row['libelle']
65                        : "";
66                        
67                        $form->setVal("description_projet",$description_projet);
68                    }
69                }
70            }
71        }
72        
73        /*
74         * Select pour le proposition_decision
75         */
76        function setSelect(&$form, $maj,&$db,$debug) {
77            parent::setSelect($form, $maj,$db,$debug);
78            
79            // Lors d'un ajout ou d'une modification
80            if( $maj < 2 ){
81                
82                // proposition_decision
83                $contenu=array();
84    
85                $k = 0;
86                $contenu[0][$k]="";
87                $contenu[1][$k++]=_('choisir')." "._('proposition_decision');
88                
89                // Si le paramètre existe et a été remplie
90                if ( !is_null($this->f->getParameter('rapport_instruction_proposition_decision'))){
91                                
92                    $donnees = $this->f->getParameter('rapport_instruction_proposition_decision');
93                    $donnees = explode('<br />', nl2br(htmlentities($donnees)));
94                    
95                    // Pour chaque ligne du paramètre, faire une ligne dans le select
96                    foreach ($donnees as $value) {
97                    
98                        $contenu[0][$k]=$value;
99                        $contenu[1][$k++]=$value;
100                    }
101                }
102                $form->setSelect("proposition_decision",$contenu);
103                
104            }
105        }
106        
107        /**
108         * Surcharge du bouton retour afin de retourner sur le dossier d'instruction
109         */
110        function retour($premier = 0, $recherche = "", $tricol = "") {
111    
112            echo "\n<a class=\"retour\" ";
113            
114            echo "href=\"form.php?obj=dossier_instruction_mes_encours&amp;action=3&amp;idx="
115                .$this->getVal('dossier_instruction')."&amp;premier=$premier&amp;advs_id=".
116                "$advs_id&amp;recherche=$recherche&amp;tricol=$tricol&amp;selectioncol=".
117                "$selectioncol&amp;valide=$valide&amp;retour=tab";
118            //
119            echo "\"";
120            echo ">";
121            //
122            echo _("Retour");
123            //
124            echo "</a>\n";
125    
126        }
127    
128  }// fin classe  }// fin classe
129  ?>  ?>

Legend:
Removed from v.1154  
changed lines
  Added in v.1185

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26