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


PHP Am_Form_Admin::addStatic方法代碼示例

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


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

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

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

示例3: getTokenAction

 public function getTokenAction()
 {
     $form = new Am_Form_Admin();
     $form->addStatic()->setContent('Your [www.amember.com] account information');
     $login = $form->addText('login', array('size' => 40))->setLabel(___('Username or e-mail address'));
     $login->addRule('required');
     $form->addPassword('pass', array('size' => 40))->setLabel(___('Password'))->addRule('required');
     $form->addSubmit('', array('value' => ___('Login')));
     if ($form->isSubmitted() && $form->validate()) {
         $req = new Am_HttpRequest('http://www.amember.com/check-upgrades.php', Am_HttpRequest::METHOD_POST);
         $req->addPostParameter('do', 'get-token');
         $vars = $form->getValue();
         $req->addPostParameter('login', $vars['login']);
         $req->addPostParameter('pass', $vars['pass']);
         $req->addPostParameter('license', $this->getDi()->config->get('license'));
         try {
             $response = $req->send();
             if ($response->getStatus() == '401') {
                 throw new HTTP_Request2_Exception("Authentication failed: " . $response->getBody());
             }
             if ($response->getStatus() != '200') {
                 throw new HTTP_Request2_Exception("Wrong status: " . $response->getStatus());
             }
             if ($response->getBody() <= 10000) {
                 throw new HTTP_Request2_Exception("Wrong token returned: not a number" . Am_Controller::escape($response->getBody()));
             }
             $ok = true;
         } catch (HTTP_Request2_Exception $e) {
             $login->setError('Cannot get token: ' . $e->getMessage());
             $ok = false;
         }
         if ($ok) {
             $this->getDi()->store->set('amember-site-auth-token', (int) $response->getBody());
             $this->_redirect('admin-upgrade');
         }
     }
     $this->view->title = ___('Account Verification');
     $this->view->content = (string) $form;
     $this->view->display('admin/layout.phtml');
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:40,代碼來源:AdminUpgradeController.php

示例4: createForm

    function createForm()
    {
        $form = new Am_Form_Admin();
        $record = $this->getRecord();
        $plugins = $this->getDi()->plugins_newsletter->loadEnabled()->getAllEnabled();
        if ($record->isLoaded()) {
            if ($record->plugin_id) {
                $group = $form->addFieldset();
                $group->setLabel(ucfirst($record->plugin_id));
                $form->addStatic()->setLabel(___('Plugin List Id'))->setContent(Am_Controller::escape($record->plugin_list_id));
            }
        } else {
            if (count($plugins) > 1) {
                $sel = $form->addSelect('plugin_id')->setLabel(___('Plugin'));
                $sel->addOption(___('Standard'), '');
                foreach ($plugins as $pl) {
                    if (!$pl->canGetLists() && $pl->getId() != 'standard') {
                        $sel->addOption($pl->getTitle(), $pl->getId());
                    }
                }
            }
            foreach ($plugins as $pl) {
                $group = $form->addFieldset($pl->getId())->setId('headrow-' . $pl->getId());
                $group->setLabel($pl->getTitle());
            }
            $form->addText('plugin_list_id')->setLabel(___("Plugin List Id\nvalue required"));
            $form->addScript()->setScript(<<<END
\$(function(){
    function showHidePlugins(el, skip)
    {
        var txt = \$("input[name='plugin_list_id']");
        var enabled = el.size() && (el.val() != '');
        txt.closest(".row").toggle(enabled);
        if (enabled)
            txt.rules("add", { required : true});
        else if(skip)
            txt.rules("remove", "required");
        var selected = (el.size() && el.val()) ? el.val() : 'standard';
        \$("[id^='headrow-']").hide();
        \$("[id=headrow-"+selected+"-legend]").show();
        \$("[id=headrow-"+selected+"-pluginoptions]").show();
        \$("[id=headrow-"+selected+"]").show();
    }
    \$("select[name='plugin_id']").change(function(){
        showHidePlugins(\$(this), true);
    });
    showHidePlugins(\$("select[name='plugin_id']"), false);
});
END
);
        }
        $form->addText('title', array('class' => 'el-wide'))->setLabel(___('Title'))->addRule('required');
        $form->addText('desc', array('class' => 'el-wide'))->setLabel(___('Description'));
        $form->addAdvCheckbox('hide')->setLabel(___("Hide\n" . "do not display this item in members area"));
        $form->addAdvCheckbox('auto_subscribe')->setLabel(___("Auto-Subscribe users to list\n" . "once it becomes accessible for them"));
        foreach ($plugins as $pl) {
            $group = $form->addElement(new Am_Form_Container_PrefixFieldset('_vars'))->setId('headrow-' . $pl->getId() . '-pluginoptions');
            $gr = $group->addElement(new Am_Form_Container_PrefixFieldset($pl->getId()));
            $pl->getIntegrationFormElements($gr);
        }
        $group = $form->addFieldset('access')->setLabel(___('Access'));
        $group->addElement(new Am_Form_Element_ResourceAccess())->setName('_access')->setLabel(___('Access Permissions'))->setAttribute('without_free_without_login', 'true')->setAttribute('without_period', 'true');
        return $form;
    }
開發者ID:grlf,項目名稱:eyedock,代碼行數:64,代碼來源:Newsletter.php

示例5: createForm

    public function createForm()
    {
        $form = new Am_Form_Admin();
        $record = $this->getRecord();
        $name = empty($record->name) ? $this->getCompleteRequest()->getFiltered('name') : $record->name;
        $form->addHidden('name');
        $form->addStatic()->setContent(nl2br($this->comment[$name]))->setLabel(___('Description'));
        $form->addStatic()->setLabel(___('E-Mail Type'))->setContent($name);
        $recipient = $form->addGroup(null)->setLabel(___('Recipients'));
        $recipient->addAdvCheckbox('recipient_user')->setContent(___('User Email'));
        $recipient->addStatic()->setContent('<br>');
        $recipient->addAdvCheckbox('recipient_admin')->setContent(___('Admin Email'));
        $recipient->addStatic()->setContent('<br>');
        $recipient->addAdvCheckbox('recipient_other', array('id' => 'checkbox-recipient-other'))->setContent(___('Other'));
        $form->addText('recipient_emails', array('class' => 'el-wide', 'id' => 'input-recipient-emails', 'placeholder' => ___('Email Addresses Separated by Comma')))->setLabel(___('Emails'))->addRule('callback2', ___('Please enter valid e-mail addresses'), array($this, 'validateOtherEmails'));
        $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
);
        $form->addElement(new Am_Form_Element_MailEditor($name, array('upload-prefix' => 'email-messages')));
        switch ($name) {
            case EmailTemplate::AUTORESPONDER:
                $access_desc = ___('Send E-Mail if customer has subscription (required)');
                break;
            case EmailTemplate::EXPIRE:
                $access_desc = ___('Send E-Mail when subscription expires (required)');
                break;
            case EmailTemplate::PRODUCTWELCOME:
                $access_desc = ___('Send E-Mail when the next subscription is started (required)');
                break;
        }
        $access_el = $form->addElement(new Am_Form_Element_ResourceAccess('_access'))->setLabel($access_desc)->setAttribute('without_period', true)->setAttribute('without_free', true);
        $group = $form->addGroup()->setLabel(___('Send E-Mail only if customer has no subscription (optional)'));
        $select = $group->addMagicSelect('_not_conditions', array('class' => 'am-combobox'))->setAttribute('without_period', true)->setAttribute('without_free', true);
        $this->addCategoriesProductsList($select);
        $group->addAdvCheckbox('not_conditions_expired')->setContent(___('check expired subscriptions too'));
        if ($name != EmailTemplate::PRODUCTWELCOME) {
            $group = $form->addGroup('day')->setLabel(___('Send E-Mail Message'));
            $options = $name == EmailTemplate::AUTORESPONDER ? array('' => ___('..th subscription day (starts from 2)'), '1' => ___('immediately after subscription is started')) : array('-' => ___('days before expiration'), '0' => ___('on expiration day'), '+' => ___('days after expiration'));
            $group->addInteger('count', array('size' => 3, 'id' => 'days-count'));
            $group->addSelect('type', array('id' => 'days-type'))->loadOptions($options);
            $group->addScript()->setScript(<<<CUT
\$("#days-type").change(function(){
    var sel = \$(this);
    if (\$("input[name='name']").val() == 'autoresponder')
        \$("#days-count").toggle( sel.val() != '1' );
    else
        \$("#days-count").toggle( sel.val() != '0' );
}).change();
CUT
);
        }
        return $form;
    }
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:57,代碼來源:AdminContentController.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: importAction

 function importAction()
 {
     $form = new Am_Form_Admin();
     $import = $form->addFile('import')->setLabel('Upload file [email-templates.xml]');
     $form->addStatic('')->setContent('WARNING! All existing e-mail templates will be removed from database!');
     //$import->addRule('required', 'Please upload file');
     //$form->addAdvCheckbox('remove')->setLabel('Remove your existing templates?');
     $form->addSaveButton(___('Upload'));
     if ($form->isSubmitted() && $form->validate()) {
         $value = $form->getValue();
         $fn = DATA_DIR . '/import.email-templates.xml';
         if (!move_uploaded_file($value['import']['tmp_name'], $fn)) {
             throw new Am_Exception_InternalError("Could not move uploaded file");
         }
         $xml = file_get_contents($fn);
         if (!$xml) {
             throw new Am_Exception_InputError("Could not read XML");
         }
         $count = $this->getDi()->emailTemplateTable->deleteBy(array())->importXml($xml);
         $this->view->content = "Import Finished. {$count} templates imported.";
     } else {
         $this->view->content = (string) $form;
     }
     $this->view->title = "Import E-Mail Templates from XML file";
     $this->view->display('admin/layout.phtml');
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:26,代碼來源:AdminEmailTemplatesController.php

示例8: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='ym:id'");
     $memberTypes = unserialize($this->db_yourmembers->selectCell("SELECT option_value  FROM ?_options where option_name='ym_packs'"));
     $total = $memberTypes->getCount();
     if ($imported_products >= $total) {
         $cb = $form->addStatic()->setContent("Imported ({$imported_products} of {$total})");
     } else {
         $cb = $form->addRadio('import', array('value' => 'product'));
     }
     $cb->setLabel('Import Products');
     // Import coupons
     $imported_coupons = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='coupon' AND `key`='ym:id'");
     $totalc = $this->db_yourmembers->selectCell("SELECT COUNT(*) FROM ?_ym_coupon");
     if ($imported_products) {
         if ($imported_coupons >= $totalc) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_coupons} of {$totalc})");
         } else {
             $cb = $form->addRadio('import', array('value' => 'coupon'));
         }
         $cb->setLabel('Import Coupons');
     }
     if ($imported_products && ($imported_coupons || !$totalc)) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='ym:id'");
         $total = $this->db_yourmembers->selectCell("SELECT COUNT(*) FROM ?_users");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
         }
         $cb->setLabel('Import User and Payment Records');
     }
     $form->addSaveButton('Run');
     $defaults = array();
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:44,代碼來源:AdminImportYourMembersController.php

