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


PHP Am_Form_Admin::addMagicSelect方法代码示例

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


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

示例1: indexAction

    public function indexAction()
    {
        if ($this->getRequest()->getParam('title') && $this->getRequest()->getParam('actionType')) {
            $productIds = $this->getRequest()->getParam('productIds');
            $prIds = $productIds ? implode(',', $productIds) : implode(',', array_keys($this->getDi()->productTable->getOptions(true)));
            $htmlcode = '
<!-- Button/Link for aMember Shopping Cart -->
<script type="text/javascript">
if (typeof cart  == "undefined")
    document.write("<scr" + "ipt src=\'' . REL_ROOT_URL . '/application/cart/views/public/js/cart.js\'></scr" + "ipt>");
</script>
';
            if ($this->getRequest()->getParam('isLink')) {
                $htmlcode .= '<a href="#" onclick="cart.' . $this->getRequest()->getParam('actionType') . '(this,' . $prIds . '); return false;" >' . $this->getRequest()->getParam('title') . '</a>';
            } else {
                $htmlcode .= '<input type="button" onclick="cart.' . $this->getRequest()->getParam('actionType') . '(this,' . $prIds . '); return false;" value="' . $this->getRequest()->getParam('title') . '">';
            }
            $htmlcode .= '
<!-- End Button/Link for aMember Shopping Cart -->
';
            $this->view->assign('htmlcode', $htmlcode);
            $this->view->display('admin/cart/button-code.phtml');
        } else {
            $form = new Am_Form_Admin();
            $form->addMagicSelect('productIds')->setLabel(___('Select Product(s)
if nothing selected - all products'))->loadOptions($this->getDi()->productTable->getOptions());
            $form->addSelect('isLink')->setLabel(___('Select Type of Element'))->loadOptions(array(0 => 'Button', 1 => 'Link'));
            $form->addSelect('actionType')->setLabel(___('Select Action of Element'))->loadOptions(array('addExternal' => ___('Add to Basket only'), 'addBasketExternal' => ___('Add & Go to Basket'), 'addCheckoutExternal' => ___('Add & Checkout')));
            $form->addText('title')->setLabel(___('Title of Element'))->addRule('required');
            $form->addSaveButton(___('Generate'));
            $this->view->assign('form', $form);
            $this->view->display('admin/cart/button-code.phtml');
        }
    }
开发者ID:grlf,项目名称:eyedock,代码行数:34,代码来源:AdminShoppingCartController.php

示例2: createForm

 public function createForm()
 {
     $f = new Am_Form_Admin();
     $g = $f->addGroup()->setLabel('Name');
     $g->addText('name_f', array('size' => 40));
     $g->addText('name_l', array('size' => 40));
     $f->addText('email', array('size' => 40))->setLabel('E-Mail Address')->addRule('required')->addRule('callback', ___("Please enter valid e-mail address"), array('Am_Validate', 'email'));
     $f->addMagicSelect('_s')->setLabel('Lists')->loadOptions($this->lists);
     return $f;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:10,代码来源:AdminGuestController.php

示例3: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addText('comment', array('class' => 'el-wide'))->setLabel(___("Comment\n" . 'for your reference'))->addRule('required');
     $sel = $form->addMagicSelect('conditions[product]')->setLabel(___("Conditions\n" . 'After actual payment aMember will check user invoice and in case ' . 'of it contains one of defined  product or product from defined ' . 'product category this OTO will be shown for him instead of ' . 'ordinary thank you page. In case of you use OTO (Downsell) ' . 'condition it will be matched if user click NO link in defined ' . 'offer and this OTO will be shown for user'));
     $cats = $pr = $oto = array();
     foreach ($this->getDi()->productCategoryTable->getAdminSelectOptions() as $k => $v) {
         $cats['category-' . $k] = ___('Category') . ':' . $v;
     }
     foreach ($this->getDi()->productTable->getOptions() as $k => $v) {
         $pr['product-' . $k] = ___('Product') . ':' . $v;
     }
     foreach ($this->getDi()->otoTable->getOptions() as $k => $v) {
         $oto['oto-' . $k] = ___('OTO') . ':' . $v;
     }
     $options = array(___('Categories') => $cats) + ($pr ? array(___('Products') => $pr) : array()) + ($oto ? array(___('OTO (Downsell)') => $oto) : array());
     $sel->loadOptions($options);
     $sel->addRule('required');
     $bpOptions = array();
     foreach ($this->getDi()->productTable->findBy(array('is_archived' => 0)) as $product) {
         /* @var $product Product */
         foreach ($product->getBillingOptions() as $bp_id => $title) {
             $bpOptions[$product->pk() . '-' . $bp_id] = sprintf('(%d) %s (%s)', $product->pk(), $product->title, $title);
         }
     }
     $form->addSelect('product_id')->setLabel('Product to Offer')->loadOptions($bpOptions)->addRule('required');
     $coupons = array('' => '');
     foreach ($this->getDi()->db->selectCol("\n\t\tSELECT c.coupon_id as ARRAY_KEY,\n\t\tCONCAT(c.code, ' - ' , b.comment)\n\t\tFROM ?_coupon c LEFT JOIN ?_coupon_batch b USING (batch_id)\n\t\tORDER BY c.code\n        ") as $k => $v) {
         $coupons[$k] = $v;
     }
     $form->addSelect('coupon_id')->setLabel(___('Apply Coupon (optional)'))->loadOptions($coupons);
     $psList = array('' => '') + $this->getDi()->paysystemList->getOptionsPublic();
     $form->addSelect('view[paysys_id]')->setLabel(___('Paysystem (optional)'))->loadOptions($psList);
     $fs = $form->addFieldSet()->setLabel(___('Offer Page Settings'));
     $fs->addText('view[title]', array('class' => 'el-wide'))->setLabel(___('Title'));
     $fs->addHtmlEditor('view[html]')->setLabel("Offer Text\nuse %yes% and %no% to insert buttons");
     $fs->addHtmlEditor('view[yes][label]')->setLabel('[Yes] button text');
     $fs->addHtmlEditor('view[no][label]')->setLabel('[No] button code');
     $fs->addAdvCheckbox('view[no_layout]')->setLabel(___("Avoid using standard layout\nyou have to design entire page in the 'Offer Text' field"));
     return $form;
 }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:41,代码来源:oto.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: createForm

    protected function createForm()
    {
        $form = new Am_Form_Admin('EmailTemplate');
        $form->addElement(new Am_Form_Element_Html('info'))->setLabel(___('Template'))->setHtml(sprintf('<div><strong>%s</strong><br /><small>%s</small></div>', $this->escape($this->getParam('name')), $this->escape($this->getParam('label'))));
        $form->addElement('hidden', 'name');
        $langOptions = $this->getLanguageOptions($this->getDi()->config->get('lang.enabled', array($this->getDi()->config->get('lang.default', 'en'))));
        /* @var $lang HTML_QuickForm2_Element */
        $lang = $form->addElement('select', 'lang')->setId('lang')->setLabel(___('Language'))->loadOptions($langOptions);
        if (count($langOptions) == 1) {
            $lang->toggleFrozen(true);
        }
        $lang->addRule('required');
        if ($options = $this->getDi()->emailTemplateLayoutTable->getOptions()) {
            $form->addSelect('email_template_layout_id')->setLabel(___('Layout'))->loadOptions(array('' => ___('No Layout')) + $options);
        }
        $tt = Am_Mail_TemplateTypes::getInstance()->find($this->getParam('name'));
        if ($tt && !empty($tt['isAdmin'])) {
            $op = array('-1' => Am_Controller::escape(sprintf('%s <%s>', Am_Di::getInstance()->config->get('site_title') . ' Admin', Am_Di::getInstance()->config->get('admin_email'))));
            foreach (Am_Di::getInstance()->adminTable->findBy() as $admin) {
                $op[$admin->pk()] = Am_Controller::escape(sprintf('%s <%s>', $admin->getName(), $admin->email));
            }
            $form->addMagicSelect('_admins', array('value' => 'default'))->setLabel(___('Admin Recipients'))->loadOptions($op)->addRule('required');
        } else {
            $form->addText('bcc', array('class' => 'el-wide', 'placeholder' => ___('Email Addresses Separated by Comma')))->setLabel(___("BCC\n" . "blind carbon copy allows the sender of a message to conceal the person entered in the Bcc field from the other recipients"))->addRule('callback', ___('Please enter valid e-mail addresses'), array('Am_Validate', 'emails'));
        }
        $form->addScript()->setScript(<<<CUT
\$("#checkbox-recipient-other").change(function(){
\$("#row-input-recipient-emails").toggle(this.checked);
}).change();
CUT
);
        $body = $form->addElement(new Am_Form_Element_MailEditor($this->getParam('name')));
        $form->addElement('hidden', 'label')->setValue($this->getParam('label'));
        return $form;
    }
开发者ID:grlf,项目名称:eyedock,代码行数:35,代码来源:AdminEmailTemplatesController.php

示例6: createForm

    protected function createForm()
    {
        $f = new Am_Form_Admin();
        $f->addText('user')->setLabel('Enter username of existing user')->addRule('required', 'This field is required');
        $f->addText('aff')->setLabel('Enter username of existing affiliate')->addRule('required', 'This field is required');
        $f->addMagicSelect('product_ids')->setLabel('Choose products to include into test invoice')->loadOptions(Am_Di::getInstance()->productTable->getOptions())->addRule('required', 'This field is required');
        $f->addSubmit('', array('value' => 'Test'));
        $f->addScript()->setScript(<<<CUT
\$(function(){
    \$("#user-0, #aff-0" ).autocomplete({
        minLength: 2,
        source: window.rootUrl + "/admin-users/autocomplete"
    });
});            
CUT
);
        foreach ($this->grid->getVariablesList() as $k) {
            $kk = $this->grid->getId() . '_' . $k;
            if ($v = @$_REQUEST[$kk]) {
                $f->addHidden($kk)->setValue($v);
            }
        }
        return $f;
    }
开发者ID:subashemphasize,项目名称:test_site,代码行数:24,代码来源:AdminCommissionController.php


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