Changeset 128 for trunk/trax/vendor/trax/action_view
- Timestamp:
- 02/05/06 23:31:53 (6 years ago)
- Location:
- trunk/trax/vendor/trax/action_view
- Files:
-
- 5 modified
-
helpers.php (modified) (1 diff)
-
helpers/active_record_helper.php (modified) (1 diff)
-
helpers/date_helper.php (modified) (2 diffs)
-
helpers/form_helper.php (modified) (5 diffs)
-
helpers/form_tag_helper.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/trax/vendor/trax/action_view/helpers.php
r120 r128 70 70 $url = array(); 71 71 if(is_string($options)) { 72 $url[] = $options; 72 //$url[] = $options; 73 return $options; 73 74 } else { 74 75 $url_base = $_SERVER['HTTP_HOST']; -
trunk/trax/vendor/trax/action_view/helpers/active_record_helper.php
r117 r128 299 299 300 300 function error_wrapping($html_tag, $has_error) { 301 return ($has_error ? '< div class="fieldWithErrors">' . $html_tag . '</div>' : $html_tag);301 return ($has_error ? '<span class="fieldWithErrors">' . $html_tag . '</span>' : $html_tag); 302 302 } 303 303 -
trunk/trax/vendor/trax/action_view/helpers/date_helper.php
r117 r128 225 225 $options = array_merge($defaults, $options); 226 226 $options_with_prefix = array(); 227 foreach($options as $option_key => $option_value) { 228 $options_with_prefix[$i++] = array_merge($options, array('prefix' => "{$this->object_name}[{$this->attribute_name}({$option_value}i)]")); 229 } 227 for($i=1; $i < 4 ; $i++) { 228 $options_with_prefix[$i] = array_merge($options, array('prefix' => "{$this->object_name}[{$this->attribute_name}({$i}i)]")); 229 } 230 230 231 if($options['include_blank']) { 231 232 $value = $this->value(); … … 252 253 foreach($options['order'] as $param) { 253 254 if(!$discard[$param]) { 254 $args = array($date, ); 255 $date_select[] = call_user_func(array($this, "select_$param"), $date, $options_with_prefix[$position[$param]]); 255 $date_select .= call_user_func(array($this, "select_$param"), $date, $options_with_prefix[$position[$param]]); 256 256 } 257 257 } -
trunk/trax/vendor/trax/action_view/helpers/form_helper.php
r117 r128 93 93 } 94 94 $options = $this->add_default_name_and_id($options); 95 return $this-> tag("input", $options);95 return $this->error_wrapping($this->tag("input", $options),$this->object()->errors[$this->attribute_name]); 96 96 } 97 97 … … 108 108 "{$this->object_name}_{$this->attribute_name}_{$pretty_tag_value}"; 109 109 $options = $this->add_default_name_and_id($options); 110 return $this-> tag("input", $options);110 return $this->error_wrapping($this->tag("input", $options),$this->object()->errors[$this->attribute_name]); 111 111 } 112 112 … … 114 114 $options = array_merge($this->default_text_area_options, $options); 115 115 $options = $this->add_default_name_and_id($options); 116 return $this-> content_tag("textarea", htmlspecialchars($this->value()), $options);116 return $this->error_wrapping($this->content_tag("textarea", htmlspecialchars($this->value()), $options),$this->object()->errors[$this->attribute_name]); 117 117 } 118 118 … … 144 144 145 145 $options = $this->add_default_name_and_id($options); 146 return $this-> tag("input", $options) . $this->tag("input", array("name" => $options["name"], "type" => "hidden", "value" => $unchecked_value));146 return $this->error_wrapping($this->tag("input", $options) . $this->tag("input", array("name" => $options["name"], "type" => "hidden", "value" => $unchecked_value)),$this->object()->errors[$this->attribute_name]); 147 147 } 148 148 149 149 function to_boolean_select_tag($options = array()) { 150 150 $options = $this->add_default_name_and_id($options); 151 $tag_text = "<select ";151 $tag_text = "<select "; 152 152 $tag_text .= $this->tag_options($options); 153 153 $tag_text .= ">\n"; 154 154 $tag_text .= "<option value=\"0\""; 155 if( !$this->value() == false) {155 if($this->value() == false) { 156 156 $tag_text .= " selected"; 157 157 } … … 163 163 $tag_text .= ">True</option>\n"; 164 164 $tag_text .= "</select>\n"; 165 return $tag_text; 166 } 165 return $this->error_wrapping($tag_text,$this->object()->errors[$this->attribute_name]);; 166 } 167 168 function error_wrapping($html_tag, $has_error) { 169 return ($has_error ? '<span class="fieldWithErrors">' . $html_tag . '</span>' : $html_tag); 170 } 167 171 168 172 } -
trunk/trax/vendor/trax/action_view/helpers/form_tag_helper.php
r117 r128 43 43 44 44 function form_tag($url_for_options = array(), $options = array(), $parameters_for_url = array()) { 45 $html_options = array_merge( $options, array("method" => "post"));45 $html_options = array_merge(array("method" => "post"), $options); 46 46 47 if( isset($html_options['multipart'])) {47 if($html_options['multipart']) { 48 48 $html_options['enctype'] = "multipart/form-data"; 49 49 unset($html_options['multipart']); … … 91 91 function check_box_tag($name, $value = "1", $checked = false, $options = array()) { 92 92 $html_options = array_merge(array("type" => "checkbox", "name" => $name, "id" => $name, "value" => $value), $this->convert_options($options)); 93 if ( isset($checked)) $html_options["checked"] = "checked";93 if ($checked) $html_options["checked"] = "checked"; 94 94 return $this->tag("input", $html_options); 95 95 } … … 97 97 function radio_button_tag($name, $value, $checked = false, $options = array()) { 98 98 $html_options = array_merge(array("type" => "radio", "name" => $name, "id" => $name, "value" => $value), $this->convert_options($options)); 99 if ( isset($checked)) $html_options["checked"] = "checked";99 if ($checked) $html_options["checked"] = "checked"; 100 100 return $this->tag("input", $html_options); 101 101 }
