Changeset 1433
- Timestamp:
- 06/13/06 14:23:05 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/generator/sfPropelAdmin/default/template/templates/editSuccess.php
r1348 r1433 54 54 <?php endif; ?> 55 55 <div class="form-row"> 56 <label <?php if ($column->isNotNull()): ?>class="required" <?php endif; ?>for="<?php echo $this->getSingularName() ?>[<?php echo $column->getName() ?>]">[?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')) ?>:') ?]</label>56 [?php echo label_for('<?php echo $this->getSingularName() ?>[<?php echo $column->getName() ?>]', __('<?php echo str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')) ?>:'), '<?php if ($column->isNotNull()): ?>class="required" <?php endif; ?>') ?] 57 57 <div class="content[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]"> 58 58 [?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] trunk/lib/helper/FormHelper.php
r1432 r1433 67 67 foreach ($options as $key => $value) 68 68 { 69 if (is_array($value))70 {71 $optgroup_html_options = $html_options;72 unset($optgroup_html_options['include_custom']);73 unset($optgroup_html_options['include_blank']);74 $html .= content_tag('optgroup', options_for_select($value, $selected, $optgroup_html_options), array('label' => $key));75 }76 else77 {69 if (is_array($value)) 70 { 71 $optgroup_html_options = $html_options; 72 unset($optgroup_html_options['include_custom']); 73 unset($optgroup_html_options['include_blank']); 74 $html .= content_tag('optgroup', options_for_select($value, $selected, $optgroup_html_options), array('label' => $key)); 75 } 76 else 77 { 78 78 $option_options = array('value' => $key); 79 79 80 80 if ( 81 81 isset($selected) … … 90 90 91 91 $html .= content_tag('option', $value, $option_options)."\n"; 92 }92 } 93 93 } 94 94 … … 133 133 } 134 134 135 return content_tag('select', $option_tags, array_merge(array('name' => $name, 'id' => $id), $options));135 return content_tag('select', $option_tags, array_merge(array('name' => $name, 'id' => get_name_from_id($id)), $options)); 136 136 } 137 137 … … 184 184 function input_tag($name, $value = null, $options = array()) 185 185 { 186 return tag('input', array_merge(array('type' => 'text', 'name' => $name, 'id' => $name, 'value' => $value), _convert_options($options)));186 return tag('input', array_merge(array('type' => 'text', 'name' => $name, 'id' => get_name_from_id($name, $value), 'value' => $value), _convert_options($options))); 187 187 } 188 188 … … 313 313 return 314 314 content_tag('script', javascript_cdata_section($tinymce_js), array('type' => 'text/javascript')). 315 content_tag('textarea', $content, array_merge(array('name' => $name, 'id' => $id), _convert_options($options)));315 content_tag('textarea', $content, array_merge(array('name' => $name, 'id' => get_name_from_id($id, $value)), _convert_options($options))); 316 316 } 317 317 elseif ($rich === 'fck') … … 372 372 else 373 373 { 374 return content_tag('textarea', (is_object($content)) ? $content->__toString() : $content, array_merge(array('name' => $name, 'id' => $id), _convert_options($options)));374 return content_tag('textarea', (is_object($content)) ? $content->__toString() : $content, array_merge(array('name' => $name, 'id' => get_name_from_id($id, null)), _convert_options($options))); 375 375 } 376 376 } … … 378 378 function checkbox_tag($name, $value = '1', $checked = false, $options = array()) 379 379 { 380 $html_options = array_merge(array('type' => 'checkbox', 'name' => $name, 'id' => $name, 'value' => $value), _convert_options($options));380 $html_options = array_merge(array('type' => 'checkbox', 'name' => $name, 'id' => get_name_from_id($name, $value), 'value' => $value), _convert_options($options)); 381 381 if ($checked) $html_options['checked'] = 'checked'; 382 382 … … 386 386 function radiobutton_tag($name, $value, $checked = false, $options = array()) 387 387 { 388 $html_options = array_merge(array('type' => 'radio', 'name' => $name, ' value' => $value), _convert_options($options));388 $html_options = array_merge(array('type' => 'radio', 'name' => $name, 'id' => get_name_from_id($name, $value), 'value' => $value), _convert_options($options)); 389 389 if ($checked) $html_options['checked'] = 'checked'; 390 390 … … 935 935 } 936 936 937 function label_for($id, $label, $options = array()) 938 { 939 $options = _parse_attributes($options); 940 941 return content_tag('label', $label, array_merge(array('for' => get_name_from_id($id, null)), $options)); 942 } 943 944 function get_name_from_id($name, $value = null) 945 { 946 // check to see if we have an array variable for a field name 947 if (strstr($name, '[')) 948 { 949 $name = str_replace( 950 array('[]', '][', '[', ']'), 951 array((($value != null) ? '_'.$value : ''), '_', '_', ''), 952 $name 953 ); 954 } 955 956 return $name; 957 } 958 937 959 function _add_zeros($string, $strlen) 938 960 {