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