Overview
Comment:Fix checkbox on multiple choice custom field
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: a9802955f1901aa8a3cb6759887152926b29d986
User & Date: bohwaz on 2020-12-05 20:37:39
Other Links: branch diff | manifest | tags
Context
2020-12-05
22:05
Add link to email address in proteger_contact modifier check-in: dd5595d3a9 user: bohwaz tags: dev, 1.0.0-rc7
20:37
Fix checkbox on multiple choice custom field check-in: a9802955f1 user: bohwaz tags: dev
18:00
Add print button to projects check-in: 07c7dcecff user: bohwaz tags: dev
Changes

Modified src/include/lib/Garradin/Template.php from [de91f325b0] to [963934d9e4].

650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667

			// Forcer la valeur à être un entier (depuis PHP 7.1)
			$value = (int)$value;

			foreach ($options as $k=>$v)
			{
				$b = 0x01 << (int)$k;
				$field .= '<label><input type="checkbox" name="' 
					. htmlspecialchars($params['name'], ENT_QUOTES, 'UTF-8') . '[' . (int)$k . ']" value="1" '
					. (($value & $b) ? 'checked="checked"' : '') . ' ' . $attributes . '/> ' 
					. htmlspecialchars($v, ENT_QUOTES, 'UTF-8') . '</label><br />';
			}
		}
		elseif ($type == 'textarea')
		{
			$field .= '<textarea ' . $attributes . 'cols="30" rows="5">' . htmlspecialchars($value, ENT_QUOTES) . '</textarea>';
		}
		else







|
<
|
<







650
651
652
653
654
655
656
657

658

659
660
661
662
663
664
665

			// Forcer la valeur à être un entier (depuis PHP 7.1)
			$value = (int)$value;

			foreach ($options as $k=>$v)
			{
				$b = 0x01 << (int)$k;
				$field .= sprintf('<input type="checkbox" name="%s[%d]" id="f_%1$s_%2$d" value="1" %s %s /> <label for="f_%1$s_%2$d">%s</label><br />',

					htmlspecialchars($params['name']), $k, ($value & $b) ? 'checked="checked"' : '', $attributes, htmlspecialchars($v));

			}
		}
		elseif ($type == 'textarea')
		{
			$field .= '<textarea ' . $attributes . 'cols="30" rows="5">' . htmlspecialchars($value, ENT_QUOTES) . '</textarea>';
		}
		else