1 |
<?php |
<?php |
2 |
//$Id$ |
//$Id$ |
3 |
//gen openMairie le 02/09/2011 11:08 |
//gen openMairie le 26/09/2012 10:15 |
|
require_once (PATH_OPENMAIRIE."dbformdyn.class.php"); |
|
4 |
|
|
5 |
class blocnote_gen extends dbForm { |
require_once ("../obj/om_dbform.class.php"); |
6 |
var $table="blocnote"; |
|
7 |
var $clePrimaire="blocnote"; |
class blocnote_gen extends om_dbform { |
8 |
var $typeCle="N"; |
var $table="blocnote"; |
9 |
var $retourformulaire; |
var $clePrimaire="blocnote"; |
10 |
|
var $typeCle="N"; |
11 |
function setvalF($val) { |
var $required_field=array( |
12 |
//affectation valeur formulaire |
"blocnote", |
13 |
$this->valF['blocnote'] = $val['blocnote']; |
"categorie", |
14 |
$this->valF['categorie'] = $val['categorie']; |
"note" |
15 |
$this->valF['note'] = $val['note']; |
); |
16 |
$this->valF['dossier'] = $val['dossier']; |
var $retourformulaire; |
17 |
} |
|
18 |
|
function setvalF($val) { |
19 |
//================================================= |
//affectation valeur formulaire |
20 |
//cle primaire automatique [automatic primary key] |
if(!is_numeric($val['blocnote'])) { |
21 |
//================================================== |
$this->valF['blocnote'] = ""; |
22 |
|
} else { |
23 |
function setId(&$db) { |
$this->valF['blocnote'] = $val['blocnote']; |
24 |
//numero automatique |
} |
25 |
$this->valF[$this->table] = $db->nextId(DB_PREFIXE.$this->table); |
$this->valF['categorie'] = $val['categorie']; |
26 |
} |
$this->valF['note'] = $val['note']; |
27 |
|
if($val['dossier'] == "") { |
28 |
function setValFAjout($val) { |
$this->valF['dossier'] = NULL; |
29 |
//numero automatique -> pas de controle ajout cle primaire |
} else { |
30 |
} |
$this->valF['dossier'] = $val['dossier']; |
31 |
|
} |
32 |
function verifierAjout() { |
} |
33 |
//numero automatique -> pas de verfication de cle primaire |
|
34 |
} |
//================================================= |
35 |
|
//cle primaire automatique [automatic primary key] |
36 |
//==================================== |
//================================================== |
37 |
// verifier avant validation [verify] |
|
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 verifier |
* Methode setTaille |
101 |
*/ |
*/ |
102 |
function verifier($val = array(), &$db = NULL, $DEBUG = false) { |
function setTaille(&$form, $maj) { |
103 |
// On appelle la methode de la classe parent |
$form->setTaille("blocnote", 11); |
104 |
parent::verifier($val, $db, $DEBUG); |
$form->setTaille("categorie", 20); |
105 |
// On verifie si le champ n'est pas vide |
$form->setTaille("note", 80); |
106 |
if ($this->valF['categorie'] == "") { |
$form->setTaille("dossier", 12); |
107 |
$this->correct = false; |
} |
108 |
$this->addToMessage(_("Le champ")." "._("categorie")." "._("est obligatoire")); |
|
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", 12); |
117 |
} |
} |
118 |
|
|
119 |
|
|
120 |
//========================== |
function setLib(&$form,$maj) { |
121 |
// Formulaire [form] |
//libelle des champs |
122 |
//========================== |
$form->setLib('blocnote',_('blocnote')); |
123 |
|
$form->setLib('categorie',_('categorie')); |
124 |
function setType(&$form,$maj) { |
$form->setLib('note',_('note')); |
125 |
//type |
$form->setLib('dossier',_('dossier')); |
126 |
if ($maj==0){ //ajout |
} |
127 |
$form->setType('blocnote','hidden');// cle automatique |
|
128 |
$form->setType('categorie','text'); |
function setSelect(&$form, $maj,&$db,$debug) { |
129 |
$form->setType('note','textarea'); |
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc.php")) |
130 |
if($this->retourformulaire=='dossier') |
include ("../sql/".$db->phptype."/".$this->table.".form.inc.php"); |
131 |
$form->setType('dossier','hiddenstatic'); |
elseif(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
132 |
else |
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
133 |
$form->setType('dossier','select'); |
|
134 |
}// fin ajout |
// dossier |
135 |
if ($maj==1){ //modifier |
$this->init_select($form, $db, $maj, $debug, "dossier", |
136 |
$form->setType('blocnote','hiddenstatic'); |
$sql_dossier, $sql_dossier_by_id, false); |
137 |
$form->setType('categorie','text'); |
}// fin select |
138 |
$form->setType('note','textarea'); |
|
139 |
if($this->retourformulaire=='dossier') |
//================================== |
140 |
$form->setType('dossier','hiddenstatic'); |
// sous Formulaire [subform] |
141 |
else |
//================================== |
142 |
$form->setType('dossier','select'); |
|
143 |
}// fin modifier |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
144 |
if ($maj==2){ //supprimer |
$this->retourformulaire = $retourformulaire; |
145 |
$form->setType('blocnote','hiddenstatic'); |
if($validation == 0) { |
146 |
$form->setType('categorie','hiddenstatic'); |
if($retourformulaire =='dossier') |
147 |
$form->setType('note','hiddenstatic'); |
$form->setVal('dossier', $idxformulaire); |
148 |
$form->setType('dossier','hiddenstatic'); |
}// fin validation |
149 |
}//fin supprimer |
}// fin setValsousformulaire |
150 |
} |
|
151 |
|
//================================== |
152 |
function setOnchange(&$form,$maj) { |
// cle secondaire [secondary key] |
153 |
//javascript controle client |
//================================== |
|
$form->setOnchange('blocnote','VerifNum(this)'); |
|
|
} |
|
|
|
|
|
function setTaille(&$form,$maj) { |
|
|
//taille des champs affiches (text) |
|
|
$form->setTaille('blocnote',4); |
|
|
$form->setTaille('categorie',20); |
|
|
$form->setTaille('note',80); |
|
|
$form->setTaille('dossier',20); |
|
|
} |
|
|
|
|
|
function setMax(&$form,$maj) { |
|
|
//longueur max en saisie (text) |
|
|
$form->setMax('blocnote',4); |
|
|
$form->setMax('categorie',20); |
|
|
$form->setMax('note',6); |
|
|
$form->setMax('dossier',20); |
|
|
} |
|
|
|
|
|
function setLib(&$form,$maj) { |
|
|
//libelle des champs |
|
|
$form->setLib('blocnote',_('blocnote')); |
|
|
$form->setLib('categorie',_('categorie')); |
|
|
$form->setLib('note',_('note')); |
|
|
$form->setLib('dossier',_('dossier')); |
|
|
} |
|
|
|
|
|
function setSelect(&$form, $maj,&$db,$debug) { |
|
|
if(file_exists ("../sql/".$db->phptype."/".$this->table.".form.inc")) |
|
|
include ("../sql/".$db->phptype."/".$this->table.".form.inc"); |
|
|
if($maj<2){ |
|
|
// dossier |
|
|
$contenu=array(); |
|
|
$res = $db->query($sql_dossier); |
|
|
if (database::isError($res)) |
|
|
die($res->getMessage().$sql_dossier); |
|
|
else{ |
|
|
if ($debug == 1) |
|
|
echo " la requete ".$sql_dossier." est executee<br>"; |
|
|
$contenu[0][0]=''; |
|
|
$contenu[1][0]=_('choisir')." "._('dossier'); |
|
|
$k=1; |
|
|
while ($row=& $res->fetchRow()){ |
|
|
$contenu[0][$k]=$row[0]; |
|
|
$contenu[1][$k]=$row[1]; |
|
|
$k++; |
|
|
} |
|
|
$form->setSelect('dossier',$contenu); |
|
|
}// fin error db |
|
|
}// fin maj |
|
|
}// fin select |
|
|
|
|
|
//================================== |
|
|
// sous Formulaire [subform] |
|
|
//================================== |
|
|
|
|
|
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
|
|
$this->retourformulaire = $retourformulaire; |
|
|
if($validation==0) { |
|
|
if($retourformulaire =='dossier') |
|
|
$form->setVal('dossier', $idxformulaire); |
|
|
}// fin validation |
|
|
}// fin setValsousformulaire |
|
|
|
|
|
//================================== |
|
|
// cle secondaire [secondary key] |
|
|
//================================== |
|
154 |
|
|
155 |
}// fin classe |
}// fin classe |
156 |
?> |
?> |