Ejemplo n.º 1
0
<?php

jq_add_plugin('jquery.form');
use_helper('Url');
?>

<div id="edit_dialog" style="display:none"></div>
<script type="text/javascript"> 
jQuery(document).ready(function() {
	jQuery('#edit_dialog').dialog({ 
	    autoOpen:false, 
	    title: '<?php 
echo __('Tartalom szerkesztése', array(), 'messages');
?>
', 
      minWidth: 600,  
	    modal: true,
	    buttons: {
	      Save: function() {
		      jQuery('.sf_admin_form form').ajaxForm({
            success: function(data){
		          jQuery('#edit_dialog').html(data);
		    	    <?php 
include_partial('afterDialogEdit');
?>
		        }
          });
          jQuery('.sf_admin_form form').submit();  
        },
	      Close: function() {
          jQuery('#edit_dialog').html('');
Ejemplo n.º 2
0
/**
 * wrapper for script.aculo.us/prototype Ajax.Autocompleter.
 * @author Bruno Adele <bruno.adele@jesuislibre.org>
 * @param string name value of input field
 * @param string default value for input field
 * @param array input tag options. (size, autocomplete, etc...)
 * @param array completion options. (use_style, etc...)
 *
 * Example:
 * echo jq_input_auto_complete_tag('q','', 'search/index',array(
 * 		'size' => 15),array(
 * 				'use_style' => false,
 * 				'scrollHeight' => 480,
 * 				'scroll' => false,
 * 				'highlight' => false,
 *		) ) ?>
 *
 * @return string input field tag, div for completion results, and
 *                 auto complete javascript tags
 */
function jq_input_auto_complete_tag($name, $value, $url, $tag_options = array(), $completion_options = array())
{
    // We need ui.autocomplete for this trick
    jq_add_plugin(sfConfig::get('jquery_autocomplete', 'jquery.autocomplete-1.0.2.min.js'));
    $tag_options = _convert_options($tag_options);
    $comp_options = _convert_options($completion_options);
    // Convert to JSON parameters
    $jsonOptions = '';
    foreach ($comp_options as $key => $val) {
        if ($jsonOptions != '') {
            $jsonOptions .= ', ';
        }
        switch ($key) {
            case 'formatItem':
            case 'formatResult':
                $jsonOptions .= "{$key}: " . $val;
                break;
            default:
                $jsonOptions .= "{$key}: " . json_encode($val);
                break;
        }
    }
    // Get Stylesheet
    $context = sfContext::getInstance();
    $response = $context->getResponse();
    $comp_options = _convert_options($completion_options);
    if (isset($comp_options['use_style']) && $comp_options['use_style'] == true) {
        $response->addStylesheet(sfConfig::get('sf_jquery_web_dir') . '/css/JqueryAutocomplete');
    }
    // Get Id from name attribute
    $tag_options['id'] = get_id_from_name(isset($tag_options['id']) ? $tag_options['id'] : $name);
    // Add input form
    $javascript = tag('input', array_merge(array('type' => 'text', 'name' => $name, 'value' => $value), _convert_options($tag_options)));
    // Calc JQuery Javascript code
    $autocomplete_script = sprintf('$("#%s").autocomplete("%s",{ %s	});', $name, $url, $jsonOptions);
    $javascript .= javascript_tag($autocomplete_script);
    return $javascript;
}
Ejemplo n.º 3
0
</td>
                <td>&nbsp;</td>
              </tr>
            <?php 
    }
    ?>
          <?php 
}
?>
          </tbody>
        </table>

      <div class="flash" id="feedback2"></div>

      <?php 
jq_add_plugin(sfConfig::get('jquery_sortable', 'jquery-ui-sortable-1.6rc6.min.js'));
?>
<script type="text/javascript">
//<![CDATA[
$(document).ready(
  function()
  {
    $("#ordered_statuses").sortable(
    {
      update: function(e, ui)
      {
        serial = $('#ordered_statuses').sortable('serialize', {});
        $("#feedback2").html('');
        $.ajax({
          url: <?php 
echo json_encode(url_for('idStatus/order'));