1 |
fraynaud |
3 |
<?php |
2 |
|
|
//$Id$ |
3 |
|
|
//gen openMairie le 10/02/2011 20:31 |
4 |
|
|
require_once (PATH_OPENMAIRIE."formulairedyn.class.php"); |
5 |
|
|
require_once (PATH_OPENMAIRIE."dbformdyn.class.php"); |
6 |
|
|
|
7 |
|
|
class blocnote_gen extends dbForm { |
8 |
|
|
var $table="blocnote"; |
9 |
|
|
var $clePrimaire="blocnote"; |
10 |
|
|
var $typeCle="N"; |
11 |
|
|
var $retourformulaire; |
12 |
|
|
|
13 |
|
|
function setvalF($val) { |
14 |
|
|
//affectation valeur formulaire |
15 |
|
|
$this->valF['blocnote'] = $val['blocnote']; |
16 |
|
|
$this->valF['categorie'] = $val['categorie']; |
17 |
|
|
$this->valF['note'] = $val['note']; |
18 |
|
|
$this->valF['dossier'] = $val['dossier']; |
19 |
|
|
} |
20 |
|
|
|
21 |
|
|
//================================================= |
22 |
|
|
//cle primaire automatique [automatic primary key] |
23 |
|
|
//================================================== |
24 |
|
|
|
25 |
|
|
function setId(&$db) { |
26 |
|
|
//numero automatique |
27 |
|
|
$this->valF[$this->table] = $db->nextId(DB_PREFIXE.$this->table); |
28 |
|
|
} |
29 |
|
|
|
30 |
|
|
function setValFAjout($val) { |
31 |
|
|
//numero automatique -> pas de controle ajout cle primaire |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
function verifierAjout() { |
35 |
|
|
//numero automatique -> pas de verfication de cle primaire |
36 |
|
|
} |
37 |
|
|
|
38 |
|
|
//==================================== |
39 |
|
|
// verifier avant validation [verify] |
40 |
|
|
//===================================== |
41 |
|
|
|
42 |
|
|
function verifier($val,&$db,$DEBUG) { |
43 |
|
|
// verifier le 2eme champ si $verifier = 1 dans gen/dyn/form.inc |
44 |
|
|
$this->correct=True; |
45 |
|
|
$f=" ! "; |
46 |
fraynaud |
116 |
$imgv="<img src='../app/img/punaise.png' style='vertical-align:middle' hspace='2' border='0'>"; |
47 |
fraynaud |
3 |
if ($this->valF['categorie']==""){ |
48 |
|
|
$this->msg= $this->msg.$imgv._('categorie')." "._('obligatoire').$f; |
49 |
|
|
$this->correct=False; |
50 |
|
|
} |
51 |
|
|
} // fin verifier [end verify] |
52 |
|
|
|
53 |
|
|
//========================== |
54 |
|
|
// Formulaire [form] |
55 |
|
|
//========================== |
56 |
|
|
|
57 |
|
|
function setType(&$form,$maj) { |
58 |
|
|
//type |
59 |
|
|
if ($maj==0){ //ajout |
60 |
|
|
$form->setType('blocnote','hidden');// cle automatique |
61 |
|
|
$form->setType('categorie','text'); |
62 |
|
|
$form->setType('note','textarea'); |
63 |
|
|
if($this->retourformulaire=='dossier') |
64 |
|
|
$form->setType('dossier','hiddenstatic'); |
65 |
|
|
else |
66 |
|
|
$form->setType('dossier','select'); |
67 |
|
|
}// fin ajout |
68 |
|
|
if ($maj==1){ //modifier |
69 |
|
|
$form->setType('blocnote','hiddenstatic'); |
70 |
|
|
$form->setType('categorie','text'); |
71 |
|
|
$form->setType('note','textarea'); |
72 |
|
|
if($this->retourformulaire=='dossier') |
73 |
|
|
$form->setType('dossier','hiddenstatic'); |
74 |
|
|
else |
75 |
|
|
$form->setType('dossier','select'); |
76 |
|
|
}// fin modifier |
77 |
|
|
if ($maj==2){ //supprimer |
78 |
|
|
$form->setType('blocnote','hiddenstatic'); |
79 |
|
|
$form->setType('categorie','hiddenstatic'); |
80 |
|
|
$form->setType('note','hiddenstatic'); |
81 |
|
|
$form->setType('dossier','hiddenstatic'); |
82 |
|
|
}//fin supprimer |
83 |
|
|
} |
84 |
|
|
|
85 |
|
|
function setOnchange(&$form,$maj) { |
86 |
|
|
//javascript controle client |
87 |
|
|
$form->setOnchange('blocnote','VerifNum(this)'); |
88 |
|
|
} |
89 |
|
|
|
90 |
|
|
function setTaille(&$form,$maj) { |
91 |
|
|
//taille des champs affiches (text) |
92 |
|
|
$form->setTaille('blocnote',8); |
93 |
|
|
$form->setTaille('categorie',11); |
94 |
|
|
$form->setTaille('note',80); |
95 |
|
|
$form->setTaille('dossier',20); |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
function setMax(&$form,$maj) { |
99 |
|
|
//longueur max en saisie (text) |
100 |
|
|
$form->setMax('blocnote',8); |
101 |
|
|
$form->setMax('categorie',11); |
102 |
|
|
$form->setMax('note',6); |
103 |
|
|
$form->setMax('dossier',20); |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
function setLib(&$form,$maj) { |
107 |
|
|
//libelle des champs |
108 |
|
|
$form->setLib('blocnote',_('blocnote')); |
109 |
|
|
$form->setLib('categorie',_('categorie')); |
110 |
|
|
$form->setLib('note',_('note')); |
111 |
|
|
$form->setLib('dossier',_('dossier')); |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
115 |
|
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
116 |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
117 |
|
|
if($maj<2){ |
118 |
|
|
// dossier |
119 |
|
|
$contenu=array(); |
120 |
|
|
$res = $db->query($sql_dossier); |
121 |
|
|
if (database::isError($res)) |
122 |
|
|
die($res->getMessage().$sql_dossier); |
123 |
|
|
else{ |
124 |
|
|
if ($debug == 1) |
125 |
|
|
echo " la requete ".$sql_dossier." est executee<br>"; |
126 |
|
|
$contenu[0][0]=''; |
127 |
|
|
$contenu[1][0]=_('choisir')." "._('dossier'); |
128 |
|
|
$k=1; |
129 |
|
|
while ($row=& $res->fetchRow()){ |
130 |
|
|
$contenu[0][$k]=$row[0]; |
131 |
|
|
$contenu[1][$k]=$row[1]; |
132 |
|
|
$k++; |
133 |
|
|
} |
134 |
|
|
$form->setSelect('dossier',$contenu); |
135 |
|
|
}// fin error db |
136 |
|
|
}// fin maj |
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 |
|
|
?> |