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


PHP Am_Form_Admin::addGroup方法代码示例

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


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

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

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

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

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

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

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

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

示例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`='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

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

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

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

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

示例14: stepConfirmUpgrades

 public function stepConfirmUpgrades()
 {
     $form = new Am_Form_Admin();
     $upgrades = $form->addGroup('upgrades', array('class' => 'no-label'));
     $options = array();
     $static = '';
     $upgrades->addStatic()->setContent('<h2>' . ___('Available Upgrades') . '</h2>');
     foreach ($this->getSession()->upgrades as $k => $upgrade) {
         if (!empty($upgrade->new)) {
             $upgrades->addStatic()->setContent('<br /><h2>' . ___('New Modules Available') . '</h2>');
         }
         $text = sprintf('%s%s, ' . ___('version') . ' %s - %s' . '<br />', '<b>' . $upgrade->title . '</b>', $upgrade->type == 'core' ? '' : sprintf(' [%s - %s]', $upgrade->type, $upgrade->id), '<i>' . $upgrade->version . '</i>', '<i>' . amDate($upgrade->date) . '</i>');
         $upgrades->addCheckbox($k, empty($upgrade->checked) ? null : array('checked' => 'checked'))->setContent($text);
         $static .= "<div class='changelog' style='' data-for='{$k}'><pre>" . $upgrade->text . "</pre></div>\n";
         $upgrades->addStatic()->setContent($static);
     }
     $form->addCheckbox('_confirm', array('class' => 'no-label'))->setContent(___('I understand that upgrade may overwrite customized PHP files and templates, I have already made a backup of aMember Pro folder and database'))->addRule('required');
     $form->addSubmit('', array('value' => ___('Install Updates')));
     if ($form->isSubmitted() && $form->validate()) {
         $confirmed = array_keys(array_filter($upgrades->getValue()));
         if (!$confirmed) {
             $this->view->title = ___('No upgrades to install');
             $this->view->content = '<a href="' . REL_ROOT_URL . '/admin">' . ___('Back') . '</a>';
             return false;
         }
         $upgrades = $this->getSession()->upgrades;
         foreach ($upgrades as $k => $v) {
             if (!in_array($k, $confirmed)) {
                 unset($upgrades[$k]);
             }
         }
         $this->getSession()->upgrades = $upgrades;
         return true;
     } else {
         $this->view->content = (string) $form;
         $this->view->title = ___('Choose Upgrades to Install');
         $this->view->display('admin/layout.phtml');
         $this->noDisplay = true;
         return false;
     }
 }
开发者ID:subashemphasize,项目名称:test_site,代码行数:41,代码来源:AdminUpgradeController.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`='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


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