Overview
Comment:Widget input select_groups fonctionnel
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 53ae33d9ff8a39e8c765dfcd51ca3d3e120fe61c
User & Date: bohwaz on 2020-04-22 02:17:04
Other Links: branch diff | manifest | tags
Context
2020-04-22
02:17
Version minimale de SQLite++ check-in: 2deff92b2c user: bohwaz tags: dev
02:17
Widget input select_groups fonctionnel check-in: 53ae33d9ff user: bohwaz tags: dev
02:16
Suppression du type dépense/recette pour un seul type "signet", car on saut déjà si c'est une charge ou produit avec la position check-in: f264c68657 user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Template.php from [1bd195df26] to [b064cf3755].

174
175
176
177
178
179
180

181
182
183
184
185
186
187
188
189
190
191
192
193
...
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
		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') {
................................................................................
		}
		elseif ($type == 'select_groups') {
			$out .= sprintf('<select %s>', $attributes);

			foreach ($options as $optgroup => $suboptions) {
				$out .= sprintf('<optgroup label="%s">', $this->escape($optgroup));

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

				$out .= '</optgroup>';
			}

			$out .= '</select>';







>




|
|







 







|







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
...
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
		if (isset($help)) {
			$out .= sprintf('<dd class="help">%s</dd>', $this->escape($help));
		}

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

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

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

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

		$out .= '<dd>';

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

			foreach ($options as $optgroup => $suboptions) {
				$out .= sprintf('<optgroup label="%s">', $this->escape($optgroup));

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

				$out .= '</optgroup>';
			}

			$out .= '</select>';