public function renderConfirmationForm($btn = "Yes, assign", $addHtml = null)
 {
     $select = sprintf('<select name="%s__group_id">
         %s
         </select><br /><br />' . PHP_EOL, $this->grid->getId(), Am_Controller::renderOptions(Am_Di::getInstance()->resourceCategoryTable->getOptions()));
     return parent::renderConfirmationForm($this->remove ? ___("Yes, remove category") : ___("Yes, assign category"), $select);
 }
 public function renderInputs()
 {
     $gridId = $this->grid->getId();
     $options = array_merge(array('' => ''), Am_Currency::getSupportedCurrencies());
     array_remove_value($options, Am_Currency::getDefault());
     $filter = $this->getParam('filter');
     return sprintf("<select name='{$gridId}_filter[currency]'>\n%s\n</select>\n", Am_Controller::renderOptions($options, @$filter['currency']));
 }
 function renderForm($addHidden)
 {
     $this->initPossibleConditions();
     $t = new Am_View();
     $renderer = HTML_QuickForm2_Renderer::factory('array');
     if (!$this->form) {
         $this->createForm(array());
     }
     $this->form->render($renderer);
     $t->assign('form', $renderer->toArray());
     $t->assign('description', $this->getDescription(true));
     $t->assign('serialized', $this->serialize());
     $t->assign('hidden', $addHidden);
     $t->assign('loadSearchOptions', Am_Controller::renderOptions($this->getLoadOptions(), $this->saved_search_id));
     return $t->render($this->template);
 }
Beispiel #4
0
    public function __toString()
    {
        $output = sprintf('<div style="padding:0.5em"><h1>%s</h1><div class="grid-container"><table id="regional-tax-table" %s><tr><th>%s</th>
	<th>%s</th>
        <th>%s</th>
	<th>%s</th>
	<th>&nbsp;</th></tr>', ___('Configured Tax Values'), 'class="grid"', ___('Country'), ___('State'), ___('Zip'), ___('Tax Value'));
        $label_add = ___('Add');
        $output .= "<tr class='regional-tax-add'>" . "<td width='30%'><select id='regional-tax-country' size='1'><option/>" . Am_Controller::renderOptions(Am_Di::getInstance()->countryTable->getOptions()) . "</select>" . "<td width='30%'><select id='regional-tax-state' size='1'></select></td>" . "<td><input type='text' id='regional-tax-zip' /></td>" . "<td><input type='text' id='regional-tax-rate' size='5' maxlength='5' /></td>" . "<td><input type='button' id='regional-tax-add-button' value='{$label_add}'/></td>" . "</tr>\n";
        $name = $this->getName();
        foreach ($this->regional_taxes as $id => $region) {
            $hidden = Am_Controller::escape(implode('|', array($region['country'], $region['state'], $region['zip'], $region['tax_value'])));
            $output .= '<tr>' . sprintf('<td>%s</td>', Am_Di::getInstance()->countryTable->getTitleByCode($region['country'])) . sprintf('<td>%s</td>', $region['state'] ? Am_Di::getInstance()->stateTable->getTitleByCode($region['country'], $region['state']) : '*') . sprintf('<td>%s</td>', $region['zip'] ? $region['zip'] : '*') . sprintf('<td>%.2f%s</td>', $region['tax_value'], '&nbsp;%') . sprintf('<td><a href="javascript:" class="regional-tax-remove">%s</a>%s</td>', ___('Remove'), "<input type='hidden' name='{$name}[]' value='{$hidden}'>") . '</tr>';
        }
        $output .= '</table></div></div>';
        $id = $this->getId();
        $output .= "\n        <style type='text/css'>\n            #row-{$id} .element-title { display: none;  }\n            #row-{$id} .element { margin-left: 0 } \n        </style>\n        ";
        return sprintf('<tr><td colspan="2" id="tax-regional-regions">%s</td></tr>', $output . $this->getJs());
    }
    public function renderInputs()
    {
        $prefix = $this->grid->getId();
        $filter = (array) $this->vars['filter'];
        $filter['datf'] = Am_Controller::escape(@$filter['datf']);
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $filter['text'] = Am_Controller::escape(@$filter['text']);
        $pOptions = array('' => '-' . ___('Filter by Product') . '-');
        $pOptions = $pOptions + Am_Di::getInstance()->productTable->getOptions();
        $pOptions = Am_Controller::renderOptions($pOptions, @$filter['product_id']);
        $options = Am_Controller::renderOptions(array('' => '***', 'invoice' => ___('Invoice'), 'receipt' => ___('Payment Receipt'), 'coupon' => ___('Coupon Code')), @$filter['type']);
        $dOptions = $this->getDateFieldOptions();
        if (count($dOptions) === 1) {
            $dSelect = sprintf('%s: <input type="hidden" name="%s_filter[datf]" value="%s" />', current($dOptions), $prefix, key($dOptions));
        } else {
            $dSelect = sprintf('<select name="%s_filter[datf]">%s</select>', $prefix, Am_Controller::renderOptions($dOptions, @$filter['datf']));
        }
        $start = ___('Start Date');
        $end = ___('End Date');
        $dsr = $this->renderDontShowRefunded();
        return <<<CUT
<select name="{$prefix}_filter[product_id]" style="width:150px">
{$pOptions}
</select>
{$dSelect}
<input type="text" placeholder="{$start}" name="{$prefix}_filter[dat1]" class='datepicker' style="width:80px" value="{$filter['dat1']}" />
<input type="text" placeholder="{$end}" name="{$prefix}_filter[dat2]" class='datepicker' style="width:80px" value="{$filter['dat2']}" />
<br />
<input type="text" name="{$prefix}_filter[text]" value="{$filter['text']}" style="width:300px" />
<select name="{$prefix}_filter[type]">
{$options}
</select>
<br />
{$dsr}
CUT;
    }
    public function renderInputs()
    {
        $filter = (array) $this->vars['filter'];
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $filter['text'] = Am_Controller::escape(@$filter['text']);
        $options = Am_Controller::renderOptions(array('' => '***', 'invoice' => ___('Invoice'), 'login' => ___('Username')), @$filter['type']);
        //'receipt'    => ___('Receipt'),
        $start = ___("Start Date");
        $end = ___("End Date");
        $tfilter = ___("Filter");
        $prefix = $this->grid->getId();
        return <<<CUT
<b>{$start}</b>        
<input type="text" name="{$prefix}_filter[dat1]" class='datepicker' value="{$filter['dat1']}" />
<b>{$end}</b>        
<input type="text" name="{$prefix}_filter[dat2]" class='datepicker' value="{$filter['dat2']}" />
<b>{$tfilter}</b>        
<input type="text" name="{$prefix}_filter[text]" value="{$filter['text']}" />
<select name="{$prefix}_filter[type]">
{$options}
</select>
CUT;
    }
 public function renderConfirmationForm($btn = "Yes, assign", $addHtml = null)
 {
     $select = sprintf('%s <select name="%s__product_id">
         %s
         </select><br /><br />' . PHP_EOL, ___('Put Chosen Products After'), $this->grid->getId(), Am_Controller::renderOptions(Am_Di::getInstance()->productTable->getOptions()));
     return parent::renderConfirmationForm(___("Change Order"), $select);
 }
    public function renderInputs()
    {
        $prefix = $this->grid->getId();
        $filter = (array) $this->vars['filter'];
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $countryOptions = array();
        $countryOptions = $countryOptions + Am_Di::getInstance()->countryTable->getOptions();
        $countryOptions = Am_Controller::renderOptions($countryOptions, @$filter['country']);
        $paysysOptions = array();
        $paysysOptions = $paysysOptions + Am_Di::getInstance()->paysystemList->getOptions();
        $paysysOptions = Am_Controller::renderOptions($paysysOptions, @$filter['paysys_id']);
        $pOptions = array();
        $period = array(Am_Interval::PERIOD_THIS_MONTH, Am_Interval::PERIOD_LAST_MONTH, Am_Interval::PERIOD_THIS_QUARTER, Am_Interval::PERIOD_LAST_QUARTER, Am_Interval::PERIOD_THIS_YEAR, Am_Interval::PERIOD_LAST_YEAR, Am_Interval::PERIOD_ALL);
        $i = $this->grid->getDi()->interval;
        foreach ($period as $k) {
            $pOptions[$k] = $i->getTitle($k);
        }
        $pOptions['exact'] = ___('Exact Period');
        $pOptions = Am_Controller::renderOptions($pOptions, @$filter['period']);
        $start = ___('Start Date');
        $end = ___('End Date');
        $offer_country = '-' . ___('Filter by Country') . '-';
        $offer_paysys = '-' . ___('Filter by Paysystem') . '-';
        $dSelect = ___('Report Dates');
        $pSelect = ___('Report Period');
        $dont_show_empty_checked = @$filter['dont_show_empty'] == 1 ? 'checked' : '';
        $dont_show_empty_label = ___('Do not include records with empty VAT');
        return <<<CUT
   <div style='display:table-cell; padding-bottom:0.4em;'>
        {$pSelect}
        <select name='{$prefix}_filter[period]' id='filter-period'>
            {$pOptions}
        </select>&nbsp;&nbsp;
   </div>
   <div style='display:table-cell; padding-bottom:0.4em;' id='filter-exact'>
        {$dSelect}
        <input type="text" placeholder="{$start}" name="{$prefix}_filter[dat1]" class='datepicker' style="width:80px" value="{$filter['dat1']}" />
        <input type="text" placeholder="{$end}" name="{$prefix}_filter[dat2]" class='datepicker' style="width:80px" value="{$filter['dat2']}" />&nbsp;&nbsp;
    </div>

    <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
        <select name="{$prefix}_filter[country][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_country}'>
            {$countryOptions}
        </select>&nbsp;&nbsp;
    </div>

   <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
        <select name="{$prefix}_filter[paysys_id][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_paysys}'>
            {$paysysOptions}
        </select>
   </div>

   <br/>

   <div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; box-sizing:border-box;'>
        <label>
            <input type="hidden" name="{$prefix}_filter[dont_show_empty]" value="0" />
            <input type="checkbox" name="{$prefix}_filter[dont_show_empty]" value="1" {$dont_show_empty_checked} /> {$dont_show_empty_label}
        </label>
   </div>


   <script>
    jQuery(document).ready(function(){
        jQuery('input[type=checkbox]').change(function(){jQuery('.filter').submit()});
        jQuery('#filter-period').change(function(){
                if(jQuery(this).val() == 'exact')
                    jQuery("#filter-exact").show();
                else
                    jQuery("#filter-exact").hide();

            }).change();

    });
   </script>

CUT;
    }
Beispiel #9
0
 public function formOptions($options, $selected)
 {
     return Am_Controller::renderOptions($options, $selected);
 }
Beispiel #10
0
 function __toString()
 {
     return sprintf('<div class="input_period">' . '<input type="text" name="%s[c]" value="%s" size=10 id="%s"> ' . '<select name="%s[u]" size="1" id="%s">' . Am_Controller::renderOptions($this->options, $this->period->getCount() != Am_Period::MAX_SQL_DATE ? $this->period->getUnit() : 'lifetime') . '</select></div>', $this->getName(), $this->period->getCount(), $this->getId() . '-c', $this->getName(), $this->getId() . '-u');
 }
    public function renderInputs()
    {
        $prefix = $this->grid->getId();
        $filter = (array) $this->vars['filter'];
        $filter['datf'] = Am_Controller::escape(@$filter['datf']);
        $filter['dat1'] = Am_Controller::escape(@$filter['dat1']);
        $filter['dat2'] = Am_Controller::escape(@$filter['dat2']);
        $filter['text'] = Am_Controller::escape(@$filter['text']);
        $pOptions = array();
        $pOptions = $pOptions + Am_Di::getInstance()->productTable->getOptions();
        $pOptions = Am_Controller::renderOptions($pOptions, @$filter['product_id']);
        $paysysOptions = array();
        $paysysOptions = $paysysOptions + Am_Di::getInstance()->paysystemList->getOptions();
        $paysysOptions = Am_Controller::renderOptions($paysysOptions, @$filter['paysys_id']);
        $options = Am_Controller::renderOptions(array('invoice' => ___('Invoice Number'), 'receipt' => ___('Payment Receipt'), 'login' => ___('Username'), 'name' => ___('Name'), 'coupon' => ___('Coupon Code')), @$filter['type']);
        $dOptions = $this->getDateFieldOptions();
        if (count($dOptions) === 1) {
            $dSelect = sprintf('%s: <input type="hidden" name="%s_filter[datf]" value="%s" />', current($dOptions), $prefix, key($dOptions));
        } else {
            $dSelect = sprintf('<select name="%s_filter[datf]">%s</select>', $prefix, Am_Controller::renderOptions($dOptions, @$filter['datf']));
        }
        $start = ___('Start Date');
        $end = ___('End Date');
        $offer_product = '-' . ___('Filter by Product') . '-';
        $offer_paysys = '-' . ___('Filter by Paysystem') . '-';
        return <<<CUT
<div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
<select name="{$prefix}_filter[product_id][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_product}'>
{$pOptions}
</select>
</div>
<div style='display:table-cell; padding-right:0.4em; padding-bottom:0.4em; width:160px; box-sizing:border-box;'>
<select name="{$prefix}_filter[paysys_id][]" style="width:160px" class="magicselect" multiple="multiple" data-offer='{$offer_paysys}'>
{$paysysOptions}
</select>
   </div>
<div style='display:table-cell; padding-bottom:0.4em;'>

{$dSelect}
<input type="text" placeholder="{$start}" name="{$prefix}_filter[dat1]" class='datepicker' style="width:80px" value="{$filter['dat1']}" />
<input type="text" placeholder="{$end}" name="{$prefix}_filter[dat2]" class='datepicker' style="width:80px" value="{$filter['dat2']}" />
</div>
<input type="text" name="{$prefix}_filter[text]" value="{$filter['text']}" style="width:380px" />
<select name="{$prefix}_filter[type]">
{$options}
</select>
CUT;
    }
Beispiel #12
0
    public function render()
    {
        $options = Am_Controller::renderOptions($this->getSimpleOptions(), $this->options);
        $keep = ___('You can select more than one item - keep "Ctrl" key pressed');
        $apply = ___("Apply Filter");
        return <<<CUT
<div class="popup">
        <div class="popup-top-arrow"></div>
        <div class="popup-content">
<form method="post">
<i>{$keep}</i><br />
<select name="search-simple[]" size="10" multiple="multiple">
{$options}
</select><br />
<input type="hidden" name="search-type" value="simple" />
<input type="submit" value="{$apply}" style="margin-top: 5px"/>
</form>
</div>
<div class="popup-bottom"></div>
</div>
CUT;
    }