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