1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 19/09/2012 16:59 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class om_collectivite_gen extends om_dbform { |
8 |
var $table="om_collectivite"; |
9 |
var $clePrimaire="om_collectivite"; |
10 |
var $typeCle="N"; |
11 |
var $required_field=array( |
12 |
"om_collectivite", |
13 |
"libelle", |
14 |
"niveau" |
15 |
); |
16 |
var $retourformulaire; |
17 |
|
18 |
function setvalF($val) { |
19 |
//affectation valeur formulaire |
20 |
if(!is_numeric($val['om_collectivite'])) { |
21 |
unset($this->valF['om_collectivite']); |
22 |
} else { |
23 |
if($_SESSION['niveau']==1) { |
24 |
$this->valF['om_collectivite'] = $_SESSION['collectivite']; |
25 |
} else { |
26 |
$this->valF['om_collectivite'] = $val['om_collectivite']; |
27 |
} |
28 |
} |
29 |
$this->valF['libelle'] = $val['libelle']; |
30 |
$this->valF['niveau'] = $val['niveau']; |
31 |
} |
32 |
|
33 |
//================================================= |
34 |
//cle primaire automatique [automatic primary key] |
35 |
//================================================== |
36 |
|
37 |
function setId(&$db) { |
38 |
//numero automatique |
39 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
40 |
} |
41 |
|
42 |
function setValFAjout($val) { |
43 |
//numero automatique -> pas de controle ajout cle primaire |
44 |
} |
45 |
|
46 |
function verifierAjout() { |
47 |
//numero automatique -> pas de verfication de cle primaire |
48 |
} |
49 |
|
50 |
//========================== |
51 |
// Formulaire [form] |
52 |
//========================== |
53 |
|
54 |
function setType(&$form,$maj) { |
55 |
//type |
56 |
if ($maj==0){ //ajout |
57 |
$form->setType('om_collectivite','hidden');// cle automatique |
58 |
$form->setType('libelle','text'); |
59 |
$form->setType('niveau','text'); |
60 |
}// fin ajout |
61 |
if ($maj==1){ //modifier |
62 |
$form->setType('om_collectivite','hiddenstatic'); |
63 |
$form->setType('libelle','text'); |
64 |
$form->setType('niveau','text'); |
65 |
}// fin modifier |
66 |
if ($maj==2){ //supprimer |
67 |
$form->setType('om_collectivite','hiddenstatic'); |
68 |
$form->setType('libelle','hiddenstatic'); |
69 |
$form->setType('niveau','hiddenstatic'); |
70 |
}//fin supprimer |
71 |
if ($maj==3){ //consulter |
72 |
$form->setType('om_collectivite','static'); |
73 |
$form->setType('libelle','static'); |
74 |
$form->setType('niveau','static'); |
75 |
}//fin consulter |
76 |
} |
77 |
|
78 |
function setOnchange(&$form,$maj) { |
79 |
//javascript controle client |
80 |
$form->setOnchange('om_collectivite','VerifNum(this)'); |
81 |
} |
82 |
/** |
83 |
* Methode setTaille |
84 |
*/ |
85 |
function setTaille(&$form, $maj) { |
86 |
$form->setTaille("om_collectivite", 20); |
87 |
$form->setTaille("libelle", 30); |
88 |
$form->setTaille("niveau", 10); |
89 |
} |
90 |
|
91 |
/** |
92 |
* Methode setMax |
93 |
*/ |
94 |
function setMax(&$form, $maj) { |
95 |
$form->setMax("om_collectivite", 20); |
96 |
$form->setMax("libelle", 100); |
97 |
$form->setMax("niveau", 1); |
98 |
} |
99 |
|
100 |
|
101 |
function setLib(&$form,$maj) { |
102 |
//libelle des champs |
103 |
$form->setLib('om_collectivite',_('om_collectivite')); |
104 |
$form->setLib('libelle',_('libelle')); |
105 |
$form->setLib('niveau',_('niveau')); |
106 |
} |
107 |
|
108 |
function setVal(&$form,$maj,$validation,&$db,$DEBUG=null){ |
109 |
if($validation==0 and $maj==0 and $_SESSION['niveau']==1) { |
110 |
$form->setVal('om_collectivite', $_SESSION['collectivite']); |
111 |
}// fin validation |
112 |
}// fin setVal |
113 |
|
114 |
//================================== |
115 |
// sous Formulaire [subform] |
116 |
//================================== |
117 |
|
118 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
119 |
$this->retourformulaire = $retourformulaire; |
120 |
}// fin setValsousformulaire |
121 |
|
122 |
//================================== |
123 |
// cle secondaire [secondary key] |
124 |
//================================== |
125 |
/** |
126 |
* Methode clesecondaire |
127 |
*/ |
128 |
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
129 |
// On appelle la methode de la classe parent |
130 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
131 |
// Verification de la cle secondaire : om_utilisateur |
132 |
$this->rechercheTable($db, "om_utilisateur", "om_collectivite", $id); |
133 |
// Verification de la cle secondaire : om_parametre |
134 |
$this->rechercheTable($db, "om_parametre", "om_collectivite", $id); |
135 |
// Verification de la cle secondaire : om_etat |
136 |
$this->rechercheTable($db, "om_etat", "om_collectivite", $id); |
137 |
// Verification de la cle secondaire : om_sousetat |
138 |
$this->rechercheTable($db, "om_sousetat", "om_collectivite", $id); |
139 |
// Verification de la cle secondaire : om_lettretype |
140 |
$this->rechercheTable($db, "om_lettretype", "om_collectivite", $id); |
141 |
// Verification de la cle secondaire : om_widget |
142 |
$this->rechercheTable($db, "om_widget", "om_collectivite", $id); |
143 |
// Verification de la cle secondaire : om_sig_map |
144 |
$this->rechercheTable($db, "om_sig_map", "om_collectivite", $id); |
145 |
// Verification de la cle secondaire : om_sig_wms |
146 |
$this->rechercheTable($db, "om_sig_wms", "om_collectivite", $id); |
147 |
} |
148 |
|
149 |
|
150 |
}// fin classe |
151 |
?> |