示例9: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='am3:id'");
     $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_products");
     if ($imported_products >= $total) {
         $cb = $form->addStatic()->setContent("Imported ({$imported_products} of {$total})");
     } else {
         $cb = $form->addRadio('import', array('value' => 'product'));
     }
     $cb->setLabel('Import Products');
     if ($imported_products) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='am3:id'");
         $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_members");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
             $cb->addStatic()->setContent('<br />Do not import pending users');
             $cb->addCheckbox('user[exclude_pending]');
         }
         $cb->setLabel('Import User and Payment Records');
         if ($imported_users) {
             if ($this->getDi()->modules->isEnabled('aff')) {
                 $imported_comm = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='aff_commission' AND `key`='am3:id'");
                 $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_aff_commission");
                 $gr = $form->addGroup()->setLabel('Import Affiliate Commissions and Refs');
                 if ($imported_comm) {
                     $gr->addStatic()->setContent("Imported ({$imported_comm} of {$total})");
                 } else {
                     $gr->addRadio('import', array('value' => 'aff'));
                 }
             } else {
                 $form->addStatic()->setContent('Enable [aff] module in Setup/Configuration to import information');
             }
             if ($this->getDi()->modules->isEnabled('newsletter')) {
                 $form->addRadio('import', array('value' => 'newsletter'))->setLabel('Import Newsletter Threads and Subscriptions');
             } else {
                 $form->addStatic()->setContent('Enable [newsletter] module in Setup/Configuration to import information');
             }
         }
     }
     $form->addSaveButton('Run');
     $defaults = array();
     return $form;
 }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:53,代碼來源:AdminImport3Controller.php

