Overview
Comment:Fix fonction input
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 1d5d060c5d3f8eab8bb8ecb509ad1d9b61046b4f
User & Date: bohwaz on 2020-04-20 01:02:49
Other Links: branch diff | manifest | tags
Context
2020-04-20
01:03
Suppression clés de config non utilisées check-in: 09e570ec23 user: bohwaz tags: dev
01:02
Fix fonction input check-in: 1d5d060c5d user: bohwaz tags: dev
2020-03-01
18:45
Exiger d'avoir PHP 7.2 avant toute chose check-in: d834be67ff user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Template.php from [dcc3b0aa03] to [f41e267c94].

165
166
167
168
169
170
171
172

173
174
175
176
177
178
179
180
181
182
183






184
185
186
187
188
189
190
191
192
193
194
195
196
197

198
199
200

201
202
203
204
205
206
207
165
166
167
168
169
170
171

172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

203
204
205

206
207
208
209
210
211
212
213







-
+











+
+
+
+
+
+













-
+


-
+








		if (isset($_POST[$name])) {
			$current_value = $_POST[$name];
		}

		$required_label = array_key_exists('required', $params) ? ' <b title="Champ obligatoire">(obligatoire)</b>' : '';

		$out .= sprintf('<dt><label for="f_%s">%s</label>%s</dt>', $name, $this->escape($label), $required_label);
		$out = sprintf('<dt><label for="f_%s">%s</label>%s</dt>', $name, $this->escape($label), $required_label);

		if (isset($help)) {
			$out .= sprintf('<dd class="help">%s</dd>', $this->escape($help));
		}

		$attributes = array_intersect_key($params, $keep_attributes);
		$attributes['id'] = 'f_' . $name;

		if (array_key_exists('required', $params)) {
			$attributes['required'] = 'required';
		}

		array_walk($attributes, function ($v, $k) {
			return sprintf('%s="%s"', $k, $v);
		});

		$attributes = implode(' ', $attributes);

		$out .= '<dd>';

		if ($type == 'select') {
			$out .= sprintf('<select %s>', $attributes);

			foreach ($options as $_key => $_value) {
				$out .= sprintf('<option value="%s"%s>%s</option>', $_key, $current_value == $_key ? ' selected="selected"' : '', $this->escape($_value));
			}

			$out .= '</select>';
		}
		elseif ($type == 'textarea') {
			$out .= sprintf('<textarea %s>%s</textarea>', $attributes, $this->escape($value));
			$out .= sprintf('<textarea %s>%s</textarea>', $attributes, $this->escape($current_value));
		}
		else {
			$out .= sprintf('<input type="%s" %s value="%s" />', $type, $attributes, $this->escape($value));
			$out .= sprintf('<input type="%s" %s value="%s" />', $type, $attributes, $this->escape($current_value));
		}

		$out .= '</dd>';

		return $out;
	}