本文整理汇总了PHP中Am_Query::setOrder方法的典型用法代码示例。如果您正苦于以下问题:PHP Am_Query::setOrder方法的具体用法?PHP Am_Query::setOrder怎么用?PHP Am_Query::setOrder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Am_Query
的用法示例。
在下文中一共展示了Am_Query::setOrder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderInvoiceCommissions
function renderInvoiceCommissions(Invoice $invoice, Am_View $view)
{
$query = new Am_Query($this->getDi()->affCommissionTable);
$query->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id');
$query->leftJoin('?_user', 'a', 't.aff_id=a.user_id');
$query->leftJoin('?_product', 'p', 't.product_id=p.product_id');
$query->addField('CONCAT(a.login, \' (\', a.name_f, \' \', a.name_l,\') [#\', a.user_id, \']\')', 'aff_name')->addField('p.title', 'product_title')->addField('IF(payout_detail_id IS NULL, \'no\', \'yes\')', 'is_paid');
$query->setOrder('commission_id', 'desc');
$query->addWhere('t.invoice_id=?', $invoice->pk());
$items = $query->selectAllRecords();
$view->comm_items = $items;
$view->invoice = $invoice;
return $view->render('blocks/admin-user-invoice-details.phtml');
}
示例2: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->helpdeskCategoryTable);
$ds->leftJoin('?_admin', 'a', 't.owner_id=a.admin_id')->addField("CONCAT(a.login, ' (',a.name_f, ' ', a.name_l, ')')", 'owner');
$ds->setOrder('sort_order');
$grid = new Am_Grid_Editable('_helpdesk_category', ___("Ticket Categories"), $ds, $this->_request, $this->view);
$grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'));
$grid->addField(new Am_Grid_Field('owner_id', ___('Owner'), true, '', array($this, 'renderOwner')));
$grid->addField(new Am_Grid_Field_IsDisabled());
$grid->setForm('Am_Form_Admin_HelpdeskCategory');
$grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
$grid->setPermissionId(Bootstrap_Helpdesk::ADMIN_PERM_CATEGORY);
$grid->actionAdd(new Am_Grid_Action_Sort_HelpdeskCategory());
return $grid;
}
示例3: indexAction
function indexAction()
{
// display payouts list date | method | total | paid |
$ds = new Am_Query($this->getDi()->affPayoutTable);
$ds->leftJoin('?_aff_payout_detail', 'd', 'd.payout_id=t.payout_id AND d.is_paid>0');
$ds->addField('SUM(amount)', 'paid');
$ds->setOrder('date', 'DESC');
$grid = new Am_Grid_Editable('_payout', ___("Payouts"), $ds, $this->_request, $this->view);
$grid->setPermissionId('affiliates');
$grid->actionsClear();
$grid->addField('date', ___('Date'));
$grid->addField('thresehold_date', ___('Thresehold Date'));
$grid->addField('type', ___('Payout Method'));
$grid->addField('total', ___('Total to Pay'));
$grid->addField('paid', ___('Total Paid'));
//$grid->actionAdd(new Am_Grid_Action_Url('run', ___('Run'), '__ROOT__/aff/admin-payout/run?payout_id=__ID__'));
$grid->actionAdd(new Am_Grid_Action_Url('view', ___('View'), '__ROOT__/aff/admin-payout/view?payout_id=__ID__'))->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_RunPayout('run_payout', ___('Generate Payout Manually')));
$grid->runWithLayout();
}
示例4: commTabAction
function commTabAction()
{
$this->setActiveMenu('users-browse');
$ds = new Am_Query($this->getDi()->affCommissionTable);
$ds->leftJoin('?_invoice', 'i', 'i.invoice_id=t.invoice_id');
$ds->leftJoin('?_user', 'u', 'u.user_id=i.user_id');
$ds->leftJoin('?_product', 'p', 't.product_id=p.product_id')->addField('u.user_id', 'user_id')->addField('CONCAT(u.login, \' (\',u.name_f, \' \',u.name_l,\') [#\', u.user_id, \']\')', 'user_name')->addField('p.title', 'product_title')->addField('IF(payout_detail_id IS NULL, \'no\', \'yes\')', 'is_paid');
$ds->setOrder('date', 'desc')->addWhere('t.aff_id=?', $this->getParam('user_id'));
$grid = new Am_Grid_Editable('_affcomm', ___('Affiliate Commission'), $ds, $this->_request, $this->view);
$grid->setPermissionId(Bootstrap_Aff::ADMIN_PERM_ID);
$grid->actionsClear();
$userUrl = new Am_View_Helper_UserUrl();
$grid->addField(new Am_Grid_Field_Date('date', ___('Date')))->setFormatDate();
$grid->addField('user_name', ___('User'))->addDecorator(new Am_Grid_Field_Decorator_Link($userUrl->userUrl('{user_id}'), '_top'));
$grid->addField('product_title', ___('Product'));
$grid->addField('record_type', ___('Type'))->setRenderFunction(array($this, 'renderType'));
$fieldAmount = $grid->addField('amount', ___('Commission'))->setRenderFunction(array($this, 'renderCommAmount'));
$grid->addField('is_paid', ___('Paid'));
$grid->addField('tier', ___('Tier'))->setRenderFunction(array($this, 'renderTier'));
$grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'commCbGetTrAttribs'));
$grid->setFilter(new Am_Grid_Filter_AffCommission());
$grid->actionAdd(new Am_Grid_Action_Total())->addField($fieldAmount, "IF(record_type='void', -1*%1\$s, %1\$s)");
$grid->actionAdd(new Am_Grid_Action_Aff_Void());
$grid->runWithLayout('admin/user-layout.phtml');
}
示例5: createDs
protected function createDs()
{
$query = new Am_Query(Am_Di::getInstance()->affBannerTable);
$query->setOrder('sort_order');
return $query;
}
示例6: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->helpdeskFaqTable);
$ds->setOrder('sort_order');
$grid = new Am_Grid_Editable('_helpdesk_faq', ___('FAQ'), $ds, $this->_request, $this->view);
$grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'));
$grid->addField(new Am_Grid_Field('category', ___('Category')));
$grid->addField('_link', ___('Link'), false)->setRenderFunction(array($this, 'renderLink'));
$grid->setForm('Am_Form_Admin_HelpdeskFaq');
$grid->setFilter(new Am_Grid_Filter_HelpdeskFaq());
$grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
$grid->setPermissionId(Bootstrap_Helpdesk::ADMIN_PERM_FAQ);
$grid->actionAdd(new Am_Grid_Action_Sort_HelpdeskFaq());
if ($this->getDi()->helpdeskFaqTable->getCategories()) {
$grid->actionAdd(new Am_Grid_Action_EditFaqCategory('faq-edit-category', ___('Edit Categories')));
}
return $grid;
}
示例7: createAdminLog
public function createAdminLog()
{
$ds = new Am_Query($this->getDi()->adminLogTable);
$ds->setOrder('dattm', 'desc');
$g = new Am_Grid_ReadOnly('_admin', ___("Admin Log"), $ds, $this->getRequest(), $this->view);
$g->addGridField(new Am_Grid_Field('dattm', ___('Time'), true, '', array($this, 'renderAdminTime'), '10%'));
$g->addGridField(new Am_Grid_Field('admin_login', ___('Admin'), true, '', array($this, 'renderAdmin'), '10%'));
$g->addGridField(new Am_Grid_Field('ip', ___('IP'), true, '', null, '10%'));
$g->addGridField(new Am_Grid_Field('message', ___('Message')));
$g->addGridField(new Am_Grid_Field('record', ___('Record')))->setRenderFunction(array($this, 'renderRec'));
$g->setFilter(new Am_Grid_Filter_Text(___('Filter'), array('admin_login' => 'LIKE')));
return $g;
}
示例8: paymentAction
public function paymentAction()
{
$totalFields = array();
$query = new Am_Query($this->getDi()->invoicePaymentTable);
$query->leftJoin('?_user', 'm', 'm.user_id=t.user_id')->addField("(SELECT GROUP_CONCAT(item_title SEPARATOR ', ') FROM ?_invoice_item WHERE invoice_id=t.invoice_id)", 'items')->addField('m.login', 'login')->addField('m.email', 'email')->addField('m.street', 'street')->addField('m.city', 'city')->addField('m.state', 'state')->addField('m.country', 'country')->addField('m.phone', 'phone')->addField('m.zip', 'zip')->addField("concat(m.name_f,' ',m.name_l)", 'name')->addField('t.invoice_public_id', 'public_id')->addWhere('t.user_id=?', $this->user_id);
$query->setOrder("invoice_payment_id", "desc");
$grid = new Am_Grid_Editable('_payment', ___('Payments'), $query, $this->_request, $this->view);
$grid->actionsClear();
$grid->addField(new Am_Grid_Field_Date('dattm', ___('Date/Time')));
$grid->addField('invoice_id', ___('Invoice'))->setGetFunction(array($this, '_getInvoiceNum'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-user-payments/index/user_id/{user_id}#invoice-{invoice_id}', '_top'));
$grid->addField('receipt_id', ___('Receipt'));
$grid->addField('paysys_id', ___('Payment System'));
array_push($totalFields, $grid->addField('amount', ___('Amount'))->setGetFunction(array($this, '_getAmount')));
if ($this->getDi()->plugins_tax->getEnabled()) {
array_push($totalFields, $grid->addField('tax', ___('Tax'))->setGetFunction(array($this, '_getTax')));
}
$grid->addField(new Am_Grid_Field_Date('refund_dattm', ___('Refunded')))->setFormatDatetime();
$grid->addField('items', ___('Items'));
$grid->setFilter(new Am_Grid_Filter_Payments());
$action = new Am_Grid_Action_Export();
$action->addField(new Am_Grid_Field('dattm', ___('Date Time')))->addField(new Am_Grid_Field('receipt_id', ___('Receipt')))->addField(new Am_Grid_Field('paysys_id', ___('Payment System')))->addField(new Am_Grid_Field('amount', ___('Amount')))->addField(new Am_Grid_Field('tax', ___('Tax')))->addField(new Am_Grid_Field_Date('refund_dattm', ___('Refunded')))->addField(new Am_Grid_Field('login', ___('Username')))->addField(new Am_Grid_Field('name', ___('Name')))->addField(new Am_Grid_Field('email', ___('Email')))->addField(new Am_Grid_Field('street', ___('Street')))->addField(new Am_Grid_Field('city', ___('City')))->addField(new Am_Grid_Field('state', ___('State')))->addField(new Am_Grid_Field('country', ___('Country')))->addField(new Am_Grid_Field('phone', ___('Phone')))->addField(new Am_Grid_Field('zip', ___('Zip Code')))->addField(new Am_Grid_Field('items', ___('Items')))->addField(new Am_Grid_Field('invoice_id', ___('Invoice')))->addField(new Am_Grid_Field('public_id', ___('Invoice (Public Id)')));
$grid->actionAdd($action);
if ($this->getDi()->config->get('send_pdf_invoice')) {
$grid->actionAdd(new Am_Grid_Action_ExportPdf());
}
$action = $grid->actionAdd(new Am_Grid_Action_Total());
foreach ($totalFields as $f) {
$action->addField($f, 'ROUND(%s / base_currency_multi, 2)');
}
$grid->runWithLayout('admin/user-layout.phtml');
}
示例9: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->couponBatchTable);
$ds->addField('COUNT(c.coupon_id) AS coupons_count');
$ds->leftJoin('?_coupon', 'c', 't.batch_id = c.batch_id');
$ds->setOrder('batch_id', 'desc');
$grid = new Am_Grid_Editable('_coupon', ___("Coupons Batches"), $ds, $this->_request, $this->view);
$grid->addField('batch_id', ___('Batch ID'), true, '', null, '5%');
$grid->addField(new Am_Grid_Field_Date('begin_date', ___('Begin Date')))->setFormatDate();
$grid->addField(new Am_Grid_Field_Date('expire_date', ___('Expire Date')))->setFormatDate();
$grid->addField('id_disabled', ___('Disabled?'), false, '', array($this, 'renderDisabled'), '10%');
$grid->addField('is_recurring', ___('Recurring'), true, '', null, '5%');
$grid->addField('discount', ___('Discount'), true, '', array($this, 'renderDiscount'), '5%');
$grid->addField('product_ids', ___('Products'), false, '', array($this, 'renderProducts'), '25%');
$grid->addField('comment', ___('Comment'), true, '', null, '15%');
$grid->addField('coupons_count', ___('Coupons Count'), true, '', null, '5%');
$grid->setForm(array($this, 'createForm'));
$grid->actionGet('edit')->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_Url("view", ___("View Coupons"), "javascript:amOpenCoupons(__ID__)"))->setAttribute("class", "coupons-link");
$grid->actionAdd(new Am_Grid_Action_LiveEdit('comment'));
$grid->setFormValueCallback('product_ids', array('RECORD', 'unserializeIds'), array('RECORD', 'serializeIds'));
$grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
$grid->addCallback(Am_Grid_Editable::CB_AFTER_INSERT, array($this, 'afterInsert'));
$grid->setFilter(new Am_Grid_Filter_Coupon());
return $grid;
}
示例10: createGrid
function createGrid()
{
// display payouts list date | method | total | paid |
$ds = new Am_Query($this->getDi()->affPayoutTable);
$ds->leftJoin('?_aff_payout_detail', 'd', 'd.payout_id=t.payout_id AND d.is_paid>0');
$ds->addField('SUM(amount)', 'paid');
$ds->setOrder('date', 'DESC');
$grid = new Am_Grid_Editable('_payout', ___('Payouts'), $ds, $this->_request, $this->view);
$grid->setEventId('gridAffPayout');
$grid->setPermissionId(Bootstrap_Aff::ADMIN_PERM_ID);
$grid->actionsClear();
$grid->addField(new Am_Grid_Field_Date('date', ___('Payout Date')))->setFormatDate();
$grid->addField(new Am_Grid_Field_Date('thresehold_date', ___('Thresehold Date')))->setFormatDate();
$grid->addField(new Am_Grid_Field_Enum('type', ___('Payout Method')))->setTranslations(Am_Aff_PayoutMethod::getAvailableOptions());
$grid->addField('total', ___('Total to Pay'))->setGetFunction(array($this, 'getAmount'));
$grid->addField('paid', ___('Total Paid'))->setGetFunction(array($this, 'getAmount'));
//$grid->actionAdd(new Am_Grid_Action_Url('run', ___('Run'), '__ROOT__/aff/admin-payout/run?payout_id=__ID__'));
$grid->actionAdd(new Am_Grid_Action_Url('view', ___('View'), '__ROOT__/aff/admin-payout/view?payout_id=__ID__'))->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_RunPayout('run_payout', ___('Generate Payout Manually')));
$grid->actionAdd(new Am_Grid_Action_ExportPayout());
$grid->actionAdd(new Am_Grid_Action_Delete())->setIsAvailableCallback(array($this, 'isDeleteAvailable'));
$grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'cbGetTrAttribs'));
$grid->addCallback(Am_Grid_Editable::CB_RENDER_CONTENT, array($this, 'renderContent'));
$grid->actionAdd(new Am_Grid_Action_Total_Payout());
return $grid;
}
示例11: createInvoicesPage
function createInvoicesPage()
{
$query = new Am_Query($this->getDi()->invoiceTable);
$query->leftJoin('?_user', 'm', 'm.user_id=t.user_id')->addField('m.login', 'login')->addField("concat(m.name_f,' ',m.name_l)", 'name');
$query->setOrder("invoice_id", "desc");
$grid = new Am_Grid_Editable('_invoice', ___("Invoices"), $query, $this->_request, $this->view);
$grid->actionsClear();
$grid->addField(new Am_Grid_Field_Date('tm_added', ___('Added')));
$grid->addField('invoice_id', ___('Invoice'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-user-payments/index/user_id/{user_id}#invoice-{invoice_id}', '_blank'));
$grid->addField('status', ___('Status'))->setRenderFunction(array($this, 'renderInvoiceStatus'));
$grid->addField('paysys_id', ___('Payment System'));
$grid->addField('_total', ___('Total'))->setGetFunction(array($this, 'getInvoiceTotal'));
$grid->addField('login', ___('Username'), false)->addDecorator(new Am_Grid_Field_Decorator_Link('admin-users?_u_a=edit&_u_b={THIS_URL}&_u_id={user_id}', '_blank'));
$grid->addField('name', ___('Name'), false);
$filter = new Am_Grid_Filter_Payments();
$filter->setDateField('tm_added');
$grid->setFilter($filter);
$action = new Am_Grid_Action_Export();
$action->addField(new Am_Grid_Field('invoice_id', ___('Invoice') . '#'))->addField(new Am_Grid_Field('paysys_id', ___('Payment System')))->addField(new Am_Grid_Field('first_total', ___('First Total')))->addField(new Am_Grid_Field('first_tax', ___('First Tax')))->addField(new Am_Grid_Field('login', ___('Username')))->addField(new Am_Grid_Field('name', ___('Name')));
$grid->actionAdd($action);
return $grid;
}
示例12: createInvoicesPage
function createInvoicesPage($page)
{
$query = new Am_Query($this->getDi()->invoiceTable);
if ($page == 'not-approved') {
$query->addWhere('is_confirmed<1');
}
$query->leftJoin('?_user', 'm', 'm.user_id=t.user_id')->addField("(SELECT GROUP_CONCAT(item_title SEPARATOR ', ') FROM ?_invoice_item WHERE invoice_id=t.invoice_id)", 'items')->addField('m.login', 'login')->addField('m.email', 'email')->addField('m.street', 'street')->addField('m.street2', 'street2')->addField('m.city', 'city')->addField('m.state', 'state')->addField('m.country', 'country')->addField('m.phone', 'phone')->addField('m.zip', 'zip')->addField("concat(m.name_f,' ',m.name_l)", 'name')->addField('m.name_f')->addField('m.name_l')->addField('DATE(tm_started)', 'date');
//Additional Fields
foreach ($this->getDi()->userTable->customFields()->getAll() as $field) {
if (isset($field->from_config) && $field->from_config) {
if ($field->sql) {
$query->addField('m.' . $field->name, $field->name);
}
}
}
$query->setOrder("invoice_id", "desc");
$grid = new Am_Grid_Editable('_invoice', ___('Invoices'), $query, $this->_request, $this->view);
$grid->setRecordTitle(array($this, 'getInvoiceRecordTitle'));
$grid->actionsClear();
$grid->actionAdd(new Am_Grid_Action_Delete())->setTarget('_top');
$grid->addField(new Am_Grid_Field_Date('tm_added', ___('Added')));
$grid->addField('invoice_id', ___('Invoice'))->setGetFunction(array($this, '_getInvoiceNum'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-user-payments/index/user_id/{user_id}#invoice-{invoice_id}', '_top'));
$grid->addField('status', ___('Status'))->setRenderFunction(array($this, 'renderInvoiceStatus'));
$grid->addField('paysys_id', ___('Payment System'));
$grid->addField('_total', ___('Billing Terms'), false)->setGetFunction(array($this, 'getInvoiceTotal'));
$grid->addField(new Am_Grid_Field_Date('rebill_date', ___('Rebill Date')))->setFormatDate();
$grid->addField('items', ___('Items'));
$grid->addField('login', ___('Username'))->addDecorator(new Am_Grid_Field_Decorator_Link('admin-users?_u_a=edit&_u_b={THIS_URL}&_u_id={user_id}', '_top'));
$grid->addField('name', ___('Name'));
$filter = new Am_Grid_Filter_Invoices();
$grid->setFilter($filter);
$stateTitleField = new Am_Grid_Field('state_title', ___('State Title'));
$stateTitleField->setGetFunction(array($this, 'getStateTitle'));
$countryTitleField = new Am_Grid_Field('country_title', ___('Country Title'));
$countryTitleField->setGetFunction(array($this, 'getCountryTitle'));
$termsField = new Am_Grid_Field('_total', ___('Billing Terms'));
$termsField->setGetFunction(array($this, 'getInvoiceTotal'));
$action = new Am_Grid_Action_Export();
$action->addField(new Am_Grid_Field('tm_started', ___('Date/Time')))->addField(new Am_Grid_Field('date', ___('Date')))->addField(new Am_Grid_Field('rebill_date', ___('Rebill Date')))->addField(new Am_Grid_Field('invoice_id', ___('Invoice (Internal Id)')))->addField(new Am_Grid_Field('public_id', ___('Invoice (Public Id)')))->addField(new Am_Grid_Field('status', ___('Status')))->addField($termsField)->addField(new Am_Grid_Field('paysys_id', ___('Payment System')))->addField(new Am_Grid_Field('first_total', ___('First Total')))->addField(new Am_Grid_Field('first_tax', ___('First Tax')))->addField(new Am_Grid_Field('email', ___('Email')))->addField(new Am_Grid_Field('login', ___('Username')))->addField(new Am_Grid_Field('name', ___('Name')))->addField(new Am_Grid_Field('name_f', ___('First Name')))->addField(new Am_Grid_Field('name_l', ___('Last Name')))->addField(new Am_Grid_Field('street', ___('Street')))->addField(new Am_Grid_Field('street2', ___('Street2')))->addField(new Am_Grid_Field('city', ___('City')))->addField(new Am_Grid_Field('state', ___('State')))->addField($stateTitleField)->addField(new Am_Grid_Field('country', ___('Country')))->addField($countryTitleField)->addField(new Am_Grid_Field('phone', ___('Phone')))->addField(new Am_Grid_Field('zip', ___('Zip Code')))->addField(new Am_Grid_Field('item_title', ___('Product Title')))->addField(new Am_Grid_Field('coupon_code', ___('Coupon')));
//Additional Fields
foreach ($this->getDi()->userTable->customFields()->getAll() as $field) {
if (isset($field->from_config) && $field->from_config) {
if ($field->sql) {
$action->addField(new Am_Grid_Field($field->name, $field->title));
}
}
}
$action->setGetDataSourceFunc(array($this, 'getExportDs'));
$grid->actionAdd($action);
if ($this->getDi()->config->get('manually_approve_invoice')) {
$grid->actionAdd(new Am_Grid_Action_Group_Callback('approve', ___("Approve"), array($this, 'approveInvoice')));
}
return $grid;
}
示例13: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->couponBatchTable);
$ds->addField('COUNT(c.coupon_id) AS coupons_count');
$ds->addField('SUM(c.used_count) AS used_count');
$ds->leftJoin('?_coupon', 'c', 't.batch_id = c.batch_id');
$ds->setOrder('batch_id', 'desc');
$grid = new Am_Grid_Editable('_coupon', ___('Coupons Batches'), $ds, $this->_request, $this->view);
$grid->setRecordTitle(array($this, 'getRecordTitle'));
$grid->setEventId('gridCouponBatch');
$grid->addField('batch_id', '#', true, '', null, '1%');
$grid->addField(new Am_Grid_Field_Date('begin_date', ___('Begin Date')))->setFormatDate();
$grid->addField(new Am_Grid_Field_Date('expire_date', ___('Expire Date')))->setFormatDate();
$grid->addField(new Am_Grid_Field_IsDisabled());
$grid->addField('is_recurring', ___('Recurring'), true, 'center', null, '1%');
$grid->addField('discount', ___('Discount'), true, '', array($this, 'renderDiscount'), '5%');
$grid->addField('product_ids', ___('Products'), false, '', array($this, 'renderProducts'), '25%');
$grid->addField('comment', ___('Comment'), true, '', null, '15%');
$grid->addField('used_count', ___('Used'), true, 'center', array($this, 'renderUsedCount'), '5%');
$grid->addField('coupons_count', ___('Coupons'), true, 'center', null, '5%')->setRenderFunction(array($this, 'renderCoupons'));
$grid->setForm(array($this, 'createForm'));
$grid->actionGet('edit')->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_Url('view', ___('View Coupons'), 'javascript:amOpenCoupons(__ID__)'))->setAttribute("class", "coupons-link");
$grid->actionAdd(new Am_Grid_Action_Url('export', ___('Export'), REL_ROOT_URL . '/admin-coupons/export/id/__ID__'))->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_LiveEdit('comment'));
$grid->actionAdd(new Am_Grid_Action_LiveCheckbox('is_recurring'));
$grid->setFormValueCallback('product_ids', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
$grid->setFormValueCallback('require_product', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
$grid->setFormValueCallback('prevent_if_product', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
$grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
$grid->addCallback(Am_Grid_Editable::CB_AFTER_INSERT, array($this, 'afterInsert'));
$grid->setFilter(new Am_Grid_Filter_Coupon());
return $grid;
}
示例14: createAdminLog
public function createAdminLog()
{
$ds = new Am_Query($this->getDi()->adminLogTable);
$ds->setOrder('dattm', 'desc');
$g = new Am_Grid_ReadOnly('_admin', ___('Admin Log'), $ds, $this->getRequest(), $this->view);
$g->setPermissionId(Am_Auth_Admin::PERM_LOGS_ADMIN);
$g->addField(new Am_Grid_Field_Date('dattm', ___('Date/Time'), true));
$g->addField(new Am_Grid_Field('admin_login', ___('Admin'), true))->addDecorator(new Am_Grid_Field_Decorator_Link(REL_ROOT_URL . "/admin-admins?_admin_a=edit&_admin_id={admin_id}", '_top'));
$g->addField(new Am_Grid_Field('ip', ___('IP'), true, '', null, '10%'));
$g->addField(new Am_Grid_Field('message', ___('Message')));
$g->addField(new Am_Grid_Field('record', ___('Record')))->setRenderFunction(array($this, 'renderRec'));
$g->setFilter(new Am_Grid_Filter_AdminLog());
return $g;
}
示例15: historyRowsAction
function historyRowsAction()
{
$q = new Am_Query($this->getDi()->emailSentTable);
$q->leftJoin('?_admin', 'a', 't.admin_id=a.admin_id');
$q->addField('a.login', 'admin_login');
$q->setOrder('email_sent_id', 'DESC');
// dirty hack
$withWrap = (bool) $this->_request->get('_h_wrap');
unset($_GET['_h_wrap']);
$grid = new Am_Grid_Editable('_h', ___('E-Mails History'), $q, $this->_request, $this->view);
$grid->setPermissionId(Am_Auth_Admin::PERM_EMAIL);
if ($withWrap) {
$grid->isAjax(false);
}
$grid->setCountPerPage(5);
$grid->addField(new Am_Grid_Field_Date('tm_added', ___('Started')));
$grid->addField('subject', ___('Subject'));
$grid->addField('admin_login', ___('Sender'));
$grid->addField('count_users', ___('Total'));
$grid->addField('sent_users', ___('Sent'));
$grid->addField('desc_users', ___('To'))->setAttrs(array('class' => 'break'));
$grid->actionsClear();
$grid->actionAdd(new Am_Grid_Action_Url('resend', ___('Resend'), REL_ROOT_URL . "/admin-email?resend_id=__ID__"))->setTarget('_top');
$grid->actionAdd(new Am_Grid_Action_Url('continue', ___('Continue'), REL_ROOT_URL . "/admin-email/send?queue_id=__ID__"))->setTarget('_top')->setIsAvailableCallback(array($this, 'needContinueLink'));
if ($this->getDi()->authAdmin->getUser()->isSuper()) {
$grid->actionAdd(new Am_Grid_Action_Delete());
}
$grid->run($this->getResponse());
}