当前位置: 首页>>代码示例>>PHP>>正文


PHP Am_Form_Admin::addAdvRadio方法代码示例

本文整理汇总了PHP中Am_Form_Admin::addAdvRadio方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Form_Admin::addAdvRadio方法的具体用法?PHP Am_Form_Admin::addAdvRadio怎么用?PHP Am_Form_Admin::addAdvRadio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Am_Form_Admin的用法示例。


在下文中一共展示了Am_Form_Admin::addAdvRadio方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createUpgradesForm

    public function createUpgradesForm(Am_Grid_Editable $grid)
    {
        $form = new Am_Form_Admin();
        $options = $grid->_planOptions;
        $from = $form->addSelect('from_billing_plan_id', null, array('options' => $options))->setLabel(___('Upgrade From'));
        $to = $form->addSelect('to_billing_plan_id', null, array('options' => $options))->setLabel(___('Upgrade To'));
        $to->addRule('neq', ___('[From] and [To] billing plans must not be equal'), $from);
        $form->addText('surcharge', array('placeholder' => '0.0'))->setLabel(___("Surcharge\nto be additionally charged when customer moves [From]->[To] plan\naMember will not charge First Price on upgrade, use Surcharge instead"));
        $el = $form->addAdvRadio('type')->setLabel(___('Upgrade Price Calculation Type'));
        $el->addOption(<<<CUT
          <b>Default</b> - Unused amount from previous subscription  will be applied as discount to new one
CUT
, ProductUpgrade::TYPE_DEFAULT);
        $el->addOption(<<<CUT
          <b>Flat</b> - User only pay flat rate on upgrade (Surcharge amount)
CUT
, ProductUpgrade::TYPE_FLAT);
        return $form;
    }
开发者ID:grlf,项目名称:eyedock,代码行数:19,代码来源:AdminProductsController.php

示例2: createConfirmForm

 protected function createConfirmForm($force_submited = false)
 {
     $form = new Am_Form_Admin('confirm');
     $form->setAction($this->getUrl(null, 'confirm'));
     $form->addAdvRadio('mode')->setLabel(___('Import Mode'))->loadOptions(self::getImportModeOptions())->setValue(self::MODE_SKIP);
     $group = $form->addGroup();
     $group->setSeparator(' ');
     $group->addElement('inputbutton', 'back', array('value' => ___('Back')))->setId('back');
     $group->addElement('submit', '_submit_', array('value' => ___('Do Import')))->setId('_submit_');
     if ($force_submited || $form->isSubmitted()) {
         $form->setDataSources(array($this->getRequest()));
     } else {
         $form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array())));
     }
     return $form;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:16,代码来源:AdminImportController.php

