當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Am_Form_Admin類代碼示例

本文整理匯總了PHP中Am_Form_Admin的典型用法代碼示例。如果您正苦於以下問題:PHP Am_Form_Admin類的具體用法?PHP Am_Form_Admin怎麽用?PHP Am_Form_Admin使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Am_Form_Admin類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is Disabled?'));
     $form->addText("title")->setLabel(___("Title"))->addRule('required');
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:8,代碼來源:AdminCountriesController.php

示例2: createForm

 public function createForm(Am_Grid_Editable $grid)
 {
     $id = substr($grid->getId(), 1);
     $form = new Am_Form_Admin();
     $form->addText("value", array('size' => 40))->setLabel(___("Value\nuse % as wildcard mask"));
     $form->addHidden("type")->setValue($id);
     $form->addText('comment', array('size' => 40))->setLabel(___("Comment"));
     return $form;
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:9,代碼來源:AdminBanController.php

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

示例4: createForm

 public function createForm()
 {
     $form = new Am_Form_Admin();
     $options = Am_Currency::getSupportedCurrencies();
     array_remove_value($options, Am_Currency::getDefault());
     $sel = $form->addSelect('currency', array('class' => 'am-combobox'))->setLabel(___('Currency'))->loadOptions($options)->addRule('required');
     $date = $form->addDate('date')->setLabel(___('Date'))->addRule('required')->addRule('callback2', "--wrong date--", array($this, 'checkDate'));
     $rate = $form->addText('rate', array('length' => 8))->setLabel(___("Exchange Rate\nenter cost of 1 (one) %s", Am_Currency::getDefault()))->addRule('required');
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:10,代碼來源:AdminCurrencyExchangeController.php

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

示例6: createForm

    public function createForm()
    {
        $mainForm = new Am_Form_Admin();
        $form = $mainForm->addFieldset()->setLabel(___('Admin Settings'));
        $login = $form->addText('login')->setLabel(___('Admin Username'));
        $login->addRule('required')->addRule('length', ___('Length of username must be from %d to %d', 4, 16), array(4, 16))->addRule('regex', ___('Admin username must be alphanumeric in small caps'), '/^[a-z][a-z0-9_-]+$/');
        $set = $form->addGroup()->setLabel(___('First and Last Name'));
        $set->setSeparator(' ');
        $set->addText('name_f');
        $set->addText('name_l');
        $pass = $form->addPassword('_passwd')->setLabel(___('New Password'));
        $pass->addRule('length', ___('Length of admin password must be from %d to %d', 6, 16), array(6, 16));
        $pass->addRule('neq', ___('Password must not be equal to username'), $login);
        $pass0 = $form->addPassword('_passwd0')->setLabel(___('Confirm New Password'));
        $pass0->addRule('eq', ___('Passwords must be the same'), $pass);
        $form->addText('email')->setLabel(___('E-Mail Address'))->addRule('required');
        $super = $form->addAdvCheckbox('super_user')->setId('super-user')->setLabel(___('Super Admin'));
        //Only Super Admin has access to this page
        $record = $this->grid->getRecord();
        if ($this->getDi()->authAdmin->getUserId() == $record->get('admin_id')) {
            $super->toggleFrozen(true);
        }
        if ($this->getDi()->authAdmin->getUserId() != $record->get('admin_id')) {
            $group = $form->addGroup('perms')->setId('perms')->setLabel(___('Permissions'))->setSeparator('<br />');
            foreach ($this->getDi()->authAdmin->getPermissionsList() as $perm => $title) {
                if (is_string($title)) {
                    $group->addCheckbox($perm)->setContent($title);
                } else {
                    $gr = $group->addGroup($perm);
                    $gr->addStatic()->setContent('<div>');
                    $gr->addStatic()->setContent('<strong>' . $title['__label'] . '</strong>');
                    $gr->addStatic()->setContent('<div style="padding-left:1em">');
                    unset($title['__label']);
                    foreach ($title as $k => $v) {
                        $gr->addCheckbox($k)->setContent($v);
                        $gr->addStatic()->setContent(' ');
                    }
                    $gr->addStatic()->setContent('</div>');
                    $gr->addStatic()->setContent('</div>');
                }
            }
            $mainForm->addScript()->setScript(<<<CUT
\$('#super-user').change(function(){
    \$('#row-perms').toggle(!this.checked);
}).change();
CUT
);
        }
        $self_password = $mainForm->addFieldset()->setLabel(___('Authentification'))->addPassword('self_password')->setLabel(___("Your Password\n" . "enter your current password\n" . "in order to edit admin record"));
        $self_password->addRule('callback', ___('Wrong password'), array($this, 'checkSelfPassword'));
        return $mainForm;
    }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:52,代碼來源:AdminAdminsController.php

示例7: createForm

 public function createForm($grid)
 {
     $form = new Am_Form_Admin();
     $name = $form->addText('name', array('class' => 'el-wide'))->setLabel(___('Title'));
     $r = $grid->getRecord();
     if ($r->isLoaded() && $r->pk() < self::DEFAULT_LAYOUT_THRESHOLD) {
         $name->toggleFrozen('true');
     } else {
         $name->addRule('required');
     }
     $form->addTextarea('layout', array('rows' => 25, 'class' => 'row-wide el-wide'))->setLabel(___("Layout\n" . "use placholder %content% for email output"))->addRule('callback', ___('Your layout has not %content% placeholder'), array($this, 'checkLayout'));
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:13,代碼來源:AdminEmailTemplateLayoutController.php

示例8: getTransForm

 protected function getTransForm($text)
 {
     $trans = $this->getTrans($text);
     $lgList = $this->getDi()->languagesListUser;
     $form = new Am_Form_Admin();
     $form->setAction($this->getUrl(null, 'update-trans'));
     $default = $this->getDi()->config->get('lang.default', 'en');
     $form->addStatic('text_default')->setContent(sprintf("<div>%s</div>", $this->escape($text)));
     foreach ($trans as $lg => $t) {
         if ($lg != $default) {
             $form->addElement('textarea', 'trans[' . $lg . ']', array('class' => 'el-wide'))->setLabel($lgList[$lg])->setValue($t);
         }
     }
     $form->addElement('hidden', 'text')->setValue($text);
     return (string) $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:16,代碼來源:AdminTransLocalController.php

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

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

示例11: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->addInteger("tag")->setLabel(___("Sort order"))->addRule('required');
     $form->addAdvCheckbox('_is_disabled')->setLabel(___('Is&nbsp;Disabled?'));
     $form->addText('title')->setLabel(___('Title'))->addRule('required');
     if (!$this->grid->getRecord()->pk()) {
         $gr = $form->addGroup();
         $gr->addStatic()->setContent('<span>' . $this->country . '-</span>');
         $gr->addText('state', array('size' => 5))->addRule('required');
         $gr->setLabel(___('Code'));
     }
     $form->addHidden('country');
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:15,代碼來源:AdminStatesController.php

示例12: createForm

 /**
  * Add elements to config form
  * no need to add "time" controls
  */
 protected function createForm()
 {
     $form = new Am_Form_Admin('form-' . $this->getId());
     $form->addDataSource(new HTML_QuickForm2_DataSource_Array($this->getFormDefaults()));
     $form->setAction(REL_ROOT_URL . '/admin-reports/run/report_id/' . $this->getId());
     if ($this->getPointFieldType() == self::POINT_DATE) {
         $start = $form->addElement('Date', 'start')->setLabel(___('Start'));
         $start->addRule('required');
         $stop = $form->addElement('Date', 'stop')->setLabel(___('End'));
         $stop->addRule('required');
         $form->addRule('callback', 'Start Date cannot be later than the End Date', array($this, 'checkStopDate'));
         $quant = $form->addElement('Select', 'quant')->setLabel(___('Quantity'));
         $quant->addRule('required');
         $quant->loadOptions($this->getQuantityOptions());
     }
     $this->_initConfigForm($form);
     $form->addSubmit('save', array('value' => ___('Run Report')));
     return $form;
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:23,代碼來源:Report.php

示例13: createForm

 function createForm()
 {
     $form = new Am_Form_Admin();
     $form->setAction($this->getUrl(null, 'clear'));
     $form->addDate('dat')->setLabel(___("Date to Purge\nall records prior to this date will be removed from selected tables"))->addRule('required');
     $section = $form->addFieldset('tables')->setLabel(___('Tables to Purge'));
     foreach ($this->getItems() as $id => $item) {
         $section->addAdvCheckbox($id)->setLabel(array($item['title'], $item['desc']));
     }
     $form->addSaveButton(___('Clear'));
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:12,代碼來源:AdminClearController.php

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

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


注:本文中的Am_Form_Admin類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。