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


PHP Am_Form_Admin::setDataSources方法代码示例

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


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

示例1: run

    public function run()
    {
        $form = new Am_Form_Admin('form-grid-config');
        $form->setAttribute('name', 'customize');
        $form->addSortableMagicSelect('fields')->loadOptions($this->getFieldsOptions())->setLabel(___('Fields to Display in Grid'))->setJsOptions(<<<CUT
{
    allowSelectAll:true,
    sortable: true
}
CUT
);
        foreach ($this->grid->getVariablesList() as $k) {
            $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
        }
        $form->addSaveButton();
        $form->setDataSources(array($this->grid->getCompleteRequest()));
        if ($form->isSubmitted()) {
            $values = $form->getValue();
            $this->setConfig($values['fields']);
            $this->grid->redirectBack();
        } else {
            $form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array('fields' => $this->getSelectedFields()))));
            echo $this->renderTitle();
            echo sprintf('<div class="info">%s</div>', ___('You can change Number of %sRecords per Page%s in section %sSetup/Configuration%s', '<strong>', '</strong>', '<a class="link" href="' . REL_ROOT_URL . '/admin-setup" target="_top">', '</a>'));
            echo $form;
        }
    }
开发者ID:grlf,项目名称:eyedock,代码行数:27,代码来源:Customize.php

示例2: run

 function run()
 {
     $form = new Am_Form_Admin('form-grid-payout');
     $form->setAttribute('name', 'payout');
     $date = $form->addDate('payout_date')->setLabel(___('Payout Date'))->setValue(sqlDate($this->getDi()->dateTime));
     foreach ($this->grid->getVariablesList() as $k) {
         $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
     }
     $form->addSaveButton(___("Run Payout"));
     $form->setDataSources(array($this->grid->getCompleteRequest()));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->getValue();
         $this->getDi()->affCommissionTable->runPayout($values['payout_date']);
         $this->grid->redirectBack();
     } else {
         echo $this->renderTitle();
         echo $form;
     }
 }
开发者ID:irovast,项目名称:eyedock,代码行数:19,代码来源:AdminPayoutController.php

