Changeset 2743
- Timestamp:
- 11/17/06 18:01:24 (7 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfYUIPlugin/lib/helper/YUIConnectionHelper.php
r2738 r2743 133 133 } 134 134 135 /** 136 * Returns a link to a remote action defined by 'url' 137 * (using the 'url_for()' format). 138 * 139 * Example usage: 140 * 141 * <div id="results"></div> 142 * <?php echo yui_link_to_remote('Grab results', array( 143 * 'url' => 'results/fetch', 144 * 'success' => "function(o) { document.getElementById('results').innerHTML = o.responseText; }", 145 * 'failure' => "function(o) { alert('unable to fetch the data: ' + o.statusText); }", 146 * )) ?> 147 * 148 * @param string $name 149 * @param array $options 150 * @see link_to_function() 151 */ 152 function yui_link_to_remote($name, $options = array(), $html_options = array()) 153 { 154 $url = ''; 155 $method = 'GET'; 156 $callbacks = array(); 157 $postData = ''; 135 158 159 if (isset($options['method'])) 160 { 161 $method = $options['method']; 162 } 136 163 164 if (isset($options['url'])) 165 { 166 $url = $options['url']; 167 } 137 168 169 if (isset($options['success'])) 170 { 171 $callbacks['success'] = $options['success']; 172 } 173 174 if (isset($options['failure'])) 175 { 176 $callbacks['failure'] = $options['failure']; 177 } 138 178 179 if (isset($options['postData'])) 180 { 181 $postData = $options['postData']; 182 } 139 183 184 return link_to_function($name, yui_connection($method, $url, $callbacks, $postData), $html_options); 185 }