- Timestamp:
- 02/27/06 21:29:24 (3 years ago)
- Files:
-
- trunk/trax/vendor/trax/action_view/helpers.php (modified) (3 diffs)
- trunk/trax/vendor/trax/action_view/helpers/active_record_helper.php (modified) (1 diff)
- trunk/trax/vendor/trax/action_view/helpers/date_helper.php (modified) (3 diffs)
- trunk/trax/vendor/trax/action_view/helpers/form_helper.php (modified) (1 diff)
- trunk/trax/vendor/trax/action_view/helpers/javascript_helper.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/trax/vendor/trax/action_view/helpers.php
r148 r152 38 38 * 39 39 */ 40 function __construct() { 40 function __construct($object_name = null, $attribute_name = null) { 41 $this->object_name = $object_name; 42 $this->attribute_name = $attribute_name; 41 43 $this->controller_name = $GLOBALS['current_controller_name']; 42 44 $this->controller_path = $GLOBALS['current_controller_path']; … … 44 46 } 45 47 48 /** 49 * 50 */ 51 protected function value() { 52 if(!$value = $_REQUEST[$this->object_name][$this->attribute_name]) { 53 $object = $this->object(); 54 if(is_object($object) && $this->attribute_name) { 55 $value = $object->send($this->attribute_name); 56 } 57 } 58 return $value; 59 } 60 61 /** 62 * 63 */ 64 protected function object($object_name = null) { 65 $object_name = $object_name ? $object_name : $this->object_name; 66 if($object_name) { 67 return $this->controller_object->$object_name; 68 } 69 return null; 70 } 71 46 72 /** 47 73 * … … 121 147 return $html."\n"; 122 148 } 149 150 /** 151 * 152 */ 153 function to_content_tag($tag_name, $options = array()) { 154 return $this->content_tag($tag_name, $this->value(), $options); 155 } 123 156 124 157 } trunk/trax/vendor/trax/action_view/helpers/active_record_helper.php
r144 r152 273 273 * 274 274 */ 275 function object($object_name = null) {276 $object_name = $object_name ? $object_name : $this->object_name;277 if($object_name) {278 return $this->controller_object->$object_name;279 }280 }281 282 /**283 *284 */285 275 function tag_without_error_wrapping() { 286 276 $args = func_get_args(); trunk/trax/vendor/trax/action_view/helpers/date_helper.php
r144 r152 39 39 */ 40 40 function __construct($object_name = null, $attribute_name = null) { 41 parent::__construct(); 42 $this->object_name = $object_name; 43 $this->attribute_name = $attribute_name; 44 } 45 46 /** 47 * 48 */ 49 private function value() { 50 if(!$value = $this->check_request_for_value()) { 51 $object = $this->object(); 52 if(is_object($object) && $this->attribute_name) { 53 $value = $object->send($this->attribute_name); 54 } 55 } 56 return $value; 41 parent::__construct($object_name, $attribute_name); 57 42 } 58 43 … … 85 70 * 86 71 */ 87 private function object($object_name = null) {88 $object_name = $object_name ? $object_name : $this->object_name;89 return $this->controller_object->$object_name;90 }91 92 /**93 *94 */95 72 private function select_html($type, $options, $prefix = null, $include_blank = false, $discard_type = false) { 96 73 $select_html = "<select name=\"$prefix"; … … 112 89 private function leading_zero_on_single_digits($number) { 113 90 return $number > 9 ? $number : "0$number"; 91 } 92 93 /** 94 * 95 */ 96 protected function value() { 97 if(!$value = $this->check_request_for_value()) { 98 $object = $this->object(); 99 if(is_object($object) && $this->attribute_name) { 100 $value = $object->send($this->attribute_name); 101 } 102 } 103 return $value; 114 104 } 115 105 trunk/trax/vendor/trax/action_view/helpers/form_helper.php
r144 r152 39 39 */ 40 40 function __construct($object_name, $attribute_name) { 41 parent::__construct(); 42 $this->object_name = $object_name; 43 $this->attribute_name = $attribute_name; 41 parent::__construct($object_name, $attribute_name); 44 42 $this->default_field_options = $GLOBALS['DEFAULT_FIELD_OPTIONS'] ? $GLOBALS['DEFAULT_FIELD_OPTIONS'] : array("size" => 30); 45 43 $this->default_radio_options = $GLOBALS['DEFAULT_RADIO_OPTIONS'] ? $GLOBALS['DEFAULT_RADIO_OPTIONS'] : array(); 46 44 $this->default_text_area_options = $GLOBALS['DEFAULT_TEXT_AREA_OPTIONS'] ? $GLOBALS['DEFAULT_TEXT_AREA_OPTIONS'] : array("cols" => 40, "rows" => 20); 47 45 $this->default_date_options = $GLOBALS['DEFAULT_DATE_OPTIONS'] ? $GLOBALS['DEFAULT_DATE_OPTIONS'] : array(":discard_type" => true); 48 }49 50 /**51 *52 */53 function value() {54 if(!$value = $_REQUEST[$this->object_name][$this->attribute_name]) {55 $object = $this->object();56 if(is_object($object) && $this->attribute_name) {57 $value = $object->send($this->attribute_name);58 }59 }60 return $value;61 }62 63 /**64 *65 */66 function object($object_name = null) {67 $object_name = $object_name ? $object_name : $this->object_name;68 return $this->controller_object->$object_name;69 46 } 70 47 trunk/trax/vendor/trax/action_view/helpers/javascript_helper.php
r148 r152 47 47 } 48 48 49 pr ivatefunction options_for_javascript($options) {49 protected function options_for_javascript($options) { 50 50 $javascript = array(); 51 51 if(is_array($options)) { … … 115 115 } 116 116 return $callbacks; 117 } 118 119 private function remove_ajax_options($options) { 120 if(is_array($options)) { 121 $GLOBALS['ajax_options'] = $this->ajax_options; 122 foreach($options as $option_key => $option_value) { 123 if(!in_array($option_key, $this->ajax_options)) { 124 $new_options[$option_key] = $option_value; 125 } 126 } 127 if(is_array($new_options)) { 128 $options = $new_options; 129 } 130 } 131 return $options; 117 132 } 118 133 … … 503 518 $options['onUpdate'] = "function(){" . $this->remote_function($options) . "}"; 504 519 } 505 $options = array_filter($options, create_function('$value', 'return !in_array($value, $this->ajax_options);')); 506 520 $options = $this->remove_ajax_options($options); 507 521 foreach(array('tag', 'overlap', 'constraint', 'handle') as $option) { 508 522 if($options[$option]) { … … 552 566 $options['onUpdate'] = "function(element){" . $this->remote_function($options) . "}"; 553 567 } 554 $options = array_filter($options, create_function('$value', 'return !in_array($value, $this->ajax_options);')); 555 568 $options = $this->remove_ajax_options($options); 556 569 if($options['accept']) { 557 570 $options['accept'] = $this->array_or_string_for_javascript($options['accept']);

