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