/** @array string html */ function renderGridHeaderSortHtml(Am_Grid_Field $field) { $desc = null; @(list($sort, $desc) = explode(' ', $this->request->getParam('sort'), 2)); if ($sort == $field->getFieldName()) { $desc = $desc != "DESC"; } $url = $this->escape($this->makeUrl(array('sort' => $field->getFieldName() . ($desc ? " DESC" : "")))); $cssClass = "a-sort"; if ($sort == $field->getFieldName()) { $cssClass .= $desc ? ' sorted-desc' : ' sorted-asc'; } $sort1 = sprintf("<a class='{$cssClass}' href='%s'>", $url); $sort2 = "</a>"; return array($sort1, $sort2); }
/** * * @param Am_Grid_Field $field * @return Am_Grid_Action_Customize */ public function addField(Am_Grid_Field $field) { $this->fields[$field->getFieldName()] = $field; return $this; }
public function __construct($field, $title, $sortable = true, $align = null, $renderFunc = null, $width = null) { parent::__construct($field, $title, $sortable, $align, $renderFunc, $width); $this->setFormatFunction(array($this, '_format')); }
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; }
public function __construct($field = '_', $title = null, $sortable = true, $align = null, $renderFunc = null, $width = null) { parent::__construct('_', ___("Actions"), false); }
public function renderStatic() { $url = htmlentities(REL_ROOT_URL . "/application/default/views/public/js/htmlreg.js", ENT_QUOTES, 'UTF-8'); return parent::renderStatic() . ' <script type="text/javascript" src="' . $url . '"></script>' . PHP_EOL; }
protected function createActionExport() { $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')); $lastSigninInfoField = new Am_Grid_Field('last_signin', ___('Last Signin Info')); $lastSigninInfoField->setGetFunction(array($this, 'getLastSigninInfo')); $action = new Am_Grid_Action_Export(); $action->addField(new Am_Grid_Field('user_id', ___('User Id')))->addField(new Am_Grid_Field('login', ___('Username')))->addField(new Am_Grid_Field('email', ___('Email')))->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', ___('Street (Second Line)')))->addField(new Am_Grid_Field('city', ___('City')))->addField(new Am_Grid_Field('state', ___('State')))->addField($stateTitleField)->addField(new Am_Grid_Field('zip', ___('ZIP Code')))->addField(new Am_Grid_Field('country', ___('Country')))->addField($countryTitleField)->addField(new Am_Grid_Field('phone', ___('Phone')))->addField(new Am_Grid_Field('added', ___('Added')))->addField(new Am_Grid_Field('status', ___('Status')))->addField(new Am_Grid_Field('products', ___('Active Subscriptions')))->addField(new Am_Grid_Field('unsubscribed', ___('Unsubscribed')))->addField(new Am_Grid_Field('lang', ___('Language')))->addField(new Am_Grid_Field('is_locked', ___('Is Locked')))->addField(new Am_Grid_Field('comment', ___('Comment')))->addField(new Am_Grid_Field('aff_id', ___('Affiliate Id#')))->addField(new Am_Grid_Field('payments_sum', ___('Payments (amount of all payments made by user minus refunds)')))->addField(new Am_Grid_Field('expire', ___('Expire (maximum expiration date)')))->addField($lastSigninInfoField); //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)); } else { if (in_array($field->type, array('multi_select', 'checkbox'))) { //we use trailing __blob to distinguish multi select fields from data table $mfield = new Am_Grid_Field($field->name . '__blob', $field->title); $mfield->setGetFunction(array($this, 'getMultiSelect')); $action->addField($mfield); } else { //we use trailing __ to distinguish fields from data table $action->addField(new Am_Grid_Field($field->name . '__', $field->title)); } } } } $action->setGetDataSourceFunc(array($this, 'getDS')); return $action; }
public function __construct($field = 'is_disabled', $title = null, $sortable = true, $align = null, $renderFunc = null, $width = null) { parent::__construct($field, is_null($title) ? ___('Is Disabled?') : $title, $sortable, $align, $renderFunc, $width); }
public function __construct($field = '_', $title = null, $sortable = true, $align = null, $renderFunc = null, $width = null) { parent::__construct($field, '', false); $this->addDecorator(new Am_Grid_Field_Decorator_Sort()); }
/** * * @param Am_Grid_Field $field * @return Am_Grid_Action_Total */ public function addField(Am_Grid_Field $field, $stm = '%s') { $this->fields[$field->getFieldName()] = $field; $this->stms[$field->getFieldName()] = $stm; return $this; }
function onGridUserOnBeforeRun(Am_Event $event) { /* @var $grid Am_Grid_Editable */ $grid = $event->getGrid(); /* @var $query Am_Query_User */ $query = $grid->getDataSource(); $date = sqlTime(sprintf('-%d minutes', $this->getConfig('timeout', 5))); $query->leftJoin('?_login_session', 'ls', 'u.user_id=ls.user_id')->addField("SUM(IF(modified>'{$date}' AND need_logout=0, 1, 0))", 'login_session_cnt'); $loginIndicator = new Am_Grid_Field('login_indicator', ___('Login Indicator'), false); $loginIndicator->setRenderFunction(array($this, 'renderLoginIndicator')); $action = $grid->actionGet('customize'); $action->addField($loginIndicator); }
public function __construct($field, $title, $sortable = false, $align = null, $renderFunc = null, $width = null) { parent::__construct($field, $title, $sortable, $align, $renderFunc, $width); }