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; } }
protected function createForm() { $f = new Am_Form_Admin(); $f->addText('user')->setLabel('Enter username of existing user')->addRule('required', 'This field is required'); $f->addText('aff')->setLabel('Enter username of existing affiliate')->addRule('required', 'This field is required'); $f->addText('coupon')->setLabel('Enter coupon code or leave field empty'); $f->addCheckbox('is_first')->setLabel('Is first user invoice?'); $f->addElement(new Am_Form_Element_ProductsWithQty('product_id'))->setLabel(___('Choose products to include into test invoice'))->loadOptions(Am_Di::getInstance()->billingPlanTable->selectAllSorted())->addRule('required'); $f->addSelect('paysys_id')->setLabel(___('Payment System'))->loadOptions(Am_Di::getInstance()->paysystemList->getOptions()); $f->addSubmit('', array('value' => 'Test')); $f->addScript()->setScript(<<<CUT \$(function(){ \$("#user-0, #aff-0" ).autocomplete({ minLength: 2, source: window.rootUrl + "/admin-users/autocomplete" }); }); CUT ); foreach ($this->grid->getVariablesList() as $k) { $kk = $this->grid->getId() . '_' . $k; if ($v = @$_REQUEST[$kk]) { $f->addHidden($kk)->setValue($v); } } return $f; }