Example #1
0
echo input_hidden_tag('page', $sf_params->get('page'));
include_partial($oAppCommon->ssRenderListFileName, array('oAppCommon' => $oAppCommon, 'snCount' => $snCount));
?>
<br />
<div class="menu"><?php 
if ($oAppCommon->ssShowDeleteButton && $snCount > 0) {
    echo button_to_function(__('Delete'), "if(deleteAll(document.frmList,'" . $oAppCommon->ssTitle . "','','" . __("Are you sure, you want to delete selected %sstitle%?", array('%sstitle%' => $oAppCommon->ssTitle)) . "','" . __("Select Atleast One Item") . "'))" . jq_remote_function(array('url' => $oAppCommon->ssLink . (strstr($oAppCommon->ssLink, '?') ? "&" : "?") . "ssAction=delete", 'update' => $oAppCommon->ssDivId, 'with' => 'jQuery(this.form.elements).serialize()')), array('id' => 'delete', 'name' => __("Delete"), 'title' => __('Delete')));
}
?>
</div>
<div class="menu"><?php 
if ($oAppCommon->ssShowCreateButton) {
    echo link_to_function(__('Create'), 'document.frmList.action = "' . url_for($oAppCommon->ssModuleName . "/addEdit") . '";document.frmList.submit();', array('title' => __('Create')));
}
?>

</div>
<!--Shows send Button at bootom  -->
<div class="menu"><?php 
if ($oAppCommon->ssShowSendButton) {
    echo button_to_function(__('Send'), "if(deleteAll(document.frmList,'" . $oAppCommon->ssTitle . "','','" . __("Are you sure, you want to Send Newsletter %sstitle%?", array('%sstitle%' => $oAppCommon->ssTitle)) . "','" . __("Select Atleast One Item") . "'))" . jq_remote_function(array('url' => $oAppCommon->ssLink . (strstr($oAppCommon->ssLink, '?') ? "&" : "?") . "ssAction=send", 'update' => $oAppCommon->ssDivId, 'with' => 'jQuery(this.form.elements).serialize()')), array('id' => 'send', 'name' => __("Send"), 'title' => __('Send')));
}
?>
</div>
<!--End Shows -->
<?php 
if ($oAppCommon->ssButtonMenu && $snCount > 0 || $oAppCommon->ssButtonMenu && $sf_params->get('module') == 'accounthistory' && $sf_params->get('money') == 'In') {
    include_partial('global/buttonMenu');
}
?>
</form>
Example #2
0
/**
 * Makes the element with the DOM ID specified by '$element_id' receive
 * dropped draggable elements (created by 'draggable_element()') and make an AJAX call.
 * By default, the action called gets the DOM ID of the element as parameter.
 *
 * Example:
 *   <?php drop_receiving_element('my_cart', array(
 *      'url' => 'cart/add',
 *   )) ?>
 *
 * You can change the behaviour with various options, see
 * http://script.aculo.us for more documentation.
 */
function jq_drop_receiving_element($selector, $options = array())
{
    jq_add_plugins_by_name(array("ui"));
    if (!isset($options['with'])) {
        $options['with'] = "'id=' + encodeURIComponent(element.id)";
    }
    if (!isset($options['drop'])) {
        $options['drop'] = "function(element){" . jq_remote_function($options) . "}";
    }
    // For backwards compatibility with prototype
    if (isset($options['hoverclass'])) {
        $options['hoverClass'] = $options['hoverclass'];
    }
    $options['hoverClass'] = json_encode('hoverclass');
    foreach (jq_get_ajax_options() as $key) {
        unset($options[$key]);
    }
    if (isset($options['accept'])) {
        $options['accept'] = json_encode($options['accept']);
    }
    $options = jq_options_for_javascript($options);
    $selector = json_encode($selector);
    return javascript_tag("jQuery({$selector}).droppable({$options});");
}
Example #3
0
/**
 * Makes the element with the DOM ID specified by '$element_id' receive
 * dropped draggable elements (created by 'draggable_element()') and make an AJAX call.
 * By default, the action called gets the DOM ID of the element as parameter.
 *
 * Example:
 *   <?php drop_receiving_element('my_cart', array(
 *      'url' => 'cart/add',
 *   )) ?>
 *
 * You can change the behaviour with various options, see
 * http://script.aculo.us for more documentation.
 */
