1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 08/08/2013 15:23 |
4 |
|
5 |
require_once ("../obj/om_dbform.class.php"); |
6 |
|
7 |
class blocnote_gen extends om_dbform { |
8 |
var $table="blocnote"; |
9 |
var $clePrimaire="blocnote"; |
10 |
var $typeCle="N"; |
11 |
var $required_field=array( |
12 |
"blocnote", |
13 |
"categorie", |
14 |
"note" |
15 |
); |
16 |
var $retourformulaire; |
17 |
|
18 |
function setvalF($val) { |
19 |
//affectation valeur formulaire |
20 |
if (!is_numeric($val['blocnote'])) { |
21 |
$this->valF['blocnote'] = ""; // -> requis |
22 |
} else { |
23 |
$this->valF['blocnote'] = $val['blocnote']; |
24 |
} |
25 |
$this->valF['categorie'] = $val['categorie']; |
26 |
$this->valF['note'] = $val['note']; |
27 |
if ($val['dossier'] == "") { |
28 |
$this->valF['dossier'] = NULL; |
29 |
} else { |
30 |
$this->valF['dossier'] = $val['dossier']; |
31 |
} |
32 |
} |
33 |
|
34 |
//================================================= |
35 |
//cle primaire automatique [automatic primary key] |
36 |
//================================================== |
37 |
|
38 |
function setId(&$db) { |
39 |
//numero automatique |
40 |
$this->valF[$this->clePrimaire] = $db->nextId(DB_PREFIXE.$this->table); |
41 |
} |
42 |
|
43 |
function setValFAjout($val) { |
44 |
//numero automatique -> pas de controle ajout cle primaire |
45 |
} |
46 |
|
47 |
function verifierAjout() { |
48 |
//numero automatique -> pas de verfication de cle primaire |
49 |
} |
50 |
|
51 |
//========================== |
52 |
// Formulaire [form] |
53 |
//========================== |
54 |
|
55 |
function setType(&$form,$maj) { |
56 |
//type |
57 |
if ($maj==0){ //ajout |
58 |
$form->setType('blocnote','hidden');// cle automatique |
59 |
$form->setType('categorie','text'); |
60 |
$form->setType('note','textarea'); |
61 |
|
62 |
if($this->retourformulaire=='dossier' |
63 |
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
64 |
$form->setType('dossier','selecthiddenstatic'); |
65 |
} else { |
66 |
$form->setType('dossier','select'); |
67 |
} |
68 |
}// fin ajout |
69 |
if ($maj==1){ //modifier |
70 |
$form->setType('blocnote','hiddenstatic'); |
71 |
$form->setType('categorie','text'); |
72 |
$form->setType('note','textarea'); |
73 |
|
74 |
if($this->retourformulaire=='dossier' |
75 |
and $form->val['dossier'] == $this->getParameter('idxformulaire')) { |
76 |
$form->setType('dossier','selecthiddenstatic'); |
77 |
} else { |
78 |
$form->setType('dossier','select'); |
79 |
} |
80 |
}// fin modifier |
81 |
if ($maj==2){ //supprimer |
82 |
$form->setType('blocnote','hiddenstatic'); |
83 |
$form->setType('categorie','hiddenstatic'); |
84 |
$form->setType('note','hiddenstatic'); |
85 |
$form->setType('dossier','selectstatic'); |
86 |
}//fin supprimer |
87 |
if ($maj==3){ //consulter |
88 |
$form->setType('blocnote','static'); |
89 |
$form->setType('categorie','static'); |
90 |
$form->setType('note','textareastatic'); |
91 |
$form->setType('dossier','selectstatic'); |
92 |
}//fin consulter |
93 |
} |
94 |
|
95 |
function setOnchange(&$form,$maj) { |
96 |
//javascript controle client |
97 |
$form->setOnchange('blocnote','VerifNum(this)'); |
98 |
} |
99 |
/** |
100 |
* Methode setTaille |
101 |
*/ |
102 |
function setTaille(&$form, $maj) { |
103 |
$form->setTaille("blocnote", 11); |
104 |
$form->setTaille("categorie", 20); |
105 |
$form->setTaille("note", 80); |
106 |
$form->setTaille("dossier", 30); |
107 |
} |
108 |
|
109 |
/** |
110 |
* Methode setMax |
111 |
*/ |
112 |
function setMax(&$form, $maj) { |
113 |
$form->setMax("blocnote", 11); |
114 |
$form->setMax("categorie", 20); |
115 |
$form->setMax("note", 6); |
116 |
$form->setMax("dossier", 30); |
117 |
} |
118 |
|
119 |
|
120 |
function setLib(&$form,$maj) { |
121 |
//libelle des champs |
122 |
$form->setLib('blocnote',_('blocnote')); |
123 |
$form->setLib('categorie',_('categorie')); |
124 |
$form->setLib('note',_('note')); |
125 |
$form->setLib('dossier',_('dossier')); |
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 |
// dossier |
135 |
$this->init_select($form, $db, $maj, $debug, "dossier", |
136 |
$sql_dossier, $sql_dossier_by_id, false); |
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 |
if($validation == 0) { |
146 |
if($retourformulaire =='dossier') |
147 |
$form->setVal('dossier', $idxformulaire); |
148 |
}// fin validation |
149 |
}// fin setValsousformulaire |
150 |
|
151 |
//================================== |
152 |
// cle secondaire [secondary key] |
153 |
//================================== |
154 |
|
155 |
}// fin classe |
156 |
?> |