- Timestamp:
- 2012/01/23 04:49:37 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/smarty_extends/function.html_checkboxes_ex.php
r18234 r21420 49 49 $separator = ''; 50 50 $labels = true; 51 51 $label_ids = true; 52 52 $output = null; 53 53 … … 56 56 foreach($params as $_key => $_val) { 57 57 switch($_key) { 58 59 60 58 case 'tags': 59 $$_key = split("\|", $_val); 60 break; 61 61 case 'name': 62 62 case 'separator': … … 65 65 66 66 case 'labels': 67 67 case 'label_ids': 68 68 $$_key = (bool)$_val; 69 69 break; … … 129 129 130 130 function smarty_function_html_checkboxes_output_ex($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $tags) { 131 132 131 $_output = ''; 132 133 133 $_output .= '<input type="checkbox" name="' 134 134 . smarty_function_escape_special_chars($name) . '[]" value="' 135 135 . smarty_function_escape_special_chars($value) . '"'; 136 137 138 139 140 141 136 137 if ($labels && $label_ids) { 138 $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value)); 139 $_output .= ' id="' . $_id . '"'; 140 } 141 142 142 if (in_array((string)$value, $selected)) { 143 143 $_output .= ' checked="checked"'; 144 144 } 145 145 $_output .= $extra . ' />'; 146 147 148 149 150 151 152 153 154 $_output .= '<label>'; 155 156 157 158 159 160 161 162 146 147 $_output .= $tags[0]; 148 149 if ($labels) { 150 if($label_ids) { 151 $_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!', '_', $name . '_' . $value)); 152 $_output .= '<label for="' . $_id . '">'; 153 } else { 154 $_output .= '<label>'; 155 } 156 } 157 158 // 値を挿入 159 $_output .= $output; 160 161 $_output .= $tags[1]; 162 163 163 if ($labels) $_output .= '</label>'; 164 164 $_output .= $separator; … … 166 166 return $_output; 167 167 } 168 169 ?>
Note: See TracChangeset
for help on using the changeset viewer.