示例10: createForm

    public function createForm()
    {
        $form = new Am_Form_Admin();
        $record = $this->getRecord();
        $name = empty($record->name) ? $this->getCompleteRequest()->getFiltered('name') : $record->name;
        $form->addHidden('name');
        $form->addStatic()->setContent(nl2br($this->comment[$name]))->setLabel(___('Description'));
        $form->addStatic()->setLabel(___('E-Mail Type'))->setContent($name);
        $form->addElement(new Am_Form_Element_MailEditor($name));
        $form->addElement(new Am_Form_Element_ResourceAccess('_access'))->setAttribute('without_period', true)->setLabel(___('Access Permissions'));
        $group = $form->addGroup('day')->setLabel(___('Send E-Mail Message'));
        $options = $name == EmailTemplate::AUTORESPONDER ? array('' => ___('..th subscription day (starts from 1)'), '1' => ___('immediately after purchase')) : array('-' => ___('days before expiration'), '0' => ___('on expiration day'), '+' => ___('days after expiration'));
        $group->addInteger('count', array('size' => 3, 'id' => 'days-count'));
        $group->addSelect('type', array('id' => 'days-type'))->loadOptions($options);
        $group->addScript()->setScript(<<<CUT
\$("#days-type").change(function(){
    var sel = \$(this);
    if (\$("input[name='name']").val() == 'autoresponder')
        \$("#days-count").toggle( sel.val() != '1' );  
    else
        \$("#days-count").toggle( sel.val() != '0' );  
}).change();
CUT
);
        return $form;
    }