function jq_drop_receiving_element($element_id, $options = array())
{
    $response = sfContext::getInstance()->getResponse();
    $response->addJavascript(sfConfig::get('app_mdToolsPlugin_jquery_ui_folder', '/mdToolsPlugin/js/jquery') . '/jquery-ui');
    if (!isset($options['with'])) {
        $options['with'] = "'id=' + encodeURIComponent(jQuery(ui.draggable).attr('id'))";
    }
    if (!isset($options['drop'])) {
        $options['drop'] = "function(ev, ui){" . jq_remote_function($options) . "}";
    }
    foreach (jq_get_ajax_options() as $key) {
        unset($options[$key]);
    }
    if (isset($options['accept'])) {
        $options['accept'] = _jq_array_or_string_for_javascript($options['accept']);
    }
    if (isset($options['hoverclass'])) {
        $options['hoverclass'] = "'{$options['hoverclass']}'";
    }
    return jq_javascript_tag("jQuery('#{$element_id}').droppable(" . _jq_options_for_javascript($options) . ")");
}
Example #4
0
  
  <div id="roles">
  <?php 
include_partial('role/list', array('role_list' => $role_list, 'max_array' => $max_array, 'max' => $max, 'pager' => $pager, 'page' => $page));
?>
  </div>
</div>

<?php 
jq_javascript_tag();
?>
function navigate(page)
{
  page = parseInt(page);
  <?php 
echo jq_remote_function(array('url' => 'role/list', 'with' => "{ page: page }", 'before' => "\$('#indicator').show();", 'success' => "\$('#indicator').hide(); \$('#roles').html(data);"));
?>
}

function resetForm()
{
  $('#rr_form input=[name=id], #rr_form input=[name=title]').val('');
  $('#rr_form_submit').val('Add Role');
  $('#rr_form_new').hide();
}