示例3: changePaysysAction

 function changePaysysAction()
 {
     $form = new Am_Form_Admin();
     $form->setDataSources(array($this->_request));
     $form->addStatic()->setContent(___('If you are moving from one payment processor, you can use this page to switch existing subscription from one payment processor to another. It is possible only if full credit card info is stored on aMember side.'));
     $options = array();
     foreach ($this->getModule()->getPlugins() as $ps) {
         $options[$ps->getId()] = $ps->getTitle();
     }
     $from = $form->addSelect('from')->setLabel('Move Active Invoices From')->loadOptions($options)->addRule('required');
     $to = $form->addSelect('to')->setLabel('Move To')->loadOptions($options)->addRule('required');
     $to->addRule('neq', ___('Values must not be equal'), $from);
     $form->addSaveButton();
     if ($form->isSubmitted() && $form->validate()) {
         $vars = $form->getValue();
         $updated = $this->getDi()->db->query("UPDATE ?_invoice SET paysys_id=? WHERE paysys_id=? AND status IN (?a)", $vars['to'], $vars['from'], array(Invoice::RECURRING_ACTIVE));
         $this->view->content = "{$updated} rows changed. New rebills for these invoices will be handled with [{$vars['to']}]";
     } else {
         $this->view->content = (string) $form;
     }
     $this->view->title = ___("Change Paysystem");
     $this->view->display('admin/layout.phtml');
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:23,代码来源:AdminController.php

示例4: run

 function run()
 {
     $form = new Am_Form_Admin('form-vomm-void');
     $form->setAttribute('name', 'void');
     $comm = $this->grid->getRecord();
     $form->addText('amount', array('size' => 6))->setlabel(___('Void Amount'));
     foreach ($this->grid->getVariablesList() as $k) {
         $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
     }
     $g = $form->addGroup();
     $g->setSeparator(' ');
     $g->addSubmit('_save', array('value' => ___("Void")));
     $g->addStatic()->setContent(sprintf('<a href="%s" class="link" style="margin-left:0.5em">%s</a>', $this->grid->getBackUrl(), ___('Cancel')));
     $form->setDataSources(array($this->grid->getCompleteRequest(), new HTML_QuickForm2_DataSource_Array(array('amount' => $comm->amount))));
     if ($form->isSubmitted() && $form->validate()) {
         $values = $form->getValue();
         $this->void($values['amount']);
         $this->grid->redirectBack();
     } else {
         echo $this->renderTitle();
         echo $form;
     }
 }
开发者ID:grlf,项目名称:eyedock,代码行数:23,代码来源:Void.php

示例5: 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

示例6: replaceProductAction

 function replaceProductAction()
 {
     $this->getDi()->authAdmin->getUser()->checkPermission('_payment', 'edit');
     $item = $this->getDi()->invoiceItemTable->load($this->_request->getInt('id'));
     $pr = $this->getDi()->productTable->load($item->item_id);
     $form = new Am_Form_Admin('replace-product-form');
     $form->setDataSources(array($this->_request));
     $form->method = 'post';
     $form->addHidden('id');
     $form->addHidden('user_id');
     $form->addStatic()->setLabel(___('Replace Product'))->setContent("#{$pr->product_id} [{$pr->title}]");
     $sel = $form->addSelect('product_id')->setLabel('To Product');
     $options = array('' => '-- ' . ___('Please select') . ' --');
     foreach ($this->getDi()->billingPlanTable->getProductPlanOptions() as $k => $v) {
         if (strpos($k, $pr->pk() . '-') !== 0) {
             $options[$k] = $v;
         }
     }
     $sel->loadOptions($options);
     $sel->addRule('required');
     $form->addSubmit('_save', array('value' => ___('Save')));
     if ($form->isSubmitted() && $form->validate()) {
         try {
             list($p, $b) = explode("-", $sel->getValue(), 2);
             $item->replaceProduct(intval($p), intval($b));
             $this->getDi()->adminLogTable->log("Inside invoice: product #{$item->item_id} replaced to product #{$p} (plan #{$b})", 'invoice', $item->invoice_id);
             return $this->ajaxResponse(array('ok' => true));
         } catch (Am_Exception $e) {
             $sel->setError($e->getMessage());
         }
     }
     echo $form->__toString();
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:33,代码来源:AdminUserPaymentsController.php

示例7: createForm

    function createForm()
    {
        $form = new Am_Form_Admin('am-form-email');
        $form->setDataSources(array($this->getRequest()));
        $form->setAction($this->getUrl(null, 'preview'));
        if ($options = $this->getDi()->emailTemplateLayoutTable->getOptions()) {
            $form->addSelect('email_template_layout_id')->setLabel(___('Layout'))->loadOptions(array('' => ___('No Layout')) + $options);
        }
        $gr = $form->addGroup()->setLabel(___("Reply To\n" . "mailbox for replies to message"))->setSeparator(' ');
        $sel = $gr->addSelect('reply_to')->loadOptions($this->getReplyToOptions());
        $id = $sel->getId();
        $gr->addText('reply_to_other', array('placeholder' => ___('Email Address')))->setId($id . '-other')->persistentFreeze(true);
        // ??? why is it necessary? but it is
        $gr->addScript()->setScript(<<<CUT
\$('#{$id}').change(function(){
   \$('#{$id}-other').toggle(\$(this).val() == 'other');
}).change();
CUT
);
        $subj = $form->addText('subject', array('class' => 'el-wide'))->setLabel(___('Email Subject'));
        $subj->persistentFreeze(true);
        // ??? why is it necessary? but it is
        $subj->addRule('required', ___('Subject is required'));
        //        $arch = $form->addElement('advcheckbox', 'do_archive')->setLabel(array('Archive Message', 'if you are sending it to newsletter subscribers'));
        $format = $form->addGroup(null)->setLabel(___('E-Mail Format'));
        $format->setSeparator(' ');
        $format->addRadio('format', array('value' => 'html'))->setContent(___('HTML Message'));
        $format->addRadio('format', array('value' => 'text'))->setContent(___('Plain-Text Message'));
        $group = $form->addGroup('', array('id' => 'body-group', 'class' => 'no-label'))->setLabel(___('Message Text'));
        $group->addStatic()->setContent('<div class="mail-editor">');
        $group->addStatic()->setContent('<div class="mail-editor-element">');
        $group->addElement('textarea', 'body', array('id' => 'body-0', 'rows' => '15', 'class' => 'el-wide'));
        $group->addStatic()->setContent('</div>');
        $group->addStatic()->setContent('<div class="mail-editor-element">');
        $this->tagsOptions = Am_Mail_TemplateTypes::getInstance()->getTagsOptions('send_signup_mail');
        $tagsOptions = array();
        foreach ($this->tagsOptions as $k => $v) {
            $tagsOptions[$k] = "{$k} - {$v}";
        }
        $sel = $group->addSelect('', array('id' => 'insert-tags'));
        $sel->loadOptions(array_merge(array('' => ''), $tagsOptions));
        $group->addStatic()->setContent('</div>');
        $group->addStatic()->setContent('</div>');
        $fileChooser = new Am_Form_Element_Upload('files', array('multiple' => '1'), array('prefix' => 'email'));
        $form->addElement($fileChooser)->setLabel(___('Attachments'));
        foreach ($this->searchUi->getHidden() as $k => $v) {
            $form->addHidden($k)->setValue($v);
        }
        $id = 'body-0';
        $vars = "";
        foreach ($this->tagsOptions as $k => $v) {
            $vars .= sprintf("[%s, %s],\n", Am_Controller::getJson($v), Am_Controller::getJson($k));
        }
        $vars = trim($vars, "\n\r,");
        if ($this->queue_id) {
            $form->addHidden('queue_id')->setValue($this->queue_id);
        }
        $form->addScript('_bodyscript')->setScript(<<<CUT
\$(function(){
    \$('select#insert-tags').change(function(){
        var val = \$(this).val();
        if (!val) return;
        \$("#{$id}").insertAtCaret(val);
        \$(this).prop("selectedIndex", -1);
    });

    if (CKEDITOR.instances["{$id}"]) {
        delete CKEDITOR.instances["{$id}"];
    }
    var editor = null;
    \$("input[name='format']").change(function()
    {
        if (window.configDisable_rte) return;
        if (!this.checked) return;
        if (this.value == 'html')
        {
            if (!editor) {
                editor = initCkeditor("{$id}", { placeholder_items: [
                    {$vars}
                ],entities_greek: false});
            }
            \$('select#insert-tags').hide();
        } else {
            if (editor) {
                editor.destroy();
                editor = null;
            }
            \$('select#insert-tags').show();
        }
    }).change();
});

CUT
);
        $this->getDi()->hook->call(Am_Event::MAIL_SIMPLE_INIT_FORM, array('form' => $form));
        $buttons = $form->addGroup('buttons');
        $buttons->addSubmit('send', array('value' => ___('Preview')));
        return $form;
    }
开发者ID:grlf,项目名称:eyedock,代码行数:99,代码来源:AdminEmailController.php

示例8: renderConfigForms

 public function renderConfigForms()
 {
     $out = "<!-- brick config forms -->";
     foreach ($this->getBricks(self::ALL) as $brick) {
         if (!$brick->haveConfigForm()) {
             continue;
         }
         $form = new Am_Form_Admin();
         $form->setDataSources(array(new Am_Request($brick->getConfigArray())));
         $brick->initConfigForm($form);
         $out .= "<div id='brick-config-{$brick->getId()}' class='brick-config' style='display:none'>\n";
         $out .= "<h1>" . ___("%s Configuration", $brick->getName()) . "</h1>";
         $out .= (string) $form;
         $out .= "</div>\n\n";
     }
     $form = new Am_Form_Admin();
     $form->addElement('textarea', '_tpl', array('rows' => 1, 'cols' => 40))->setLabel('-label-');
     $out .= "<div id='brick-labels' style='display:none'>\n";
     $out .= "<h1>" . ___('Edit Brick Labels') . "</h1>";
     $out .= (string) $form;
     $out .= "</div>\n";
     $out .= "<!-- end of brick config forms -->";
     return $out;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:24,代码来源:BricksEditor.php

示例9: createForm

 function createForm()
 {
     $form = new Am_Form_Admin('am-form-email');
     $form->setDataSources(array($this->_request));
     $form->setAction($this->getUrl(null, 'preview'));
     $subj = $form->addElement('text', 'subject', array('size' => 80))->setLabel(array(___('Email Subject')));
     $subj->persistentFreeze(true);
     // ??? why is it necessary? but it is
     $subj->addRule('required', 'Subject is required');
     //        $arch = $form->addElement('advcheckbox', 'do_archive')->setLabel(array('Archive Message', 'if you are sending it to newsletter subscribers'));
     $format = $form->addGroup(null)->setLabel(___('E-Mail Format'));
     $format->addRadio('format', array('value' => 'html'))->setContent(___('HTML Message'));
     $format->addRadio('format', array('value' => 'text'))->setContent(___('Plain-Text Message'));
     $group = $form->addGroup('', array('id' => 'body-group', 'class' => 'no-label'))->setLabel('Message Text');
     $group->addElement('textarea', 'body', array('id' => 'body-0', 'rows' => '15', 'cols' => '80', 'style' => 'width: 90%;'));
     $fileChooser = new Am_Form_Element_Upload('files', array('multiple' => '1'), array('prefix' => 'email'));
     $form->addElement($fileChooser)->setLabel(___('Attach Uploaded File'));
     foreach ($this->searchUi->getHidden() as $k => $v) {
         $form->addHidden($k)->setValue($v);
     }
     $form->addElement('submit', 'send', array('value' => ___('Preview'), 'style' => 'width: 200px'));
     return $form;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:23,代码来源:AdminEmailController.php

示例10: createconfirmForm

 protected function createconfirmForm()
 {
     $form = new Am_Form_Admin('confirm');
     $form->setAction($this->getUrl(null, 'confirm'));
     $form->addElement('select', 'mode')->setLabel('Import Mode')->loadOptions(self::getImportModeOptions());
     $group = $form->addGroup();
     $group->addElement('inputbutton', 'back', array('value' => 'Back'))->setId('back');
     $group->addElement('submit', '_submit_', array('value' => 'Do Import'))->setId('_submit_');
     if ($form->isSubmitted()) {
         $form->setDataSources(array($this->_request));
     } else {
         $form->setDataSources(array(new HTML_QuickForm2_DataSource_Array(array())));
     }
     return $form;
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:15,代码来源:AdminImportController.php

示例11: run

    function run()
    {
        $form = new Am_Form_Admin('form-grid-merge');
        $form->setAttribute('name', 'merge');
        $user = $this->grid->getRecord();
        $login = $form->addText('login');
        $login->setId('login')->setLabel(___("Username of Source User\nmove information from"));
        $login->addRule('callback', ___('Can not find user with such username'), array($this, 'checkUser'));
        $login->addRule('callback', ___('You can not merge user with itself'), array($this, 'checkIdenticalUser'));
        $target = $form->addStatic()->setContent(sprintf('<div>%s</div>', Am_Controller::escape($user->login)));
        $target->setLabel(___("Target User\nmove information to"));
        $script = <<<CUT
        \$("input#login").autocomplete({
                minLength: 2,
                source: window.rootUrl + "/admin-users/autocomplete"
        });
CUT;
        $form->addStatic('', array('class' => 'no-label'))->setContent('<div class="info"><strong>' . ___("WARNING! Once [Merge] button clicked, all invoices, payments, logs\n" . "and other information regarding 'Source User' will be moved\n" . "to the 'Target User' account. 'Source User' account will be deleted.\n" . "There is no way to undo this operation!") . '</strong></div>');
        $form->addScript('script')->setScript($script);
        foreach ($this->grid->getVariablesList() as $k) {
            $form->addHidden($this->grid->getId() . '_' . $k)->setValue($this->grid->getRequest()->get($k, ""));
        }
        $form->addSaveButton(___("Merge"));
        $form->setDataSources(array($this->grid->getCompleteRequest()));
        if ($form->isSubmitted() && $form->validate()) {
            $values = $form->getValue();
            $this->merge($this->grid->getRecord(), Am_Di::getInstance()->userTable->findFirstByLogin($values['login']));
            $this->grid->redirectBack();
        } else {
            echo $this->renderTitle();
            echo $form;
        }
    }
开发者ID:alexanderTsig,项目名称:arabic,代码行数:33,代码来源:AdminUsersController.php

示例12: changePaysysAction

    function changePaysysAction()
    {
        $form = new Am_Form_Admin();
        $form->setDataSources(array($this->_request));
        $form->addStatic()->setContent(___('If you are moving from one payment processor, you can use this page to switch existing subscription from one payment processor to another. It is possible only if full credit card info is stored on aMember side.'));
        $ccPlugins = $echeckPlugins = array();
        foreach ($this->getModule()->getPlugins() as $ps) {
            if ($ps instanceof Am_Paysystem_CreditCard) {
                $ccPlugins[$ps->getId()] = $ps->getTitle();
            } elseif ($ps instanceof Am_Paysystem_Echeck) {
                $echeckPlugins[$ps->getId()] = $ps->getTitle();
            }
        }
        if (count($ccPlugins) < 2) {
            $ccPlugins = array();
        }
        if (count($echeckPlugins) < 2) {
            $echeckPlugins = array();
        }
        $options = array('' => '-- ' . ___('Please select') . ' --') + ($ccPlugins ? array(___('Credit Card Plugins') => $ccPlugins) : array()) + ($echeckPlugins ? array(___('Echeck Plugins') => $echeckPlugins) : array());
        $from = $form->addSelect('from', array('id' => 'paysys_from'))->setLabel('Move Active Invoices From')->loadOptions($options);
        $from->addRule('required');
        $to = $form->addSelect('to', array('id' => 'paysys_to'))->setLabel('Move To')->loadOptions($options);
        $to->addRule('required');
        $to->addRule('neq', ___('Values must not be equal'), $from);
        $form->addScript()->setScript(<<<CUT
jQuery(function(\$){
    \$("#paysys_from").on('change', function(){
        \$("#paysys_to").find('option').removeAttr("disabled");
        \$("#paysys_to").removeAttr("disabled","disabled");
        val_from = \$(this).val();
        if (!val_from){
            \$("#paysys_to").val('');
            \$("#paysys_to").attr("disabled","disabled");
            return;
        }
        val_to = \$("#paysys_to").val();

        if(val_from == val_to)
            \$("#paysys_to").val('');

        obj_to = \$("#paysys_to").find('option[value="'+\$(this).val()+'"]');
        obj_to.attr("disabled","disabled");
        \$("#paysys_to").find('optgroup[label!="'+obj_to.parent().attr('label')+'"]').find('option').attr("disabled","disabled");
    }).change();
});
CUT
);
        $form->addSaveButton();
        if ($form->isSubmitted() && $form->validate()) {
            $vars = $form->getValue();
            $updated = $this->getDi()->db->query("UPDATE ?_invoice SET paysys_id=? WHERE paysys_id=? AND status IN (?a)", $vars['to'], $vars['from'], array(Invoice::RECURRING_ACTIVE));
            $this->view->content = "{$updated} rows changed. New rebills for these invoices will be handled with [{$vars['to']}]";
        } else {
            $this->view->content = (string) $form;
        }
        $this->view->title = ___("Change Paysystem");
        $this->view->display('admin/layout.phtml');
    }
开发者ID:grlf,项目名称:eyedock,代码行数:59,代码来源:AdminController.php


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