Esempio n. 1
0
 /**
  * @ignore
  */
 function _tag_options($options = array())
 {
     $options = TagHelper::_parse_attributes($options);
     $html = '';
     foreach ($options as $key => $value) {
         $html .= ' ' . $key . '="' . $value . '"';
     }
     return $html;
 }
Esempio n. 2
0
 /**
  * Returns a form tag that will submit using XMLHttpRequest in the background
  * instead of the regular reloading POST arrangement. Even though it's using
  * JavaScript to serialize the form elements, the form submission will work
  * just like a regular submission as viewed by the receiving side
  * (all elements available in 'params'). The options for specifying the target
  * with 'url' and defining callbacks are the same as 'link_to_remote()'.
  *
  * A "fall-through" target for browsers that don't do JavaScript can be
  * specified with the 'action' and 'method' options on '$html_options'.
  *
  * Example:
  *   form_remote_tag(array(
  *     'url'      => 'tag_add',
  *     'update'   => 'question_tags',
  *     'loading'  => "Element.show('indicator'); tag.value = ''",
  *     'complete' => "Element.hide('indicator');".
  *                   visual_effect('highlight', 'question_tags')))
  *
  * The hash passed as a second argument is equivalent to the options (2nd)
  * argument in the form_tag() helper.
  *
  * @param type <description>
  *
  * @return type <description>
  */
 function form_remote_tag($options = array(), $html_options = array())
 {
     $options = TagHelper::_parse_attributes($options);
     $html_options = TagHelper::_parse_attributes($html_options);
     $options['form'] = TRUE;
     $html_options['onsubmit'] = PrototypeHelper::remote_function($options) . '; return false;';
     $html_options['action'] = isset($html_options['action']) ? $html_options['action'] : $options['url'];
     $html_options['method'] = isset($html_options['method']) ? $html_options['method'] : 'post';
     return TagHelper::tag('form', $html_options, TRUE);
 }