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