開發者ID:subashemphasize,項目名稱:test_site,代碼行數:26,代碼來源:AdminContentController.php

示例11: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='am3:id'");
     $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_products");
     if ($total_products = $this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_product")) {
         $form->addStatic()->setLabel(___('Clean up v4 Database'))->setContent(sprintf(___('Use this %slink%s to delete data from aMember v4 database and use clean database for import'), '<a href="' . REL_ROOT_URL . '/admin-import3/clean">', '</a>'));
     }
     $cb = $form->addGroup();
     if ($imported_products >= $total) {
         $cb->addStatic()->setContent("Imported ({$imported_products} of {$total})");
     } else {
         $cb->addRadio('import', array('value' => 'product'));
     }
     $cb->setLabel('Import Products');
     $cb->addStatic()->setContent('<br />Keep the same Product  IDs');
     $keep_id_chkbox = $cb->addCheckbox('product[keep_product_id]');
     if ($imported_products < $total && $this->db3->selectCell("SELECT COUNT(*) FROM ?_products WHERE data like '%subusers_count%'") && !in_array('subusers', $this->getDi()->modules->getEnabled())) {
         $cb->addStatic()->setContent('<br />Enable [subusers] module in Setup/Configuration to import subusers information');
     }
     if ($total_products) {
         $keep_id_chkbox->setAttribute('disabled');
         $cb->addStatic()->setContent('Product table have records already. Please use Clean Up if you want to keep the same product IDs');
     }
     // Import coupons
     $imported_coupons = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='coupon' AND `key`='am3:id'");
     $totalc = $this->db3->selectCell("SELECT COUNT(*) FROM ?_coupon");
     if ($imported_products) {
         if ($imported_coupons >= $totalc) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_coupons} of {$totalc})");
         } else {
             $cb = $form->addRadio('import', array('value' => 'coupon'));
         }
         $cb->setLabel('Import Coupons');
     }
     //import folders without actual protection
     /*if ($imported_products)
       {
           $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_folders");
           if ($total){
               $cb = $form->addRadio('import', array('value' => 'folder'));
               $cb->setLabel('Import Folders');
           }
       }
       //import integrations
       if ($imported_products)
       {
           $cb = $form->addRadio('import', array('value' => 'integration'));
           $cb->setLabel('Import Integrations');
       }
       //import product links
       if ($imported_products)
       {
           $cb = $form->addRadio('import', array('value' => 'productlinks'));
           $cb->setLabel('Import Product Links');
       }*/
     if ($imported_products && ($imported_coupons || !$totalc)) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='am3:id'");
         $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_members");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
             $cb->addStatic()->setContent('<br />Do not import pending users');
             $cb->addCheckbox('user[exclude_pending]');
             $cb->addStatic()->setContent('<br />Keep the same user IDs');
             $keep_id_chkbox = $cb->addCheckbox('user[keep_user_id]');
             if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_user")) {
                 $keep_id_chkbox->setAttribute('disabled');
                 $cb->addStatic()->setContent('User database have records already. Please use Clean Up if you want to keep the same user IDs');
             }
         }
         $cb->setLabel('Import User and Payment Records');
         if ($imported_users) {
             if ($this->getDi()->modules->isEnabled('aff')) {
                 $imported_comm = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='aff_commission' AND `key`='am3:id'");
                 $total = $this->db3->selectCell("SELECT COUNT(*) FROM ?_aff_commission");
                 $imported_clicks = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='aff_click' AND `key`='am3:id'");
                 $total_clicks = $this->db3->selectCell("SELECT COUNT(*) FROM ?_aff_clicks");
                 $gr = $form->addGroup()->setLabel('Import Affiliate Commissions and Refs');
                 if ($imported_comm >= $total) {
                     $gr->addStatic()->setContent("Imported ({$imported_comm} of {$total})");
                 } else {
                     if ($imported_comm) {
                         $gr->addStatic()->setContent("partially imported ({$imported_comm} of {$total} total)<br /><br />");
                     }
                     $gr->addRadio('import', array('value' => 'aff'));
                 }
                 $gr = $form->addGroup()->setLabel('Import Affiliate Clicks');
                 if ($imported_clicks >= $total_clicks) {
                     $gr->addStatic()->setContent("Imported ({$imported_clicks} of {$total_clicks})");
                 } else {
                     if ($imported_clicks) {
//.........這裏部分代碼省略.........
開發者ID:alexanderTsig,項目名稱:arabic,代碼行數:101,代碼來源:AdminImport3Controller.php

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

示例13: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='oss6:id'");
     $total = $this->db_oss->selectCell("SELECT COUNT(*) FROM ?_groups");
     if ($imported_products >= $total) {
         $cb = $form->addStatic()->setContent("Imported ({$imported_products} of {$total})");
     } else {
         $cb = $form->addRadio('import', array('value' => 'product'));
     }
     $cb->setLabel('Import Products');
     if ($imported_products) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='oss6:id'");
         $total = $this->db_oss->selectCell("SELECT COUNT(*) FROM ?_users");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
         }
         $cb->setLabel('Import User and Payment Records');
     }
     $form->addSaveButton('Run');
     $defaults = array();
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:32,代碼來源:AdminImportOss6Controller.php

示例14: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='wom:id'");
     $wopCfg = $this->db_wordpress->selectCell("SELECT option_value FROM ?_options WHERE option_name = ?", 'ws_plugin__optimizemember_options');
     $wopCfg = unserialize($wopCfg);
     if (is_array($wopCfg)) {
         $amProducts = array('' => '-- Please Select --') + $this->getDi()->productTable->getOptions();
         $womProducts = array();
         for ($i = 0; $i <= 10; $i++) {
             $womProducts['level' . ($i ? $i : '')] = $wopCfg['level' . $i . '_label'];
         }
         if ($imported_products) {
             $cb = $form->addStatic()->setContent("Linked");
         } else {
             $cb = $form->addRadio('import', array('value' => 'product'));
             foreach ($womProducts as $key => $value) {
                 $form->addSelect("pr_link[" . $key . "]")->setLabel($value)->loadOptions($amProducts);
             }
             $form->addRule('callback2', '-error-', array($this, 'validateForm'));
         }
         $cb->setLabel('Link Products');
     }
     if (!is_array($wopCfg) || $imported_products) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='wom:id'");
         $total = $this->db_wordpress->selectCell("SELECT COUNT(*) FROM ?_users");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
             $cb->addStatic()->setContent('<br />Keep the same user IDs');
             $keep_id_chkbox = $cb->addCheckbox('user[keep_user_id]');
             if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_user")) {
                 $keep_id_chkbox->setAttribute('disabled');
                 $cb->addStatic()->setContent('User database have records already. Please use Clean Up if you want to keep the same user IDs');
             }
         }
         $cb->setLabel('Import User and Payment Records');
     }
     $form->addSaveButton('Run');
     $defaults = array();
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:50,代碼來源:AdminImportWordpressOptimizeMemberController.php

