1 |
<?php |
2 |
//$Id$ |
3 |
//gen openMairie le 28/06/2012 16:26 |
4 |
require_once ("../obj/om_dbform.class.php"); |
5 |
|
6 |
class nature_gen extends om_dbform { |
7 |
var $table="nature"; |
8 |
var $clePrimaire="nature"; |
9 |
var $typeCle="A"; |
10 |
var $retourformulaire; |
11 |
|
12 |
function setvalF($val) { |
13 |
//affectation valeur formulaire |
14 |
$this->valF['nature'] = $val['nature']; |
15 |
$this->valF['libelle'] = $val['libelle']; |
16 |
} |
17 |
|
18 |
//==================================== |
19 |
// verifier avant validation [verify] |
20 |
//===================================== |
21 |
/** |
22 |
* Methode verifier |
23 |
*/ |
24 |
function verifier($val = array(), &$db = NULL, $DEBUG = false) { |
25 |
// On appelle la methode de la classe parent |
26 |
parent::verifier($val, $db, $DEBUG); |
27 |
// On verifie si le champ n'est pas vide |
28 |
if ($this->valF['libelle'] == "") { |
29 |
$this->correct = false; |
30 |
$this->addToMessage(_("Le champ")." "._("libelle")." "._("est obligatoire")); |
31 |
} |
32 |
} |
33 |
|
34 |
|
35 |
//========================== |
36 |
// Formulaire [form] |
37 |
//========================== |
38 |
|
39 |
function setType(&$form,$maj) { |
40 |
//type |
41 |
if ($maj==0){ //ajout |
42 |
$form->setType('nature','text'); |
43 |
$form->setType('libelle','text'); |
44 |
}// fin ajout |
45 |
if ($maj==1){ //modifier |
46 |
$form->setType('nature','hiddenstatic'); |
47 |
$form->setType('libelle','text'); |
48 |
}// fin modifier |
49 |
if ($maj==2){ //supprimer |
50 |
$form->setType('nature','hiddenstatic'); |
51 |
$form->setType('libelle','hiddenstatic'); |
52 |
}//fin supprimer |
53 |
} |
54 |
|
55 |
function setOnchange(&$form,$maj) { |
56 |
//javascript controle client |
57 |
} |
58 |
/** |
59 |
* Methode setTaille |
60 |
*/ |
61 |
function setTaille(&$form, $maj) { |
62 |
$form->setTaille("nature", 10); |
63 |
$form->setTaille("libelle", 30); |
64 |
} |
65 |
|
66 |
/** |
67 |
* Methode setMax |
68 |
*/ |
69 |
function setMax(&$form, $maj) { |
70 |
$form->setMax("nature", 2); |
71 |
$form->setMax("libelle", 30); |
72 |
} |
73 |
|
74 |
|
75 |
function setLib(&$form,$maj) { |
76 |
//libelle des champs |
77 |
$form->setLib('nature',_('nature')); |
78 |
$form->setLib('libelle',_('libelle')); |
79 |
} |
80 |
|
81 |
//================================== |
82 |
// sous Formulaire [subform] |
83 |
//================================== |
84 |
|
85 |
function setValsousformulaire(&$form,$maj,$validation,$idxformulaire,$retourformulaire,$typeformulaire,&$db,$DEBUG=null){ |
86 |
$this->retourformulaire = $retourformulaire; |
87 |
}// fin setValsousformulaire |
88 |
|
89 |
//================================== |
90 |
// cle secondaire [secondary key] |
91 |
//================================== |
92 |
/** |
93 |
* Methode clesecondaire |
94 |
*/ |
95 |
function cleSecondaire($id, &$db = NULL, $val = array(), $DEBUG = false) { |
96 |
// On appelle la methode de la classe parent |
97 |
parent::cleSecondaire($id, $db, $val, $DEBUG); |
98 |
// Verification de la cle secondaire : travaux |
99 |
$this->rechercheTable($db, "travaux", "nature", $id); |
100 |
// Verification de la cle secondaire : bible |
101 |
$this->rechercheTable($db, "bible", "nature", $id); |
102 |
// Verification de la cle secondaire : evenement |
103 |
$this->rechercheTable($db, "evenement", "nature", $id); |
104 |
// Verification de la cle secondaire : dossier |
105 |
$this->rechercheTable($db, "dossier", "nature", $id); |
106 |
} |
107 |
|
108 |
|
109 |
}// fin classe |
110 |
?> |