1 |
mbroquet |
3730 |
<?php |
2 |
softime |
6565 |
//$Id$ |
3 |
softime |
7996 |
//gen openMairie le 03/05/2018 09:18 |
4 |
mbroquet |
3730 |
|
5 |
|
|
require_once "../obj/om_dbform.class.php"; |
6 |
|
|
|
7 |
|
|
class blocnote_gen extends om_dbform { |
8 |
|
|
|
9 |
softime |
7996 |
protected $_absolute_class_name = "blocnote"; |
10 |
|
|
|
11 |
mbroquet |
3730 |
var $table = "blocnote"; |
12 |
|
|
var $clePrimaire = "blocnote"; |
13 |
|
|
var $typeCle = "N"; |
14 |
|
|
var $required_field = array( |
15 |
|
|
"blocnote", |
16 |
|
|
"categorie", |
17 |
|
|
"note" |
18 |
|
|
); |
19 |
|
|
|
20 |
|
|
var $foreign_keys_extended = array( |
21 |
softime |
6565 |
"dossier" => array("dossier", "dossier_instruction", "dossier_instruction_mes_encours", "dossier_instruction_tous_encours", "dossier_instruction_mes_clotures", "dossier_instruction_tous_clotures", "dossier_contentieux", "dossier_contentieux_mes_infractions", "dossier_contentieux_toutes_infractions", "dossier_contentieux_mes_recours", "dossier_contentieux_tous_recours", ), |
22 |
mbroquet |
3730 |
); |
23 |
softime |
7996 |
|
24 |
|
|
/** |
25 |
|
|
* |
26 |
|
|
* @return string |
27 |
|
|
*/ |
28 |
|
|
function get_default_libelle() { |
29 |
|
|
return $this->getVal($this->clePrimaire)." ".$this->getVal("categorie"); |
30 |
|
|
} |
31 |
mbroquet |
3730 |
|
32 |
softime |
7996 |
/** |
33 |
|
|
* |
34 |
|
|
* @return array |
35 |
|
|
*/ |
36 |
|
|
function get_var_sql_forminc__champs() { |
37 |
|
|
return array( |
38 |
|
|
"blocnote", |
39 |
|
|
"categorie", |
40 |
|
|
"note", |
41 |
|
|
"dossier", |
42 |
|
|
); |
43 |
|
|
} |
44 |
mbroquet |
3730 |
|
45 |
softime |
7996 |
/** |
46 |
|
|
* |
47 |
|
|
* @return string |
48 |
|
|
*/ |
49 |
|
|
function get_var_sql_forminc__sql_dossier() { |
50 |
|
|
return "SELECT dossier.dossier, dossier.annee FROM ".DB_PREFIXE."dossier ORDER BY dossier.annee ASC"; |
51 |
|
|
} |
52 |
mbroquet |
3730 |
|
53 |
softime |
7996 |
/** |
54 |
|
|
* |
55 |
|
|
* @return string |
56 |
|
|
*/ |
57 |
|
|
function get_var_sql_forminc__sql_dossier_by_id() { |
58 |
|
|
return "SELECT dossier.dossier, dossier.annee FROM ".DB_PREFIXE."dossier WHERE dossier = '<idx>'"; |
59 |
|
|
} |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
|
64 |
softime |
6929 |
function setvalF($val = array()) { |
65 |
mbroquet |
3730 |
//affectation valeur formulaire |
66 |
|
|
if (!is_numeric($val['blocnote'])) { |
67 |
|
|
$this->valF['blocnote'] = ""; // -> requis |
68 |
|
|
} else { |
69 |
|
|
$this->valF['blocnote'] = $val['blocnote']; |
70 |
|
|
} |
71 |
|
|
$this->valF['categorie'] = $val['categorie']; |
72 |
|
|
$this->valF['note'] = $val['note']; |
73 |
|
|
if ($val['dossier'] == "") { |
74 |
|
|
$this->valF['dossier'] = NULL; |
75 |
|
|
} else { |
76 |
|
|
$this->valF['dossier'] = $val['dossier']; |
77 |
|
|
} |
78 |
|
|
} |
79 |
|
|
|
80 |
|
|
//================================================= |
81 |
|
|
//cle primaire automatique [automatic primary key] |
82 |
|
|
//================================================== |
83 |
|
|
|
84 |
softime |
7685 |
function setId(&$dnu1 = null) { |
85 |
mbroquet |
3730 |
//numero automatique |
86 |
|
|
$this->valF[$this->clePrimaire] = $this->f->db->nextId(DB_PREFIXE.$this->table); |
87 |
|
|
} |
88 |
|
|
|
89 |
softime |
7685 |
function setValFAjout($val = array()) { |
90 |
mbroquet |
3730 |
//numero automatique -> pas de controle ajout cle primaire |
91 |
|
|
} |
92 |
|
|
|
93 |
softime |
7685 |
function verifierAjout($val = array(), &$dnu1 = null) { |
94 |
mbroquet |
3730 |
//numero automatique -> pas de verfication de cle primaire |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
//========================== |
98 |
|
|
// Formulaire [form] |
99 |
|
|
//========================== |
100 |
|
|
/** |
101 |
|
|
* |
102 |
|
|
*/ |
103 |
|
|
function setType(&$form, $maj) { |
104 |
|
|
// Récupération du mode de l'action |
105 |
|
|
$crud = $this->get_action_crud($maj); |
106 |
|
|
|
107 |
|
|
// MODE AJOUTER |
108 |
|
|
if ($maj == 0 || $crud == 'create') { |
109 |
|
|
$form->setType("blocnote", "hidden"); |
110 |
|
|
$form->setType("categorie", "text"); |
111 |
|
|
$form->setType("note", "textarea"); |
112 |
|
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire)) { |
113 |
|
|
$form->setType("dossier", "selecthiddenstatic"); |
114 |
|
|
} else { |
115 |
|
|
$form->setType("dossier", "select"); |
116 |
|
|
} |
117 |
|
|
} |
118 |
|
|
|
119 |
|
|
// MDOE MODIFIER |
120 |
|
|
if ($maj == 1 || $crud == 'update') { |
121 |
|
|
$form->setType("blocnote", "hiddenstatic"); |
122 |
|
|
$form->setType("categorie", "text"); |
123 |
|
|
$form->setType("note", "textarea"); |
124 |
|
|
if ($this->is_in_context_of_foreign_key("dossier", $this->retourformulaire)) { |
125 |
|
|
$form->setType("dossier", "selecthiddenstatic"); |
126 |
|
|
} else { |
127 |
|
|
$form->setType("dossier", "select"); |
128 |
|
|
} |
129 |
|
|
} |
130 |
|
|
|
131 |
|
|
// MODE SUPPRIMER |
132 |
|
|
if ($maj == 2 || $crud == 'delete') { |
133 |
|
|
$form->setType("blocnote", "hiddenstatic"); |
134 |
|
|
$form->setType("categorie", "hiddenstatic"); |
135 |
|
|
$form->setType("note", "hiddenstatic"); |
136 |
|
|
$form->setType("dossier", "selectstatic"); |
137 |
|
|
} |
138 |
|
|
|
139 |
|
|
// MODE CONSULTER |
140 |
|
|
if ($maj == 3 || $crud == 'read') { |
141 |
|
|
$form->setType("blocnote", "static"); |
142 |
|
|
$form->setType("categorie", "static"); |
143 |
|
|
$form->setType("note", "textareastatic"); |
144 |
|
|
$form->setType("dossier", "selectstatic"); |
145 |
|
|
} |
146 |
|
|
|
147 |
|
|
} |
148 |
|
|
|
149 |
|
|
|
150 |
|
|
function setOnchange(&$form, $maj) { |
151 |
|
|
//javascript controle client |
152 |
|
|
$form->setOnchange('blocnote','VerifNum(this)'); |
153 |
|
|
} |
154 |
|
|
/** |
155 |
|
|
* Methode setTaille |
156 |
|
|
*/ |
157 |
|
|
function setTaille(&$form, $maj) { |
158 |
|
|
$form->setTaille("blocnote", 11); |
159 |
|
|
$form->setTaille("categorie", 20); |
160 |
|
|
$form->setTaille("note", 80); |
161 |
|
|
$form->setTaille("dossier", 30); |
162 |
|
|
} |
163 |
|
|
|
164 |
|
|
/** |
165 |
|
|
* Methode setMax |
166 |
|
|
*/ |
167 |
|
|
function setMax(&$form, $maj) { |
168 |
|
|
$form->setMax("blocnote", 11); |
169 |
|
|
$form->setMax("categorie", 20); |
170 |
|
|
$form->setMax("note", 6); |
171 |
|
|
$form->setMax("dossier", 30); |
172 |
|
|
} |
173 |
|
|
|
174 |
|
|
|
175 |
|
|
function setLib(&$form, $maj) { |
176 |
|
|
//libelle des champs |
177 |
softime |
7996 |
$form->setLib('blocnote', __('blocnote')); |
178 |
|
|
$form->setLib('categorie', __('categorie')); |
179 |
|
|
$form->setLib('note', __('note')); |
180 |
|
|
$form->setLib('dossier', __('dossier')); |
181 |
mbroquet |
3730 |
} |
182 |
|
|
/** |
183 |
|
|
* |
184 |
|
|
*/ |
185 |
|
|
function setSelect(&$form, $maj, &$dnu1 = null, $dnu2 = null) { |
186 |
|
|
|
187 |
|
|
// dossier |
188 |
softime |
7996 |
$this->init_select( |
189 |
|
|
$form, |
190 |
|
|
$this->f->db, |
191 |
|
|
$maj, |
192 |
|
|
null, |
193 |
|
|
"dossier", |
194 |
|
|
$this->get_var_sql_forminc__sql("dossier"), |
195 |
|
|
$this->get_var_sql_forminc__sql("dossier_by_id"), |
196 |
|
|
false |
197 |
|
|
); |
198 |
mbroquet |
3730 |
} |
199 |
|
|
|
200 |
|
|
|
201 |
|
|
//================================== |
202 |
softime |
7685 |
// sous Formulaire |
203 |
mbroquet |
3730 |
//================================== |
204 |
|
|
|
205 |
|
|
|
206 |
softime |
7685 |
function setValsousformulaire(&$form, $maj, $validation, $idxformulaire, $retourformulaire, $typeformulaire, &$dnu1 = null, $dnu2 = null) { |
207 |
mbroquet |
3730 |
$this->retourformulaire = $retourformulaire; |
208 |
|
|
if($validation == 0) { |
209 |
|
|
if($this->is_in_context_of_foreign_key('dossier', $this->retourformulaire)) |
210 |
|
|
$form->setVal('dossier', $idxformulaire); |
211 |
|
|
}// fin validation |
212 |
|
|
$this->set_form_default_values($form, $maj, $validation); |
213 |
|
|
}// fin setValsousformulaire |
214 |
|
|
|
215 |
|
|
//================================== |
216 |
softime |
7685 |
// cle secondaire |
217 |
mbroquet |
3730 |
//================================== |
218 |
|
|
|
219 |
|
|
|
220 |
|
|
} |