示例3: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $title = $form->addText('title', array('class' => 'el-wide'))->setLabel(___("Title\ndisplayed to customers"));
     $title->addRule('required');
     $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
     $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item link in members area"));
     $path = $form->addText('path')->setLabel(___('Path to Folder'))->setAttribute('size', 50)->addClass('dir-browser');
     $path->addRule('required');
     $path->addRule('callback2', '-- Wrong path --', array($this, 'validatePath'));
     $url = $form->addGroup()->setLabel(___('Folder URL'));
     $url->addRule('required');
     $url->addText('url')->setAttribute('size', 50)->setId('url');
     $url->addHtml()->setHtml(' <a href="#" id="test-url-link">' . ___('open in new window') . '</a>');
     $methods = array('new-rewrite' => ___('New Rewrite'), 'htpasswd' => ___('Traditional .htpasswd'));
     foreach ($methods as $k => $v) {
         if (!Am_Di::getInstance()->plugins_protect->isEnabled($k)) {
             unset($methods[$k]);
         }
     }
     $method = $form->addAdvRadio('method')->setLabel(___('Protection Method'));
     $method->loadOptions($methods);
     if (count($methods) == 0) {
         throw new Am_Exception_InputError(___('No protection plugins enabled, please enable new-rewrite or htpasswd at aMember CP -> Setup -> Plugins'));
     } elseif (count($methods) == 1) {
         $method->setValue(key($methods))->toggleFrozen(true);
     }
     $form->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'))->setAttribute('without_free_without_login', 'true');
     $form->addScript('script')->setScript('
     $(function(){
         $(".dir-browser").dirBrowser({
             urlField : "#url",
             rootUrl  : ' . Am_Controller::getJson(REL_ROOT_URL) . ',
         });
         $("#test-url-link").click(function() {
             var href = $("input", $(this).parent()).val();
             if (href)
                 window.open(href , "test-url", "");
         });
     });
     ');
     $form->addText('no_access_url', array('class' => 'el-wide'))->setLabel(___("No Access URL\ncustomer without required access will be redirected to this url\nleave empty if you want to redirect to default 'No access' page"));
     $this->addCategoryToForm($form);
     return $form;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:45,代码来源:AdminContentController.php

示例4: addEmailOrLogin

    function createForm()
    {
        $form = new Am_Form_Admin();
        $form->addAdvRadio('is_custom')->loadOptions(array(0 => ___('Use Pre-Defined Template'), 1 => ___('Define Custom Html Message')))->setValue(0);
        $form->addTextarea('content', array('rows' => '7', 'class' => 'row-wide el-wide'))->setLabel(___("Content\n" . 'You can use all user specific placeholders here eg. %user.login%, %user.name_f%, %user.name_l% etc.'))->addRule('required');
        $form->addText('url', array('class' => 'el-wide', 'rel' => 'form-pre-defined'))->setLabel(___('Link'));
        $form->addAdvcheckbox('is_blank', array('rel' => 'form-pre-defined'))->setLabel(___('Open Link in New Window'));
        $form->addScript()->setScript(<<<CUT
\$('[name=is_custom]').change(function(){
    \$('[rel=form-pre-defined]').closest('.row').toggle(\$('[name=is_custom]:checked').val() == 0)
}).change();
CUT
);
        $sel = $form->addMagicSelect('_target')->setLabel(___('Target By User'));
        $cats = $pr = $gr = array();
        foreach ($this->getDi()->userGroupTable->getSelectOptions() as $k => $v) {
            $gr['user_group_id-' . $k] = 'Group: ' . $v;
        }
        $options = array('free' => ___('All'), 'user_id' => ___('Specific User')) + ($cats ? array(___('Product Categories') => $cats) : array()) + ($gr ? array(___('User Groups') => $gr) : array()) + ($pr ? array(___('Products') => $pr) : array());
        $sel->loadOptions($options);
        //$sel->addRule('required');
        $sel->setJsOptions('{onChange:function(val){
                $("input[name^=_loginOrEmail]").closest(\'.row\').toggle(val.hasOwnProperty("user_id"));
        }}');
        $loginGroup = $form->addGroup('');
        $loginGroup->setLabel(___('E-Mail Address or Username'));
        $loginGroup->addHidden('_savedLoginOrEmail')->setValue('');
        $login = $loginGroup->addText('_loginOrEmail[]');
        $label_add_user = ___('Add User');
        $loginGroup->addHtml()->setHtml(<<<CUT
<div><a href="javascript:void(null);" id="target-user_id-add" class="local">{$label_add_user}</a></div>
CUT
);
        $form->addElement(new Am_Form_Element_ResourceAccess('_raccess', array('without_free' => true)))->setLabel('Target By Product');
        $gr = $form->addGroup()->setSeparator(' ')->setLabel(___("Dates\n" . 'date range when notification is shown'));
        $gr->addDate('begin', array('placeholder' => ___('Begin Date')));
        $gr->addDate('expire', array('placeholder' => ___('Expire Date')));
        $form->addScript('script')->setScript(<<<CUT
\$("input[name^=_loginOrEmail]").autocomplete({
        minLength: 2,
        source: window.rootUrl + "/admin-users/autocomplete"
});
CUT
);
        $delIcon = $this->getDi()->view->icon('delete');
        $form->addScript('script2')->setScript(<<<CUT

var arr = \$('[name=_savedLoginOrEmail]').val().split(',').reverse();
\$('[name^=_loginOrEmail]').val(arr.pop());
for (var i in arr) {
    var \$field = addEmailOrLogin(\$('#target-user_id-add'));
    \$field.val(arr[i]);
}

function addEmailOrLogin(context) {
    var \$field = \$('<input tyep="text" name="_loginOrEmail[]" />');
    \$(context).before('<br />');
    \$(context).before(\$field);
    \$(context).before('<a href="javascript:void(null)" onclick="\$(this).prev().remove();\$(this).prev().remove();\$(this).next().remove();\$(this).remove()">{$delIcon}</a>');
    \$(context).before('<br />');
    \$field.autocomplete({
        minLength: 2,
        source: window.rootUrl + "/admin-users/autocomplete"
    });
    return \$field;
}

\$('#target-user_id-add').click(function(){
    addEmailOrLogin(this);
})
CUT
);
        $form->addText('limit', array('placeholder' => ___('Unlimited')))->setLabel(___("Limit Number of Display per User\n" . 'keep it empty for unlimited'));
        return $form;
    }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:75,代码来源:notification.php

示例5: addInvoiceAction

    public function addInvoiceAction()
    {
        $this->getDi()->authAdmin->getUser()->checkPermission('grid_invoice', 'insert');
        $form = new Am_Form_Admin('add-invoice');
        $tm_added = $form->addDate('tm_added')->setLabel(___('Date'));
        $tm_added->setValue($this->getDi()->sqlDate);
        $tm_added->addRule('required');
        $comment = $form->addText('comment', array('class' => 'el-wide'))->setLabel(___("Comment\nfor your reference"));
        $form->addElement(new Am_Form_Element_ProductsWithQty('product_id'))->setLabel(___('Products'))->loadOptions($this->getDi()->billingPlanTable->selectAllSorted())->addRule('required');
        $form->addSelect('paysys_id')->setLabel(___('Payment System'))->setId('add-invoice-paysys_id')->loadOptions(array('' => '') + $this->getDi()->paysystemList->getOptions());
        $couponEdit = $form->addText('coupon')->setLabel(___('Coupon'))->setId('p-coupon');
        $action = $form->addAdvRadio('_action')->setLabel(___('Action'))->setId('add-invoice-action')->loadOptions(array('pending' => ___('Just Add Pending Invoice'), 'pending-payment' => ___('Add Invoice and Payment/Access Manually'), 'pending-send' => ___('Add Pending Invoice and Send Link to Pay It to Customer')))->setValue('pending');
        $receipt = $form->addText('receipt')->setLabel(___('Receipt#'))->setId('add-invoice-receipt');
        $tm_due = $form->addDate('tm_due')->setLabel(___('Due Date'));
        $tm_due->setValue(sqlDate('+7 days'));
        $tm_due->setId('add-invoice-due');
        $message = $form->addTextarea('message', array('class' => 'el-wide'))->setLabel(___("Message\nwill be included to email to user"));
        $message->setId('add-invoice-message');
        $form->addElement('email_link', 'invoice_pay_link')->setLabel(___('Email Template with Payment Link'));
        $form->addScript()->setScript('
            $("[name=_action]").change(function(){
                var val = $("[name=_action]:checked").val();
                $("#add-invoice-receipt").closest("div.row").toggle(val == "pending-payment")
                $("#add-invoice-due").closest("div.row").toggle(val == "pending-send")
                $("#add-invoice-message").closest("div.row").toggle(val == "pending-send")
                $("[name=invoice_pay_link]").closest("div.row").toggle(val == "pending-send")
            }).change();

        ');
        $script = <<<CUT
        \$("input#p-coupon").autocomplete({
                minLength: 2,
                source: window.rootUrl + "/admin-coupons/autocomplete"
        });
CUT;
        $form->addScript('script')->setScript($script);
        $form->addSaveButton();
        $form->setDataSources(array($this->getRequest()));
        do {
            if ($form->isSubmitted() && $form->validate()) {
                $vars = $form->getValue();
                $invoice = $this->getDi()->invoiceRecord;
                $invoice->setUser($this->getDi()->userTable->load($this->user_id));
                $invoice->tm_added = sqlTime($vars['tm_added']);
                if ($vars['coupon']) {
                    $invoice->setCouponCode($vars['coupon']);
                    $error = $invoice->validateCoupon();
                    if ($error) {
                        $couponEdit->setError($error);
                        break;
                    }
                }
                foreach ($vars['product_id'] as $plan_id => $qty) {
                    $p = $this->getDi()->billingPlanTable->load($plan_id);
                    $pr = $p->getProduct();
                    try {
                        $invoice->add($pr, $qty);
                    } catch (Am_Exception_InputError $e) {
                        $form->setError($e->getMessage());
                        break 2;
                    }
                }
                $invoice->comment = $vars['comment'];
                $invoice->calculate();
                switch ($vars['_action']) {
                    case 'pending':
                        if (!$this->_addPendingInvoice($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    case 'pending-payment':
                        if (!$this->_addPendingInvoiceAndPayment($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    case 'pending-send':
                        if (!$this->_addPendingInvoiceAndSend($invoice, $form, $vars)) {
                            break 2;
                        }
                        break;
                    default:
                        throw new Am_Exception_InternalError(sprintf('Unknown action [%s] as %s::%s', $vars['_action'], __CLASS__, __METHOD__));
                }
                $this->getDi()->adminLogTable->log("Add Invoice (#{$invoice->invoice_id}/{$invoice->public_id}, Billing Terms: " . new Am_TermsText($invoice) . ")", 'invoice', $invoice->invoice_id);
                return $this->redirectLocation(REL_ROOT_URL . '/admin-user-payments/index/user_id/' . $this->user_id);
            }
            // if
        } while (false);
        $this->view->content = '<h1>' . ___('Add Invoice') . ' (<a href="' . REL_ROOT_URL . '/admin-user-payments/index/user_id/' . $this->user_id . '">' . ___('return') . '</a>)</h1>' . (string) $form;
        $this->view->display('admin/user-layout.phtml');
    }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:91,代码来源:AdminUserPaymentsController.php


注:本文中的Am_Form_Admin::addAdvRadio方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。