/[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 1260 - (show annotations)
Thu Feb 14 13:48:01 2013 UTC (11 years, 11 months ago) by nhaye
File size: 5639 byte(s)
Ajout du widget tableau

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 * Pour upload dans /tmp
22 *
23 * @param string $champ Nom du champ
24 * @param integer $validation
25 * @param boolean $DEBUG Parametre inutilise
26 */
27 function tmpUpload($champ, $validation, $DEBUG = false) {
28
29 //
30 echo "<input";
31 echo " type=\"text\"";
32 echo " name=\"".$champ."\"";
33 echo " id=\"".$champ."\" ";
34 echo " value=\"".$this->val[$champ]."\"";
35 echo " size=\"".$this->taille[$champ]."\"";
36 echo " maxlength=\"".$this->max[$champ]."\"";
37 echo " class=\"champFormulaire upload\"";
38 if (!$this->correct) {
39 if (isset($this->onchange) and $this->onchange[$champ] != "") {
40 echo " onchange=\"".$this->onchange[$champ]."\"";
41 }
42 if (isset($this->onkeyup) and $this->onkeyup[$champ] != "") {
43 echo " onkeyup=\"".$this->onkeyup[$champ]."\"";
44 }
45 if (isset($this->onclick) and $this->onclick[$champ] != "") {
46 echo " onclick=\"".$this->onclick[$champ]."\"";
47 }
48 } else {
49 echo " disabled=\"disabled\"";
50 }
51 echo " />\n";
52
53 //
54 if (!$this->correct) {
55 //
56 echo "<a class=\"upload ui-state-default ui-corner-all\" href=\"javascript:tmpUpload('".$champ."');\">";
57 echo "<span class=\"ui-icon ui-icon-arrowthickstop-1-s\" ";
58 echo "title=\""._("Cliquer ici pour telecharger un fichier depuis votre poste de travail")."\">";
59 echo _("Telecharger");
60 echo "</span>";
61 echo "</a>\n";
62 //
63 echo "<a class=\"voir ui-state-default ui-corner-all\" href=\"javascript:voir2('".$champ."');\">\n";
64 echo "<span class=\"ui-icon ui-icon-newwin\" ";
65 echo "title=\""._("Cliquer ici pour voir le fichier")."\">";
66 echo _("Voir");
67 echo "</span>";
68 echo "</a>\n";
69 }
70 }
71
72 function tmpUploadStatic($champ, $validation, $DEBUG = false) {
73 if(!empty($this->val[$champ])) {
74 echo "<a class=\"voir ui-state-default ui-corner-all\" href=\"javascript:file('".$this->val[$champ]."');\">\n";
75 echo "<span class=\"ui-icon ui-icon-newwin\" ";
76 echo "title=\""._("Cliquer ici pour voir le fichier")."\">";
77 echo _("Voir");
78 echo "</span>";
79 echo "</a>\n";
80 }
81 }
82
83 /**
84 * La valeur du champ est passe par le controle hidden
85 *
86 * @param string $champ Nom du champ
87 * @param integer $validation
88 * @param boolean $DEBUG Parametre inutilise
89 */
90 function referencescadastralesstatic($champ, $validation, $DEBUG = false) {
91
92 //
93 foreach (explode(';', $this->val[$champ]) as $key => $ref) {
94 echo "<span class=\"reference-cadastrale-".$key."\">";
95 echo $ref;
96 echo "</span>&nbsp";
97 }
98 }
99
100 /**
101 * Liste de données
102 *
103 * @param string $champ Nom du champ
104 * @param integer $validation
105 * @param boolean $DEBUG Parametre inutilise
106 */
107 function select_multiple_static($champ,$validation,$DEBUG = false){
108
109 $selected_values = explode(",", $this->val[$champ]);
110 //
111 echo "<ul";
112 echo " name=\"".$champ."[]\"";
113 echo " class=\"select_multiple_static\"";
114 if (!$this->correct) {
115 if (isset($this->onchange) and $this->onchange[$champ] != "") {
116 echo " onchange=\"".$this->onchange[$champ]."\"";
117 }
118 if (isset($this->onkeyup) and $this->onkeyup[$champ] != "") {
119 echo " onkeyup=\"".$this->onkeyup[$champ]."\"";
120 }
121 if (isset($this->onclick) and $this->onclick[$champ] != "") {
122 echo " onclick=\"".$this->onclick[$champ]."\"";
123 }
124 }
125 echo " >\n";
126 //
127 $k = 0;
128 foreach ($this->select[$champ] as $elem) {
129 while ($k <count($elem)) {
130 echo "<li> ";
131 echo $this->select[$champ][1][$k];
132 echo "</li>\n";
133 $k++;
134 }
135 }
136 //
137 echo "</ul>\n";
138 }
139
140 function tableau($champ,$validation,$DEBUG = false) {
141 echo "<table>";
142 echo "<tr>";
143 foreach ($this->select[$champ]["column_header"] as $value) {
144 echo "<th>";
145 echo $value;
146 echo "</th>";
147 }
148 echo "</tr>";
149
150 $k=0;
151 $keys = array_keys($this->select[$champ]["values"]);
152 $values = array_values($this->select[$champ]["values"]);
153 for ($i=0; $i<count($this->select[$champ]["row_header"]); $i++) {
154 echo "<tr>";
155 echo "<th>";
156 echo $this->select[$champ]["row_header"][$i];
157 echo "</th>";
158
159 for ($j=0; $j<count($this->select[$champ]["column_header"])-1; $j++) {
160 echo "<td>";
161 echo "<input value=\"{$values[$k]}\" name=\"{$keys[$k]}\"/>";
162 echo "</td>";
163 $k++;
164 }
165 echo "</tr>";
166 }
167 echo "</table>";
168 }
169 }
170
171 ?>

Properties

Name Value
svn:keywords Id

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26