1 |
<?php |
2 |
/** |
3 |
* Ce fichier est destine a permettre la surcharge de certaines methodes de |
4 |
* la classe om_dbform pour des besoins specifiques de l'application |
5 |
* |
6 |
* @package openmairie_exemple |
7 |
* @version SVN : $Id$ |
8 |
*/ |
9 |
|
10 |
/** |
11 |
* |
12 |
*/ |
13 |
require_once PATH_OPENMAIRIE."om_dbform.class.php"; |
14 |
|
15 |
/** |
16 |
* |
17 |
*/ |
18 |
require_once "om_formulaire.class.php"; |
19 |
|
20 |
/** |
21 |
* |
22 |
*/ |
23 |
class om_dbform extends dbForm { |
24 |
|
25 |
|
26 |
/** |
27 |
* Liste des métadonnées communes à l'ensemble des fichiers de l'application |
28 |
*/ |
29 |
var $metadata_global = array( |
30 |
"codeProduit" => "getCodeProduit", |
31 |
); |
32 |
/** |
33 |
* |
34 |
*/ |
35 |
var $om_formulaire = "om_formulaire"; |
36 |
|
37 |
/** |
38 |
* Retourne le code produit défini dans le paramétrage |
39 |
* @return string code produit (OpenADS) |
40 |
*/ |
41 |
protected function getCodeProduit() { |
42 |
return $this->f->getParameter("code_produit"); |
43 |
} |
44 |
|
45 |
// {{{ SURCHARGES DES LIBELLES DES BOUTONS |
46 |
|
47 |
/** |
48 |
* Cette methode permet d'afficher le bouton de validation du formulaire |
49 |
* |
50 |
* @param integer $maj Mode de mise a jour |
51 |
* @return void |
52 |
*/ |
53 |
function bouton($maj) { |
54 |
|
55 |
if (!$this->correct) { |
56 |
// |
57 |
if ($maj == 2) { |
58 |
$bouton = _("Supprimer"); |
59 |
} else { |
60 |
if ($maj == 1) { |
61 |
$bouton = _("Modifier"); |
62 |
} else { |
63 |
$bouton = _("Ajouter"); |
64 |
} |
65 |
} |
66 |
//// |
67 |
//$bouton .= " "._("l'enregistrement de la table")." :"; |
68 |
//$bouton .= " '"._($this->table)."'"; |
69 |
// |
70 |
$params = array( |
71 |
"value" => $bouton, |
72 |
"class" => "btn btn-primary", |
73 |
); |
74 |
// |
75 |
$this->f->layout->display_form_button($params); |
76 |
} |
77 |
|
78 |
} |
79 |
|
80 |
/** |
81 |
* |
82 |
*/ |
83 |
function boutonsousformulaire($datasubmit, $maj, $val=null) { |
84 |
|
85 |
if (!$this->correct) { |
86 |
// |
87 |
switch ($maj) { |
88 |
case 0: |
89 |
$bouton = _("Ajouter"); |
90 |
break; |
91 |
case 1: |
92 |
$bouton = _("Modifier"); |
93 |
break; |
94 |
case 2: |
95 |
$bouton = _("Supprimer"); |
96 |
break; |
97 |
} |
98 |
//// |
99 |
//$bouton .= " "._("l'enregistrement de la table")." :"; |
100 |
//$bouton .= " '"._($this->table)."'"; |
101 |
// |
102 |
$params = array( |
103 |
"class" => "", |
104 |
"value" => $bouton, |
105 |
"onclick" => "affichersform('".get_class($this)."', '$datasubmit', this.form);return false;", |
106 |
); |
107 |
// |
108 |
$this->f->layout->display_form_button($params); |
109 |
} |
110 |
|
111 |
} |
112 |
// }}} |
113 |
} |
114 |
|
115 |
?> |