public function render($name, $value = null, $attributes = array(), $errors = array()) { $size = isset($attributes['size']) ? $attributes['size'] : (isset($this->attributes['size']) ? $this->attributes['size'] : 10); $letters = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'); $text = '<div class="dcFinder">'; $id = $this->generateId($name); $id_left = $id . '_left'; $unassociated_name = 'unassociated_' . $id; $double_list = new sfWidgetFormSelectDoubleList(array('choices' => $this->getOption('choices'))); $double_list->setOptions($this->getOptions()); $custom_handler = $this->getOption('custom_handler'); $widget_serialized = base64_encode(serialize($double_list)); $text .= '<ul class="finder">'; foreach ($letters as $letter) { $text .= '<li>'; $text .= link_to_function($letter, remote_function(array('url' => '@dcWidgetFormSelectDoubleListFinderPropel', 'with' => "'?letter=" . $letter . "&size=" . $size . "&name=" . $unassociated_name . "&values=" . base64_encode(serialize($value)) . ($custom_handler ? "&custom_handler=" . base64_encode(serialize($custom_handler)) : '') . "&widget=" . $widget_serialized . "'", 'before' => "\$('{$id}_indicator').show(); dcFinder.setCurrent('{$id}', this);", 'complete' => "\$('{$id}_indicator').hide();", 'update' => $id_left))); $text .= '</li>'; } $text .= '<li class="current">'; $text .= link_to_function(__('All'), remote_function(array('url' => '@dcWidgetFormSelectDoubleListFinderPropel', 'with' => "'?letter=" . "&size=" . $size . "&values=" . base64_encode(serialize($value)) . ($custom_handler ? "&custom_handler=" . base64_encode(serialize($custom_handler)) : '') . "&name=" . $unassociated_name . "&widget=" . $widget_serialized . "'", 'update' => $id_left, 'before' => "\$('{$id}_indicator').show(); dcFinder.setCurrent('{$id}', this);", 'complete' => "\$('{$id}_indicator').hide();"))); $text .= '</li>'; $text .= '<li style="display: none;" id="' . $id . '_indicator">' . $this->getOption('loader') . '</li>'; $text .= '</ul>'; $this->addOption('template', <<<EOF <div class="%class%"> <div style="float: left"> <div class="double_list_label">%label_unassociated%</div> <div id="{$id_left}">%unassociated%</div> </div> <div style="float: left; margin-top: 2em"> %associate% <br /> %unassociate% </div> <div style="float: left"> <div class="double_list_label">%label_associated%</div> %associated% </div> <br style="clear: both" /> <script type="text/javascript"> sfDoubleList.init(document.getElementById('%id%'), '%class_select%'); </script> </div> EOF ); $text .= parent::render($name, $value, $attributes, $errors); $text .= '</div>'; return $text; }
function drop_receiving_element($element_id, $options = array()) { $obj =& get_instance(); $obj->response->enqueue_js(array('prototype', 'builder', 'effects', 'dragdrop')); if (!isset($options['with'])) { $options['with'] = "'id=' + encodeURIComponent(element.id)"; } if (!isset($options['onDrop'])) { $options['onDrop'] = "function(element){" . remote_function($options) . "}"; } foreach (get_ajax_options() as $key) { unset($options[$key]); } if (isset($options['accept'])) { $options['accept'] = _array_or_string_for_javascript($options['accept']); } if (isset($options['hoverclass'])) { $options['hoverclass'] = "'{$options['hoverclass']}'"; } return javascript_tag("Droppables.add('{$element_id}', " . _options_for_javascript($options) . ")"); }
<?php use_helper('Javascript'); echo javascript_tag(remote_function(array('update' => 'cuenta', 'url' => 'alumno/seleccionarCuenta?id=' . $id)));
function build_observer($class, $id, $options = array()) { if (isset($options['update']) && !isset($options['with'])) { $options['with'] = 'value'; } $callback = remote_function($options); $js = "new {$class}('{$id}', "; if (isset($options['frequency'])) { $js .= $options['frequency'] . ", "; } $js .= "function(element, value) {"; $js .= "{$callback}})"; return js_tag($js); }
/** * Paging html functions * @todo Document this API */ function pagination_limit_select($object_name_or_object, $options = array()) { $html = ""; if (is_object($object_name_or_object)) { $object = $object_name_or_object; } else { $object = $this->object($object_name_or_object); } if (!is_object($object)) { return null; } if ($object->pages > 0) { $base_url = isset($options['base_url']) ? $options['base_url'] : ''; $update = isset($options['update']) ? $options['update'] : ''; $extra_params = isset($options['extra_params']) ? "&" . $options['extra_params'] : ($object->paging_extra_params ? "&" . $object->paging_extra_params : ''); $default_text = isset($options['default_text']) ? $options['default_text'] : "per page:"; if ($update && $base_url) { $on_change = remote_function(array("update" => $update, "url" => "{$base_url}?per_page=' + this.options[this.selectedIndex].value + '" . escape_javascript($extra_params) . "'")); } else { $on_change = "document.location = '{$base_url}?per_page=' + this.options[this.selectedIndex].value + '" . escape_javascript($extra_params) . "'"; } $html .= "\n <select name=\"per_page\" onChange=\"{$on_change}\">\n <option value=\"{$object->rows_per_page}\" selected>{$default_text}</option>\n <option value=10>10</option>\n <option value=20>20</option>\n <option value=50>50</option>\n <option value=100>100</option>\n <option value=200>200</option>\n <option value=999999999>ALL</option>\n </select>\n "; } return $html; }
/** * Returns a button input tag that will submit form using XMLHttpRequest in the background instead of regular * reloading POST arrangement. The '$options' argument is the same as in 'jq_form_remote_tag()'. */ function jq_submit_to_remote($name, $value, $options = array(), $options_html = array()) { $options = _parse_attributes($options); $options_html = _parse_attributes($options_html); if (!isset($options['with'])) { $options['with'] = 'this.form.serialize()'; } $options_html['type'] = 'button'; $options_html['onclick'] = remote_function($options).'; return false;'; $options_html['name'] = $name; $options_html['value'] = $value; return tag('input', $options_html, false); }
</li> <?php } ?> </ul> </fieldset> <script lang="Javascript"> function cargarParametros(ver_tipo_parametro,eslista){ <?php if (Usuario::tienePermisos('parametros', 'listar_valor')) { ?> if (eslista) { <?php echo remote_function(array('url' => "parametros/listar_valor", 'with' => "'ver_tipo_parametro='+ver_tipo_parametro", 'complete' => visual_effect("Hightlight", "datosTipoParametro"))); ?> } <?php } ?> } </script>
<?php use_helper('I18N'); use_helper('Javascript'); ?> <span id="sf_countable_<?php echo $token; ?> "> <?php echo format_number_choice('[0]Never viewed|[1]Viewed one time|(1,+Inf]Viewed %1% times', array('%1%' => $counter), $counter); ?> </span> <?php if (!$sf_request->getCookie($token) == $token) { ?> <?php echo javascript_tag(remote_function(array('update' => 'sf_countable_' . $token, 'url' => '@sf_counter?sf_countable_token=' . $token))); }
<?php use_helper("Javascript"); $c = new Criteria(); $paises = PaisPeer::doSelect($c); if ($establecimiento->getFkProvinciaId()) { $pais_selected = $establecimiento->getProvincia()->getPais()->getId(); $provincia_id = $establecimiento->getFkProvinciaId(); } else { $pais_selected = $paises[0]->getId(); $provincia_id = 0; } echo select_tag('pais_id', objects_for_select(PaisPeer::getEnOrden(), 'getId', 'getNombreLargo', $pais_selected)); echo observe_field('pais_id', array('update' => 'item_provincia', 'url' => 'establecimiento/cambiarPais', 'with' => "'pais_id=' + value")); echo javascript_tag(remote_function(array('update' => 'item_provincia', 'url' => 'establecimiento/cambiarPais?pais_id=' . $pais_selected . '&provincia_id=' . $provincia_id)));
<?php if (!$nuevo) { ?> <li><a href="#" class="sf_admin_action_save" onclick="if (confirm('<?php echo __('Se dispone a guardar los datos como un objeto nuevo. ¿Estas seguro?'); ?> ')) {document.getElementById('guardarcomonuevo').value='1';tinyMCE.triggerSave();document.getElementById('formulario_guardar').onsubmit();}"><?php echo __("Guardar como nuevo"); ?> </a></li> <?php } ?> <li><a href="#" class="sf_admin_action_cancelar" onclick="if (confirm('<?php echo __('Va a cancelar todos los cambios que haya podido hacer, esta seguro de continuar?'); ?> ')) <?php echo remote_function(array('url' => 'parametros/nuevo_valor?ver_tipo_parametro=' . $DefParametro->getTipoParametro(), 'update' => 'datos_parametro')); ?> "><?php echo __("Cancelar"); ?> </a></li> <?php } ?> </ul> </div> <?php }
function hideLoginBtn() { document.getElementById('connectBtn').style.display="none"; document.getElementById('postLink').style.display="block"; } </script> <fb:login-button v="2" id="connectBtn" onlogin="******" size="medium">Connect</fb:login-button> <a href="javascript:;" id="postLink" onClick="postthis();" style="display:none;">Post On Wall</a> <script type="text/javascript"> function stream_callback (post_id, exception) { if(post_id!="null") { <?php echo remote_function(array('update' => 'message_success', 'url' => '@fbpost')); ?> //alert(post_id); document.getElementById('postLink').style.display='none'; document.getElementById('connectBtn').style.display='none'; document.getElementById('message_success').style.display='block' //FB.Connect.logout(alert("Thanks")); } } function postthis() { var message = 'Check out this cool site.'; var attachment = { 'name': 'JoTag', 'href': 'http://'+document.domain+'/jotag/web', 'description': 'Jotag is a simple method to share all your contact details. To keep in touch, just tell them your Jotag!',
public function configureJavascripts() { sfContext::getInstance()->getConfiguration()->loadHelpers(array("Url", "Javascript")); $student_id = $this->getObject()->getStudentId(); $this->getWidget('career_id')->setAttribute('onChange', remote_function(array('url' => 'student/updateCareerStudentStatus', 'with' => "'career_id=' + jQuery('#career_student_career_id').val() + '&student_id= {$student_id} '", 'script' => true, 'update' => 'javascript_div'))); }
<?php use_helper('I18N', 'Object', 'Javascript'); ?> <?php if ($sf_request->hasError('filters{id_fase}')) { ?> <?php echo form_error('filters{id_fase}', array('class' => 'form-error-msg')); } ?> <?php $value = select_tag('filters[id_fase]', objects_for_select($fases, 'getIdFase', 'getNombre', '', array('include_blank' => true), array('control_name' => 'filters[id_fase]'))); echo $value ? $value : ' '; ?> <?php echo observe_field('filters_id_fase', array('frequency' => 1, 'script' => 'true', 'update' => 'reuniones', 'url' => 'documentos/elegirfasefilters', 'with' => "'id_proyecto='+\$('filters_id_proyecto').value+'id_fase='+\$('filters_id_fase').value")); ?> <?php echo javascript_tag(remote_function(array('script' => 'true', 'update' => 'reuniones', 'url' => 'documentos/elegirfasefilters', 'with' => "'id_proyecto='+\$('filters_id_proyecto').value+'id_fase='+\$('filters_id_fase').value")));
/** * Replaces the remote_function function * * Adds the following options: * 'wrapperClass' : the class of the id that wraps the ajax loader html. * 'loadingHtml' : the html of the ajax_loader. The text '%%image%%' and '%%text%%' will be replaced. * 'loadingImage' : the image url of the ajax loader that will replace the %%image%% text inthe loadingHtml. * 'loadingText' : the text of the ajax loader that will replace the %%text%% text in the loadingHtml. * 'disableElements' : an array of ids to disable while loading and enable in complete. * 'hideElements' : an array of ids to hide while loading and show in complete. * * None of this options are required. See _custom_set_custom_options to see the defaults. */ function custom_remote_function($options) { _load_requirements(); _custom_set_custom_options($options); $loadingJavascript = _custom_get_loading_javascript($options); $completeJavascript = _custom_get_complete_javascript($options); _custom_concatenate_javascript($options, 'loading', $loadingJavascript); _custom_concatenate_javascript($options, 'complete', $completeJavascript); _custom_unset_custom_options($options); return remote_function($options); }
echo form_error('alcance{ver_todos_registros}', array('class' => 'form-error-msg')); ?> <?php } ?> <?php $value = checkbox_tag('alcance[ver_todos_registros]', '1', $alcance->getVerTodosRegistros(), array('control_name' => 'alcance[ver_todos_registros]')); echo $value ? $value : ' '; ?> <div class="sf_edit_help"><?php echo __('Si no marca esta opción el usuario solo podrá ver aquellos registros que haya creado'); ?> </div> </div> </div> </fieldset> <?php include_partial('alcance/edit_actions', array('alcance' => $alcance)); ?> </form> <?php echo javascript_tag("\n function recargar_selects()\n {\n var empresa = document.getElementById('alcance_id_empresa').value;\n \n " . remote_function(array('update' => 'grupo_selects', 'url' => 'alcance/update_selects', 'with' => "'id_empresa='+empresa")) . "\n }\n"); ?>
<?php use_helper('Object'); use_helper('Javascript'); ?> <span id="stateSelection"> <label for="title">State:</label> <?php echo select_tag('state', objects_for_select($states, 'getId', 'getName', $currentState), array('style' => 'width:150px', 'onchange' => remote_function(array('update' => 'citySelection', 'url' => 'users/getCities', 'with' => "'state=' + this.value", 'loading' => "Element.show('indicator')", 'complete' => "Element.hide('indicator')")))); ?> </span>
<?php if ($sf_request->hasError('concept_property{scheme_id}')) { ?> <?php echo form_error('concept_property{scheme_id}', array('class' => 'form-error-msg')); ?> <?php } ?> <?php $value = object_select_tag($concept_property, 'getSchemeId', array('related_class' => 'Vocabulary', 'include_blank' => false, 'control_name' => 'concept_property[scheme_id]', 'onchange' => remote_function(array('url' => '/concept/getConceptList', 'update' => 'form_row_content_concept_property_related_concept_id', 'loading' => "Element.update('form_row_content_concept_property_related_concept_id','Please wait...')", 'complete' => "\$('concept_property_related_concept_id').focus();", 'with' => "'selectedVocabularyId='+value", 'script' => 'true'))), $sf_flash->get('vocabID')); echo $value ? $value : ' ';
protected function getAjaxRemoteFunction($name, $value) { $refreshButtonId = $this->generateRefreshButtonId($name, $value); return remote_function(array('update' => $this->generateId($name, $value), 'script' => true, 'url' => 'dcFormExtraPlugin/mtWidgetFormAdderRefresh', 'complete' => "\$('" . $this->generateAjaxLoaderId($name, $value) . "').hide(); \$('" . $this->generateId($name, $value) . "').enable(); var but = \$('{$refreshButtonId}'); if (but.hasClassName('mtWidgetFormAdder_button_disabled')) but.removeClassName('mtWidgetFormAdder_button_disabled');", 'loading' => "\$('" . $this->generateAjaxLoaderId($name, $value) . "').show(); \$('" . $this->generateId($name, $value) . "').disable(); var but = \$('{$refreshButtonId}'); if (!but.hasClassName('mtWidgetFormAdder_button_disabled')) but.addClassName('mtWidgetFormAdder_button_disabled');", 'with' => "'peer_class=" . $this->getOption('peer_class') . "&peer_method=" . $this->getOption('peer_method') . "&value_method=" . $this->getOption('peer_value_method') . "&key_method=" . $this->getOption('peer_key_method') . "&" . dcFormExtraArrayToolkit::arrayToArrayedString('peer_params', $this->getOption('peer_params')) . "&add_empty=" . ($this->getOption('add_empty') ? 1 : 0) . "&selected=' + \$('" . $this->generateId($name, $value) . "').getValue()")); }
<?php use_helper('Javascript'); ?> <?php if ($sf_user->isAuthenticated()) { $choice = $sf_request->getParameter('module') . '/' . $sf_request->getParameter('action'); if ($choice == 'sfLucene/search') { echo button_to_remote(__('Save as feed'), array('url' => 'user/addFeed?q=' . $sf_params->get('query'), 'update' => 'msg-container', 'complete' => "window.alert(\$('msg-container').innerHTML);")); } else { if ($choice == 'tag/show') { echo button_to_remote(__('Save as feed'), array('url' => 'user/addFeed?q=tag: ' . $sf_params->get('tag'), 'update' => 'msg-container', 'complete' => "window.alert(\$('msg-container').innerHTML);")); } else { if ($choice == 'language/show') { echo button_to_remote(__('Save as feed'), array('url' => 'user/addFeed?q=languages:' . $sf_params->get('language'), 'update' => 'msg-container', 'complete' => "window.alert(\$('msg-container').innerHTML);")); } } } } ?> <?php echo label_for('search_size', __('Display') . ' '); echo select_tag('search_size', options_for_select(array('10' => '10', '20' => '20', '30' => '30', '40' => '40', '50' => '50'), $sf_user->getPreference('search_size')), array('onchange' => remote_function(array('url' => "@set_preference?pname=search_size", 'with' => ""pvalue=" + value", 'success' => 'window.location.reload();'))));
function _build_observer($klass, $name, $options = array()) { if (!isset($options['with']) && isset($options['update'])) { $options['with'] = 'value'; } $callback = remote_function($options); $javascript = 'new ' . $klass . '("' . $name . '", '; if (isset($options['frequency']) && $options['frequency'] > 0) { $javascript .= $options['frequency'] . ", "; } $javascript .= "function(element, value) {"; $javascript .= $callback . '});'; return javascript_tag($javascript); }
function select_empresas2($name, $option_tags = null, $options = array()) { $options = _parse_attributes($options); if (!isset($options['control_name'])) { $options['control_name'] = 'empresa[id_empresa]'; } if (!isset($options['control_name_tablas'])) { $options['control_name_tablas'] = 'tabla[id_tabla]'; } $include_custom = _get_option($options, 'include_custom'); $include_blank = _get_option($options, 'include_custom') ? 'true' : 'false'; $param_include_custom = isset($include_custom) && $include_custom != '' ? " + '&include_custom=' + " . $include_custom . "" : null; $id_select_empresa = get_id_from_name($options['control_name']); $id_select_tablas = get_id_from_name($options['control_name_tablas']); $select = select_tag($name, $option_tags, array('control_name' => $options['control_name'], 'onChange' => "recargar_tablas();")); $html = $select; $html .= "\n"; $js = "\n function recargar_tablas()\n {\n var empresa = document.getElementById('" . $id_select_empresa . "').value;\n " . remote_function(array('update' => $id_select_tablas, 'url' => 'empresas/update_select_tablas2', 'with' => "'id_empresa='+empresa + '&include_blank='+ " . $include_blank . "" . $param_include_custom . "")) . "\n }"; $html .= content_tag('script', $js, array('type' => 'text/javascript')); return $html; }
if ($snippet->getMC() == 'true') { ?> <?php echo image_tag('flag_blue.png', array('alt' => __('Managed Content'), 'title' => __('Managed Content'))); ?> <?php } ?> <br /> <?php echo snippet_posted_by($snippet, false); ?> </li> <?php } ?> </ol> <?php echo __('Show'); ?> : <?php echo select_tag('most', options_for_select(array('new' => 'New Snippets', 'high' => 'Highest Rated Snippets', 'disc' => 'Most Discussed Snippets'), $sf_params->get('most')), array('onchange' => "update_most();")); ?> <?php echo select_tag('most_size', options_for_select(array('5' => '5', '10' => '10', '15' => '15', '20' => '20', '25' => '25'), $sf_user->getPreference('box_snippets_size')), array('onchange' => remote_function(array('url' => "@set_preference?pname=box_snippets_size", 'with' => ""pvalue=" + value", 'success' => 'update_most();')))); ?> </div> </div> </div> </div>
<?php use_helper('Javascript'); $c = new Criteria(); $paises = PaisPeer::doSelect($c); if ($organizacion->getFkProvinciaId()) { $pais_selected = $organizacion->getProvincia()->getPais()->getId(); $provincia_id = $organizacion->getFkProvinciaId(); } else { $pais_selected = $paises[0]->getId(); $provincia_id = 0; } echo select_tag('pais_id', objects_for_select(PaisPeer::getEnOrden(), 'getId', 'getNombreLargo', $pais_selected)); echo observe_field('pais_id', array('update' => 'item_provincia', 'url' => 'organizacion/cambiarPais', 'with' => "'pais_id=' + value")); echo javascript_tag(remote_function(array('update' => 'item_provincia', 'url' => 'organizacion/cambiarPais?pais_id=' . $pais_selected . '&provincia_id=' . $provincia_id)));
<div class="form-row"> <label for="units">Unit Preference:</label> <?php echo radiobutton_tag('units[]', 'miles', $miles); ?> <label for="units">Miles</label> <?php echo radiobutton_tag('units[]', 'kilo', $kilo); ?> <label for="units">Kilometers</label> </div> <div class="form-row"> <label for="title">Country:</label> <?php echo select_tag('country', objects_for_select(CpCountriesPeer::getAllCountries(), 'getId', 'getName', $user->getUserProfile()->getCountry()), array('style' => 'width:150px', 'onchange' => remote_function(array('update' => 'stateSelection', 'url' => 'users/getStates', 'with' => "'country=' + this.value", 'loading' => "Element.show('indicator')", 'complete' => "document.getElementById('state').onchange(),Element.hide('indicator')")))); ?> <span id="stateSelection"></span> <span id="citySelection"></span> </div> <div class="submit-row"> <input type="submit" name="submit" value="save"/> <?php echo button_to('cancel', 'users/profile'); ?> </div> </form> </div>
<?php use_helper('Javascript', 'My'); ?> <div class="sidebox"> <div class="bottom"> <div class="content" id="tag_cloud_box"> <?php echo toggle('tags-hide', 'tag_cloud-up', 'tag_cloud-down', $sf_user->getPreference('box_tag_cloud') == 'none' ? 'down' : 'up', remote_function(array('url' => "@set_preference?pname=box_tag_cloud", 'with' => ""pvalue=" + \$('tag_cloud-up').style.display"))); ?> <?php echo image_tag('tags.gif'); ?> <div id="tags-hide"<?php echo $sf_user->getPreference('box_tag_cloud') == 'none' ? " style=display:none;" : ""; ?> > <ul class="tag_cloud few_tags"> <?php foreach ($tags as $tag) { ?> <li class="rank_<?php echo $tag['rank']; ?> "><?php echo link_to($tag['tag'], 'tag/show?tag=' . $tag['tag'], array('title' => __(":count snippet(s) with tag ':tag'", array(':count' => $tag['count'], ':tag' => $tag['tag'])))); ?> </li> <?php } ?>
<?php if ($sf_request->hasError('concept_property{scheme_id}')) { ?> <?php echo form_error('concept_property{scheme_id}', array('class' => 'form-error-msg')); ?> <?php } ?> <?php $value = object_select_tag($concept_property, 'getSchemeId', array('related_class' => 'Vocabulary', 'control_name' => 'concept_property[scheme_id]', 'onchange' => remote_function(array('url' => '/concept/getConceptList', 'update' => 'form_row_content_concept_property_related_concept_id', 'loading' => "Element.show('indicator');", 'complete' => "Element.hide('indicator');", 'with' => "'selectedVocabularyId='+value", 'script' => 'true')))); echo $value ? $value : ' ';