function fillForm(id, title)
{
  $('#rr_form input=[name=id]').val(id);
  $('#rr_form input=[name=title]').val(title);
  $('#rr_form_submit').val('Save Role');
Example #5
0
/**
 *  Returns a image submit tag that will submit form using XMLHttpRequest in the background instead of regular
 *  reloading POST arrangement. The '$options' argument is the same as in 'form_remote_tag()'.
 */
function jq_submit_image_to_remote($name, $source, $options = array(), $options_html = array())
{
    $options = _parse_attributes($options);
    $options_html = _parse_attributes($options_html);
    if (!isset($options['with'])) {
        $options['with'] = 'jQuery(this.form.elements).serialize()';
    }
    $options_html['type'] = 'image';
    $options_html['onclick'] = jq_remote_function($options) . ' return false;';
    $options_html['name'] = $name;
    $options_html['src'] = image_path($source);
    if (!isset($options_html['alt'])) {
        $path_pos = strrpos($source, '/');
        $dot_pos = strrpos($source, '.');
        $begin = $path_pos ? $path_pos + 1 : 0;
        $nb_str = ($dot_pos ? $dot_pos : strlen($source)) - $begin;
        $options_html['alt'] = ucfirst(substr($source, $begin, $nb_str));
    }
    return tag('input', $options_html, false);
}
Example #6
0
use_helper('I18N');
$type = $mediaItem->getType();
$id = $mediaItem->getId();
$serviceUrl = $mediaItem->getServiceUrl();
$slug = $mediaItem->getSlug();
?>

<?php 
if (aMediaTools::isSelecting()) {
    ?>

  <?php 
    if (aMediaTools::isMultiple()) {
        ?>
    <?php 
        $linkAttributes = 'href = "#" onClick="' . jq_remote_function(array("update" => "a-media-selection-list", 'complete' => "aUI('a-media-selection-list');", "url" => "aMedia/multipleAdd?id={$id}")) . '; return false;"';
        ?>
  <?php 
    } else {
        ?>
    <?php 
        $linkAttributes = 'href = "' . url_for("aMedia/selected?id={$id}") . '"';
        ?>
  <?php 
    }
    ?>

<?php 
} else {
    ?>
Example #7
0
?>
  </tbody>

  <tfoot id="global_calculations">
    <tr>
      <td colspan="<?php 
echo $sf_user->has_module('products') ? '5' : '4';
?>
" rowspan="5" class="noborder top">
        <div id="addItem">
          <?php 
$addItemOptions = array('url' => 'common/ajaxAddInvoiceItem', 'position' => 'bottom', 'method' => 'post', 'with' => "{invoice_id: \$('#invoice_id').val()}", 'success' => "\$('#tbody_invoice_items').append(data);\n                  \$('textarea.resizable:not(.processed)').TextAreaResizer();");
echo jq_link_to_remote(__("Add Item"), $addItemOptions);
// if invoice has no items, we add one by an ajax call
if (!count($invoiceForm['Items'])) {
    $first = jq_remote_function($addItemOptions);
    echo javascript_tag("{$first}");
}
?>
        </div>
        <?php 
if (count($invoiceItemsGlobalErrors)) {
    ?>
          <div id="invoiceItemsGlobalErrors" class="errorBox">
            <p><?php 
    echo __('Please check these errors and correct them before saving:');
    ?>
</p>
            <?php 
    echo implode("\n", $invoiceItemsGlobalErrors);
    ?>
Example #8
0
$err = $invoiceItemForm['taxes_list']->hasError() ? 'error' : '';
$item_taxes = $invoiceItemForm['taxes_list']->getValue() ? $invoiceItemForm['taxes_list']->getValue() : array();
$totalTaxesValue = Doctrine::getTable('Tax')->getTotalTaxesValue($item_taxes);
echo jq_javascript_tag("\n        window.new_item_tax_index = \$('" . $rowId . "_taxes').find('span[id^=tax_" . $rowId . "]').size()+1;\n        ");
echo jq_link_to_remote(__("Add"), array('update' => $rowId . '_taxes', 'url' => 'common/ajaxAddInvoiceItemTax', 'position' => 'bottom', 'method' => 'post', 'with' => "{item_tax_index: new_item_tax_index++, invoice_item_key: '{$rowId}'}"));
foreach ($item_taxes as $taxId) {
    include_partial('common/taxSpan', array('taxKey' => $taxId, 'rowId' => $rowId, 'err' => $err));
}
?>

      <?php 
// if item has no taxes, and there are "default" taxes defined, we add them
if (isset($isNew) && !count($item_taxes)) {
    $default_taxes = Doctrine::getTable('Tax')->createQuery()->where('active', true)->where('is_default', true)->execute();
    foreach ($default_taxes as $taxx) {
        echo javascript_tag(jq_remote_function(array('update' => $rowId . '_taxes', 'url' => 'common/ajaxAddInvoiceItemTax', 'position' => 'bottom', 'method' => 'post', 'with' => "{\n                                        item_tax_index:   new_item_tax_index++, \n                                        invoice_item_key: '{$rowId}',\n                                        selected_tax:     '" . $taxx->id . "'\n                                      }")));
    }
}
?>
    </span>
    
  </td>
  <td class="right discount"><?php 
echo $invoiceItemForm['discount']->render(array(), ESC_RAW);
?>
 %</td>
    <td class="right price"><?php 
echo format_currency(Tools::getRounded(Tools::getGrossAmount($invoiceItemForm['unitary_cost']->getValue(), $invoiceItemForm['quantity']->getValue(), $invoiceItemForm['discount']->getValue(), $totalTaxesValue), Tools::getDecimals()), $currency);
?>
 </td>
</tr>
Example #9
0
                    <?php 
        if ($oAppCommon->oForm->getValidator($ssFieldName)->getOption('required')) {
            ?>
                        <b>*</b>
                     <?php 
        }
        echo $oAppCommon->oForm[$ssFieldName]->renderLabel();
        ?>
</td>
                    <td width="85%" align="left" id="tbRowCell<?php 
        echo $snTabindex;
        ?>
2" >
                        <div class="fleft">
                          <?php 
        echo $oAppCommon->oForm['country']->render(array('onchange' => jq_remote_function(array('update' => 'company_state', 'url' => '/company/getState?ssFormName=' . $ssFormName, 'method' => 'post', 'with' => "'&id=' + this.options[this.selectedIndex].value"))));
        ?>
                        </div>

                            <?php 
        if ($oAppCommon->oForm[$ssFieldName]->renderError() && count($oAppCommon->oForm[$ssFieldName]) == 1 && !isset($oEmbedeForms[$ssFieldName])) {
            ?>
                            <div class="fleft"><?php 
            echo $oAppCommon->oForm[$ssFieldName]->renderError();
            ?>
</div>
                            <?php 
        }
        ?>

                    </td>
Example #10
0
          <input type="hidden" name="sf_method" value="put" />
        <?php 
}
?>
        <?php 
echo $comment_form->renderHiddenFields();
?>
        <div class="columns">
          <div class="column left">
            <div class="group">
              <label class="label"><?php 
echo __('Insert a comment');
?>
</label><br/>
              <?php 
echo $comment_form['body']->render(array('rows' => '3', 'cols' => '35'));
?>
            </div>
            <div class="group">
              <input type="submit" class="button" value="Save" />
            </div>
          </div>
          <div class="column right" id="comment_list"></div>
          <?php 
echo jq_javascript_tag(jq_remote_function(array('update' => 'comment_list', 'url' => 'idComment/index?issue_id=' . $issue->getId())));
?>
        </div>
        <div class="clear"></div>
      </form>
    </div>
  </div>
                } else {
                    echo image_tag('no-image-company.gif', array('title' => $oResult['company_name']));
                }
            } elseif (isset($aField['maillink'])) {
                echo mail_to($ssFieldName, $ssFieldName, array('title' => $ssFieldName));
            } elseif (isset($aField['seperator']) && isset($aField['fieldName']) && $ssFieldName) {
                foreach ($ssFieldName as $snKey => $aValues) {
                    $ssTranslation = preg_match('/Translation/', $aField["fieldName"]) ? substr(htmlspecialchars_decode($aField["fieldName"]), 0, strpos(htmlspecialchars_decode($aField["fieldName"]), 'Translation') + 13) : htmlspecialchars_decode($aField["fieldName"]);
                    eval("\$" . "ssFieldValue = ((count(" . "\$" . "aValues" . $ssTranslation . ") > 0) ? " . "\$" . "aValues" . htmlspecialchars_decode($aField["fieldName"]) . " : '');");
                    echo $ssFieldValue . (count($ssFieldName) - 1 > $snKey ? $aField['seperator'] : "") . " ";
                }
            } elseif (isset($aField['rank'])) {
                echo $snRecordNumber > 1 ? link_to_function(image_tag('admin/up.gif', array('title' => __('Up'))), jq_remote_function(array('update' => $oAppCommon->ssDivId, 'url' => $aField['linkRank'], 'with' => 'jQuery("#frmList").serialize()+"&snRank1=' . ($snRecordNumber - 2) . '&snRank2=' . ($snRecordNumber - 1) . '"'))) : image_tag('admin/blank.gif');
                echo "&nbsp;&nbsp;";
                if ($snRecordNumber < $snCount) {
                    echo link_to_function(image_tag('admin/down.gif', array('title' => __('Down'))), jq_remote_function(array('update' => $oAppCommon->ssDivId, 'url' => $aField['linkRank'], 'with' => 'jQuery("#frmList").serialize()+"&snRank1=' . ($snRecordNumber - 1) . '&snRank2=' . $snRecordNumber . '"')));
                }
            } elseif (isset($aField['priceformat']) && $aField['priceformat'] == 'yes') {
                echo sfGeneral::setPriceFormat($ssFieldName);
            } elseif (isset($aField['dateformat']) && $aField['dateformat'] == 'yes') {
                echo sfGeneral::setDateFormat($ssFieldName);
            } else {
                echo $ssFieldName;
            }
            ?>
</td>
	<?php 
        }
        ?>
 <?php 
        if ($oAppCommon->ssShowEditButton) {
/**
   * 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'/'method' options on '$options_html'
   *
   * Example:
   *  <?php echo jq_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.
   *
   * By default the fall-through action is the same as the one specified in the 'url'
   * (and the default method is 'post').
   */
function jq_form_remote_tag($options = array(), $options_html = array())
{
	$options = _parse_attributes($options);
	$options_html = _parse_attributes($options_html);

	$options['form'] = true;

	$options_html['onsubmit'] = jq_remote_function($options).'; return false;';
	$options_html['action'] = isset($options_html['action']) ? $options_html['action'] : url_for($options['url']);
	$options_html['method'] = isset($options_html['method']) ? $options_html['method'] : 'post';

	return tag('form', $options_html, true);
}