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