/[openfoncier]/trunk/obj/om_formulaire.class.php
ViewVC logotype

Contents of /trunk/obj/om_formulaire.class.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3335 - (show annotations)
Thu Mar 12 14:17:14 2015 UTC (9 years, 10 months ago) by nhaye
File size: 7047 byte(s)
Correction de l'affichage de multiples références cadastrales qui
dépassées du champ et empechées les actions depuis le menu contextuel

1 <?php
2 /**
3 * Ce fichier est destine a permettre la surcharge de certaines methodes de
4 * la classe om_formulaire 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_formulaire.class.php";
14
15 /**
16 *
17 */
18 class om_formulaire extends formulaire {
19
20 /**
21 * La valeur du champ est passe par le controle hidden
22 *
23 * @param string $champ Nom du champ
24 * @param integer $validation
25 * @param boolean $DEBUG Parametre inutilise
26 */
27 function referencescadastralesstatic($champ, $validation, $DEBUG = false) {
28
29 //
30 foreach (explode(';', $this->val[$champ]) as $key => $ref) {
31 echo "<span class=\"reference-cadastrale-".$key."\">";
32 echo $ref;
33 echo "</span> ";
34 }
35 }
36
37 function tableau($champ,$validation,$DEBUG = false) {
38 // Ouverture du tableau
39 echo "<table class='om-form-tab-table'>";
40
41 // Affichage des entêtes de colonnes
42 echo "<tr class='om-form-tab-tr'>";
43 foreach ($this->select[$champ]["column_header"] as $value) {
44 echo "<th";
45 // Si l'entête de colonne n'est pas vide
46 if($value != "") {
47 // Ajoute la classe à l'élément
48 echo " class='om-form-tab-th'";
49 }
50 echo ">";
51 //echo "<th class='om-form-tab-th'>";
52 echo $value;
53 echo "</th>";
54 }
55 echo "</tr>";
56
57 // Initialisation des variables
58 $k=0;
59 $keys = array_keys($this->select[$champ]["values"]);
60 $values = array_values($this->select[$champ]["values"]);
61
62 // Affichage de chaque ligne
63 for ($i=0; $i<count($this->select[$champ]["row_header"]); $i++) {
64 echo "<tr class='om-form-tab-tr'>";
65
66 // Affichage de l'entête de ligne
67 echo "<th";
68 // Si l'entête de ligne n'est pas vide
69 if($this->select[$champ]["row_header"][$i] != "") {
70 // Ajoute la classe à l'élément
71 echo " class='om-form-tab-th'";
72 }
73 echo ">";
74 echo $this->select[$champ]["row_header"][$i];
75 echo "</th>";
76
77 // Affichage des champs
78 for ($j=0; $j<count($this->select[$champ]["column_header"])-1; $j++) {
79 echo "<td class='om-form-tab-td'>";
80
81 // Appel de la méthode définie dans setType
82 if (method_exists($this, $this->type[$keys[$i+$j*count($this->select[$champ]["row_header"])]])) {
83 $function=$this->type[$keys[$i+$j*count($this->select[$champ]["row_header"])]];
84
85 $this->$function($keys[$i+$j*count($this->select[$champ]["row_header"])], $validation);
86 } else {
87 $this->statiq($keys[$i+$j*count($this->select[$champ]["row_header"])], $validation);
88 }
89 echo "</td>";
90 $k++;
91 }
92 echo "</tr>";
93 }
94 echo "</table>";
95 }
96
97 /**
98 * Au clique affiche un pop-up contenant le formulaire en ajout de l'objet $champ
99 * @param string $champ Nom du champ
100 * @param integer $validation
101 * @param boolean $DEBUG Parametre inutilise
102 */
103 function manage_with_popup($champ,$validation,$DEBUG = false){
104
105 //Si on a pas de valeur on affiche un bouton d'ajout
106 if ($this->val[$champ]==''){
107 printf ("<span class=\"om-form-button add-16 add_".$champ."\"
108 onclick=\"popupIt('".$champ."',
109 '../scr/sousform.php?obj=".$champ."&action=0'+
110 '&retourformulaire=".$this->getParameter('obj')."', 860, 'auto',
111 getObjId, '".$this->select[$champ]["obj"]."');\"".
112 ">");
113 printf(_("Saisir un(e) %s"),$champ);
114 printf ("</span>");
115 }
116 //On affiche les données enregistrées et un bouton de suppression
117 else {
118 //
119 printf ("<span class=\"om-form-button delete-16 add_".$champ."\"
120 onclick=\"setDataFrequent('','".$champ."');\"".
121 "title=\"");
122 printf(_("Supprimer"));
123 printf("\">");
124 printf("&nbsp;");
125 printf("</span>");
126 //
127
128 //
129 printf ("<span class=\"om-form-button edit-16 add_".$champ."\"
130 onclick=\"popupIt('".$champ."',
131 '../scr/sousform.php?obj=".$champ."&action=1&idx=".$this->val[$champ]."'+
132 '&retourformulaire=".$this->getParameter('obj')."', 860, 'auto',
133 getObjId, '".$this->select[$champ]["obj"]."');\"".
134 "title=\"");
135 printf(_("editer"));
136 printf("\">");
137 printf(isset($this->select[$champ]["data"])?$this->select[$champ]["data"]:_("Aucun libelle pour la donnee"));
138 printf("</span>");
139 }
140 //
141 printf ("<input");
142 printf (" type=\"hidden\"");
143 printf (" name=\"".$champ."\"");
144 printf (" id=\"".$champ."\" ");
145 printf (" value=\"".$this->val[$champ]."\"");
146 printf (" class=\"champFormulaire\"");
147 if (!$this->correct) {
148 if (isset($this->onchange) and $this->onchange[$champ] != "") {
149 printf (" onchange=\"".$this->onchange[$champ]."\"");
150 }
151 if (isset($this->onkeyup) and $this->onkeyup[$champ] != "") {
152 printf (" onkeyup=\"".$this->onkeyup[$champ]."\"");
153 }
154 if (isset($this->onclick) and $this->onclick[$champ] != "") {
155 printf (" onclick=\"".$this->onclick[$champ]."\"");
156 }
157 } else {
158 printf (" disabled=\"disabled\"");
159 }
160 printf (" />\n");
161 //
162 }
163
164 /**
165 * La valeur du champ est passé par le champ input hidden
166 * @param string $champ Nom du champ
167 * @param integer $validation
168 * @param boolean $DEBUG Parametre inutilise
169 */
170 function checkboxhiddenstatic($champ, $validation, $DEBUG = false) {
171
172 // Input de type hidden pour passé la valeur à la validation du
173 // formulaire
174 echo "<input";
175 echo " type=\"hidden\"";
176 echo " id=\"".$champ."\"";
177 echo " name=\"".$champ."\"";
178 echo " value=\"".$this->val[$champ]."\"";
179 echo " class=\"champFormulaire\"";
180 echo " />\n";
181
182 // Affichage de la valeur 'Oui' ou 'Non'
183 if ($this->val[$champ] == 1 || $this->val[$champ] == "t"
184 || $this->val[$champ] == "Oui") {
185 $value = "Oui";
186 } else {
187 $value = "Non";
188 }
189 echo "<span id=\"".$champ."\" class=\"field_value\">$value</span>";
190 }
191 }
192
193 ?>

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26