示例15: createImportForm

 function createImportForm(&$defaults)
 {
     $form = new Am_Form_Admin();
     /** count imported */
     $imported_products = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='product' AND `key`='ipb_nexus:id'");
     $total = $this->db_ipb_nexus->selectCell("SELECT COUNT(*) FROM ?_nexus_packages");
     if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_product")) {
         $form->addStatic()->setLabel(___('Clean up v4 Database'))->setContent(sprintf(___('Use this %slink%s to delete data from aMember v4 database and use clean database for import'), '<a href="' . REL_ROOT_URL . '/admin-import-ipb-nexus/clean">', '</a>'));
     }
     if ($imported_products >= $total) {
         $cb = $form->addStatic()->setContent("Imported ({$imported_products} of {$total})");
     } else {
         $cb = $form->addRadio('import', array('value' => 'product'));
     }
     $cb->setLabel('Import Products');
     if ($imported_products) {
         $imported_users = $this->getDi()->db->selectCell("SELECT COUNT(id) FROM ?_data WHERE `table`='user' AND `key`='ipb_nexus:id'");
         $total = $this->db_ipb_nexus->selectCell("SELECT COUNT(*) FROM ?_members");
         if ($imported_users >= $total) {
             $cb = $form->addStatic()->setContent("Imported ({$imported_users})");
         } else {
             $cb = $form->addGroup();
             if ($imported_users) {
                 $cb->addStatic()->setContent("partially imported ({$imported_users} of {$total} total)<br /><br />");
             }
             $cb->addRadio('import', array('value' => 'user'));
             $cb->addStatic()->setContent('<br /><br /># of users (keep empty to import all) ');
             $cb->addInteger('user[count]');
         }
         $cb->setLabel('Import User and Payment Records');
     }
     $form->addSaveButton('Run');
     $defaults = array();
     return $form;
 }
開發者ID:grlf,項目名稱:eyedock,代碼行數:35,代碼來源:AdminImportIpbNexusController.php


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