function initActions() { $this->actionAdd(new Am_Grid_Action_Upload()); $this->actionAdd(new Am_Grid_Action_Delete()); $actionDownload = new Am_Grid_Action_Url('download', ___('Download'), Am_Controller::makeUrl('admin-upload', 'get', 'default', array('id' => '__ID__'))); $actionDownload->setTarget('_top'); $this->actionAdd($actionDownload); $this->actionAdd(new Am_Grid_Action_Group_Delete()); $this->actionAdd(new Am_Grid_Action_LiveEdit('desc')); }
public function __toString() { $output = sprintf('<div style="padding:0.5em"><h1>%s</h1><table %s><tr><th>%s</th> <th>%s</th> <th>%s</th> <th>%s</th> <th> </th></tr>', ___('Configured Tax Values'), 'class="grid"', ___('Country'), ___('State'), ___('Zip'), ___('Tax Value')); foreach ($this->regional_taxes as $id => $region) { $output .= '<tr>' . sprintf('<td>%s</td>', Am_Di::getInstance()->countryTable->getTitleByCode($region['country'])) . sprintf('<td>%s</td>', $region['state'] ? Am_Di::getInstance()->stateTable->getTitleByCode($region['country'], $region['state']) : '*') . sprintf('<td>%s</td>', $region['zip'] ? $region['zip'] : '*') . sprintf('<td>%.2f%s</td>', $region['tax_value'], '%') . sprintf('<td><a class="remove" href="%s">%s</a></td>', Am_Controller::makeUrl('admin-tax', 'removeregion', null, array('id' => $id)), ___('Remove')) . '</tr>'; } $output .= '</table></div>'; $id = $this->getId(); $output .= "\n <style type='text/css'>\n #row-{$id} .element-title { display: none; }\n #row-{$id} .element { margin-left: 0 } \n </style>\n "; return sprintf('<tr><td colspan="2" id="tax-regional-regions">%s</td></tr>', $output); }
public function getUrl($record = null, $id = null) { return Am_Controller::makeUrl('admin-import', 'delete', null, array('id' => $record->id)); }
/** * Returns url of current page with given _REQUEST parameters overriden * @param array $parametersOverride */ function url(array $parametersOverride = array(), $skipRequestParams = false) { $vars = $skipRequestParams ? $parametersOverride : array_merge($_REQUEST, $parametersOverride); return Am_Controller::makeUrl() . '?' . http_build_query($vars); }
function init() { /* General Settings */ $fieldSet = $this->addElement('fieldset', 'general', array('id' => 'general', 'label' => ___('General'))); $loginGroup = $fieldSet->addGroup('', array('id' => 'login'))->setLabel(___('Username')); $login = $loginGroup->addElement('text', 'login', array('size' => 20)); $login->addRule('required'); $loginGroup->addRule('callback2', '-error-', array($this, 'checkUniqLogin')); $comment = $fieldSet->addTextarea("comment", array('style' => "width:90%", 'id' => 'comment'), array('label' => ___('Comment'))); if ($this->record && $this->record->pk()) { $url = Am_Controller::escape(Am_Controller::makeUrl('admin-users', 'login-as', null, array('id' => $this->record->pk()))); $loginGroup->addStatic('_login_as')->setContent(" <a href='{$url}' target='_blank'>" . ___("login as user") . "</a>"); } $pass = $fieldSet->addElement('password', '_pass', array('size' => 20, 'autocomplete' => 'off'))->setLabel(___('New Password')); //$pass0 = $gr->addElement('password', '_pass0', array('size' => 20)); //$pass0->addRule('eq', 'Password confirmation must be equal to Password', $pass); if ($this->getAttribute('_a_') == 'insert') { $pass->addRule('required'); } $nameField = $fieldSet->addGroup('', array('id' => 'name'), array('label' => ___('Name'))); $nameField->addElement('text', 'name_f', array('size' => 20)); $nameField->addElement('text', 'name_l', array('size' => 20)); $gr = $fieldSet->addGroup()->setLabel(___('E-Mail Address')); $gr->addElement('text', 'email', array('size' => 40))->addRule('required'); $gr->addRule('callback2', '-error-', array($this, 'checkUniqEmail')); $fieldSet->addElement('text', 'phone', array('size' => 20))->setLabel(___('Phone Number')); if ($this->record && $this->record->isLoaded()) { $resendText = Am_Controller::escape(___("Resend Signup E-Mail")); $sending = Am_Controller::escape(___('sending')); $sent = Am_Controller::escape(___('sent successfully')); $id = $this->record->pk(); $gr->addElement('static')->setContent(<<<CUT <input type='button' value='{$resendText}' id='resend-signup-email' /> <script type='text/javascript'> \$(function(){ \$("#resend-signup-email").click(function(){ var btn = this; var txt = btn.value; btn.value += '...({$sending})...'; \$.post(window.rootUrl + '/admin-users/resend-signup-email', {id: {$id}}, function(){ btn.value = txt + '...({$sent})'; setTimeout(function(){ btn.value = txt; }, 600); }); }); }); </script> CUT ); } $isLocked = $fieldSet->addElement('advradio', 'is_locked', array('id' => 'is_locked'))->loadOptions(array('' => 'No', '1' => '<font color=red><b>' . ___("Yes, locked") . '</b></font>', '-1' => '<i>' . ___("Disable auto-locking for this customer") . '</i>'))->setLabel(___('Is Locked')); if (Am_Di::getInstance()->config->get('manually_approve')) { $fieldSet->addElement('advcheckbox', 'is_approved', array('id' => 'is_approved'))->setLabel(___('Is Approved')); } $fieldSet->addElement('advradio', 'unsubscribed', array('id' => 'unsubscribed'))->setLabel(___("Is Unsubscribed?\nif enabled, this will\nunsubscribe the customer from:\n* messages that you send from aMember Cp, \n* autoresponder messages,\n* subscription expiration notices"))->loadOptions(array('' => ___('No'), '1' => ___('Yes, do not e-mail this customer for any reasons'))); if ($this->record->isLoaded()) { $fieldSet->addStatic('_signup_info', null, array('label' => ___('Signup Info')))->setContent(sprintf("<div>%s</div>", $this->record->added . ' / ' . $this->record->remote_addr)); } if (Am_Di::getInstance()->config->get('use_user_groups')) { $group = $this->addGroup('', array('id' => 'user_groups'))->setLabel(___('User Groups')); $groups = $group->addSelect('_groups', array('multiple' => 'multiple', 'class' => 'magicselect')); $groups->loadOptions(Am_Di::getInstance()->userGroupTable->getSelectOptions()); $group->addHtml()->setHtml(sprintf('<a href="%s" target="_blank">%s<a/>', Am_Controller::escape(REL_ROOT_URL . '/admin-user-groups'), ___("Edit Groups"))); } /* Address Info */ $this->insertAddressFields(); $this->insertAdditionalFields(); $event = new Am_Event_UserForm(Am_Event_UserForm::INIT, $this, $this->record, array()); $event->run(); }