本文整理汇总了PHP中Am_Query类的典型用法代码示例。如果您正苦于以下问题:PHP Am_Query类的具体用法?PHP Am_Query怎么用?PHP Am_Query使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Am_Query类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: createGrid
public function createGrid()
{
$this->view->headScript()->appendFile(REL_ROOT_URL . "/application/default/views/public/js/jquery/jquery.json.js");
$this->view->headScript()->appendScript($this->getJs());
$table = $this->getDi()->savedFormTable;
$ds = new Am_Query($table);
$ds->addWhere('`type` in (?a)', array_keys($table->getTypeDefs()));
$ds->addOrderRaw("`type`='signup' DESC");
$grid = new Am_Grid_Editable('_s', ___("Forms Editor"), $ds, $this->_request, $this->view);
$grid->setForm(array($this, 'createForm'));
$grid->setRecordTitle(' ');
//$grid->addGridField(new Am_Grid_Field('saved_form_id', '#', true, '', null, '5%'));
$grid->addGridField(SavedForm::D_SIGNUP, ___('Default Signup'), false)->setWidth('5%')->setRenderFunction(array($this, 'renderDefault'));
$grid->addGridField(SavedForm::D_MEMBER, ___('Default for Members'), false)->setWidth('5%')->setRenderFunction(array($this, 'renderDefault'));
$existingTypes = $this->getDi()->savedFormTable->getExistingTypes();
$grid->actionGet('edit')->setTarget('_top');
$grid->actionDelete('insert');
foreach ($this->getDi()->savedFormTable->getTypeDefs() as $type => $typeDef) {
if (!empty($typeDef['isSingle']) && in_array($type, $existingTypes)) {
continue;
}
$grid->actionAdd(new Am_Grid_Action_Insert('insert-' . $type))->addUrlParam('type', $type)->setTitle(___('New %s', $typeDef['title']));
}
$grid->addCallback(Am_Grid_Editable::CB_BEFORE_SAVE, array($this, 'beforeSave'));
$grid->addGridField(new Am_Grid_Field('type', ___('Type')));
$grid->addGridField(new Am_Grid_Field('title', ___('Title')));
$grid->addGridField(new Am_Grid_Field('comment', ___('Comment')));
$grid->addGridField(new Am_Grid_Field('code', ___('Code')));
$grid->addGridField(new Am_Grid_Field('url', ___('URL')))->setRenderFunction(array($this, 'renderUrl'));
$grid->actionGet('delete')->setIsAvailableCallback(create_function('$record', 'return $record->canDelete();'));
return $grid;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:32,代码来源:AdminSavedFormController.php
示例2: createAdapter
protected function createAdapter()
{
$q = new Am_Query(Am_Di::getInstance()->newsletterListTable);
$q->leftJoin('?_newsletter_user_subscription', 's', 's.list_id = t.list_id AND s.is_active > 0');
$q->addField('COUNT(s.list_id)', 'subscribed_users');
return $q;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:7,代码来源:Newsletter.php
示例3: getQuery
/** @return Am_Query */
public function getQuery()
{
$q = new Am_Query($this->getDi()->helpdeskMessageTable, 'hm');
$q->clearFields();
$q->addField('COUNT(message_id)', 'cnt');
$q->addWhere('admin_id IS NULL');
return $q;
}
开发者ID:grlf,项目名称:eyedock,代码行数:9,代码来源:Helpdesk.php
示例4: getMainDataSource
/**
* @return Am_Query $query;
*/
function getMainDataSource()
{
$ds = new Am_Query($this->getDi()->invoicePaymentTable);
$ds->leftJoin('?_user', 'u', 't.user_id = u.user_id')->leftJoin('?_data', 'user_country', 't.invoice_id = user_country.id and `table` = "invoice" and `key`="tax_user_country"')->leftJoin('?_invoice_refund', 'refund', 't.invoice_payment_id = refund.invoice_payment_id')->leftJoin('?_invoice', 'invoice', 't.invoice_id = invoice.invoice_id')->addField('if(user_country.value is null, if(u.country is null, "", u.country), user_country.value)', 'country')->addField('invoice.tax_rate')->addField('round(sum(if(refund.amount, t.amount-refund.amount, t.amount)/t.base_currency_multi),2)', 'sales_amount')->addField('round(sum(if(refund.amount, (t.amount-refund.amount)*if(t.tax, t.tax, 0)/t.amount, if(t.tax, t.tax, 0))/t.base_currency_multi),2)', 'tax_amount')->addField('round(sum(if(refund.amount, (t.amount-refund.amount) - (t.amount-refund.amount)*if(t.tax, t.tax, 0)/t.amount, t.amount-if(t.tax, t.tax, 0))/t.base_currency_multi),2)', 'sales_without_tax_amount')->addField('concat(if(country is null, "", country), "-", if(invoice.tax_rate is null, "", invoice.tax_rate))', 'country_rate');
$ds->groupBy('country_rate', '');
$ds->addOrder('country');
return $ds;
}
开发者ID:grlf,项目名称:eyedock,代码行数:11,代码来源:AdminVatReportController.php
示例5: getQuery
/** @return Am_Query */
public function getQuery()
{
$q = new Am_Query(new AffCommissionTable(), 'cl');
$q->clearFields();
$q->addField("SUM(IF(cl.record_type='commission', cl.amount, -cl.amount)) AS commission");
if ($this->aff_id) {
$q->addWhere("aff_id = ?d", $this->aff_id);
}
return $q;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:11,代码来源:Reports.php
示例6: getQuery
/** @return Am_Query */
public function getQuery()
{
$q = new Am_Query(new InvoicePaymentTable(), 'p');
$q->clearFields();
foreach ($this->getPaysystems() as $k => $ps) {
$ps = $q->escape($ps);
$q->addField("ROUND(SUM(IF(p.paysys_id={$ps}, p.amount/p.base_currency_multi, 0)),2)\n", 'amt_' . $k);
}
return $q;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:11,代码来源:Standard.php
示例7: 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')->leftJoin('?_user', 'a', 't.aff_id=a.user_id')->leftJoin('?_product', 'p', 't.product_id=p.product_id')->addField('CONCAT(a.login, \' (\', a.name_f, \' \', a.name_l,\') #\', a.user_id)', 'aff_name')->addField('p.title', 'product_title')->addWhere('t.invoice_id=?', $invoice->pk())->leftJoin('?_aff_payout_detail', 'apd', 't.payout_detail_id=apd.payout_detail_id')->leftJoin('?_aff_payout', 'ap', 'ap.payout_id=apd.payout_id')->addField('ap.date', 'payout_date')->addField('ap.payout_id')->addField('apd.is_paid')->setOrder('commission_id', 'desc');
$items = $query->selectAllRecords();
$view->comm_items = $items;
$view->invoice = $invoice;
$view->has_tiers = $this->getDi()->affCommissionRuleTable->getMaxTier();
return $view->render('blocks/admin-user-invoice-details.phtml');
}
开发者ID:grlf,项目名称:eyedock,代码行数:10,代码来源:Bootstrap.php
示例8: getQuery
/** @return Am_Query */
public function getQuery()
{
$q = new Am_Query(new AffCommissionTable(), 'cl');
$q->clearFields();
$q->addField("COUNT(DISTINCT invoice_payment_id) AS sales");
if ($this->aff_id) {
$q->addWhere("aff_id = ?d", $this->aff_id);
}
return $q;
}
开发者ID:grlf,项目名称:eyedock,代码行数:11,代码来源:Reports.php
示例9: createGrid
function createGrid($id, $title)
{
$ds = new Am_Query($this->getDi()->banTable);
$ds->addWhere("`type` = ?", $id);
$g = new Am_Grid_Editable('_' . $id, ___("Disallow new Signups by %s", $title), $ds, $this->_request, $this->view);
$g->setForm(array($this, 'createForm'));
$g->addGridField("value", ___("Locked Value"));
$g->addGridField("comment", ___("Comment"));
$g->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderConfig'));
return $g;
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:11,代码来源:AdminBanController.php
示例10: createGrid
function createGrid($id, $title)
{
$ds = new Am_Query($this->getDi()->banTable);
$ds->addWhere("`type` = ?", $id);
$g = new Am_Grid_Editable('_' . $id, ___('Disallow new Signups by %s', $title), $ds, $this->_request, $this->view);
$g->setPermissionId(Am_Auth_Admin::PERM_BAN);
$g->setForm(array($this, 'createForm'));
$g->addField('value', ___('Locked Value'));
$g->addField('comment', ___('Comment'));
$g->addCallback(Am_Grid_ReadOnly::CB_RENDER_TABLE, array($this, 'renderConfig'));
return $g;
}
开发者ID:grlf,项目名称:eyedock,代码行数:12,代码来源:AdminBanController.php
示例11: createGrid
function createGrid()
{
$query = new Am_Query($this->getDi()->fileDownloadTable);
$query->leftJoin('?_file', 'f', 'f.file_id=t.file_id')->addField('f.title', 'title')->addWhere('user_id=?', $this->getParam('user_id'));
$grid = new Am_Grid_Editable('_file_download', ___("File Downloads"), $query, $this->_request, $this->view);
$grid->setPermissionId(Am_Auth_Admin::PERM_LOGS_DOWNLOAD);
$grid->actionsClear();
$grid->actionAdd(new Am_Grid_Action_Delete());
$grid->actionAdd(new Am_Grid_Action_Group_Delete());
$grid->addField(new Am_Grid_Field_Date('dattm', ___('Date/Time')));
$grid->addField('remote_addr', ___('IP'));
$grid->addField('title', ___('File'));
return $grid;
}
开发者ID:grlf,项目名称:eyedock,代码行数:14,代码来源:AdminFileDownloadController.php
示例12: 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;
}
开发者ID:grlf,项目名称:eyedock,代码行数:15,代码来源:AdminCategoryController.php
示例13: _getWhere
function _getWhere(Am_Query $db)
{
$a = $db->getAlias();
switch ($this->type) {
case 'any':
$c = '';
break;
case 'paid':
$c = 'AND payout_detail_id IS NOT NULL';
break;
case 'not-paid':
$c = 'AND payout_detail_id IS NULL';
break;
}
return "EXISTS\n (SELECT * FROM ?_aff_commission\n WHERE aff_id={$a}.user_id\n {$c})";
}
开发者ID:grlf,项目名称:eyedock,代码行数:16,代码来源:AffWithCommission.php
示例14: viewAction
function viewAction()
{
// display payouts list date | method | total | paid |
$id = $this->getInt('payout_id');
if (!$id) {
throw new Am_Exception_InputError("Not payout_id passed");
}
$ds = new Am_Query($this->getDi()->affPayoutDetailTable);
$ds->leftJoin('?_aff_payout', 'p', 'p.payout_id=t.payout_id');
$ds->leftJoin('?_user', 'u', 't.aff_id=u.user_id');
$ds->addField('u.*');
$ds->addField('p.type', 'type');
$ds->addWhere('t.payout_id=?d', $id);
$grid = new Am_Grid_Editable('_d', ___("Payout %d Details", $id), $ds, $this->_request, $this->view);
$grid->setPermissionId('affiliates');
$grid->addCallback(Am_Grid_Editable::CB_RENDER_TABLE, array($this, 'addBackLink'));
$grid->addField('email', ___('E-Mail'));
$grid->addField('name_f', ___('First Name'));
$grid->addField('name_l', ___('Last Name'));
$grid->addField('type', ___('Payout Method'));
$grid->addField('amount', ___('Amount'));
// $grid->addField('receipt_id', ___('Receipt Id'));
$grid->addField('is_paid', ___('Is Paid?'));
$grid->addField(new Am_Grid_Field_Expandable('_details', ___('Payout Details')))->setGetFunction(array($this, 'getPayoutDetails'));
$grid->actionsClear();
//$grid->actionAdd(new Am_Grid_Action_LiveEdit('receipt_id'));
$grid->actionAdd(new Am_Grid_Action_PayoutMarkPaid('mark_paid', ___("Mark Paid")));
$grid->actionAdd(new Am_Grid_Action_PayoutMarkNotPaid('mark_notpaid', ___("Mark NOT Paid")));
$grid->runWithLayout();
// detail payout records date | method | paid | receipt_id | aff. payout fields
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:31,代码来源:AdminPayoutController.php
示例15: gridAction
public function gridAction()
{
$prefix = $this->getRequest()->getParam('prefix');
if (!$prefix) {
throw new Am_Exception_InputError('prefix is undefined');
}
if (!$this->getDi()->uploadAcl->checkPermission($prefix, Am_Upload_Acl::ACCESS_LIST, $this->getDi()->authAdmin->getUser())) {
throw new Am_Exception_AccessDenied();
}
$ds = new Am_Query($this->getDi()->uploadTable);
$ds->addWhere('prefix=?', $prefix);
$grid = new Am_Grid_Editable_Uploads('_files', 'Files', $ds, $this->getRequest(), $this->view);
$grid->setPermissionId('grid_content');
$grid->addField(new Am_Grid_Field('name', 'Name', true))->setRenderFunction(array($this, 'renderName'));
$grid->addField(new Am_Grid_Field('desc', 'Description', true));
$grid->actionsClear();
$grid->actionAdd(new Am_Grid_Action_LiveEdit('desc'));
$grid->addCallback(Am_Grid_ReadOnly::CB_RENDER_STATIC, array($this, 'addJs'));
$grid->isAjax(false);
$response = $grid->run();
$response->sendHeaders();
$response->sendResponse();
}
开发者ID:subashemphasize,项目名称:test_site,代码行数:23,代码来源:AdminUploadController.php
示例16: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->countryTable);
$ds->addField('ABS(tag)', 'tag_abs');
$ds->setOrderRaw('tag_abs desc, title');
$grid = new Am_Grid_Editable('_c', ___("Browse Countries"), $ds, $this->_request, $this->view);
$grid->setPermissionId(Am_Auth_Admin::PERM_COUNTRY_STATE);
$grid->addField(new Am_Grid_Field('tag_abs', ___('Sort Order'), true, null, null, '10%'));
$grid->addField(new Am_Grid_Field('title', ___('Title'), true));
$grid->addField(new Am_Grid_Field('country', ___('Code'), true));
$grid->setForm(array($this, 'createForm'));
$grid->actionAdd(new Am_Grid_Action_Url_Country('states', ___('Edit States'), '__ROOT__/admin-states/?country=__COUNTRY__'))->setTarget('_top');
$grid->actionDelete('delete');
$grid->actionDelete('insert');
$grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
$grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
$grid->addCallback(Am_Grid_Editable::CB_VALUES_FROM_FORM, array($this, 'valuesFromForm'));
$grid->actionAdd(new Am_Grid_Action_LiveEdit('title'));
$grid->actionAdd(new Am_Grid_Action_Group_CountryEnable(false));
$grid->actionAdd(new Am_Grid_Action_Group_CountryEnable(true));
$grid->setFilter(new Am_Grid_Filter_Text(___('Filter by Counrty Title'), array('title' => 'LIKE')));
return $grid;
}
开发者ID:grlf,项目名称:eyedock,代码行数:23,代码来源:AdminCountriesController.php
示例17: addDefaultSort
function addDefaultSort(Am_Query $q)
{
$a = $q->getAlias();
$type = $this->createRecord()->getAccessType();
$q->leftJoin('?_resource_access_sort', "ras", "{$a}.{$this->_key} = ras.resource_id AND ras.resource_type='{$type}'");
$q->addField('ras.sort_order', '_sort_order');
$q->setOrder('_sort_order');
}
开发者ID:grlf,项目名称:eyedock,代码行数:8,代码来源:ResourceAbstract.php
示例18: createGrid
public function createGrid()
{
$ds = new Am_Query($this->getDi()->productTable);
$ds->addWhere('t.is_archived = ?', 0);
$ds->addOrder('sort_order')->addOrder('title');
$grid = new Am_Grid_Editable('_product', ___("Products"), $ds, $this->_request, $this->view);
$grid->setRecordTitle(___('Product'));
$grid->actionAdd(new Am_Grid_Action_Group_ProductEnable(false));
$grid->actionAdd(new Am_Grid_Action_Group_ProductEnable(true));
$grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(false));
$grid->actionAdd(new Am_Grid_Action_Group_ProductAssignCategory(true));
$grid->actionAdd(new Am_Grid_Action_Group_ChangeOrder())->setTitle(___('Change Order'));
$grid->actionAdd(new Am_Grid_Action_Group_Archive(true));
$grid->addField(new Am_Grid_Field('product_id', '#', true, '', null, '1%'));
$grid->addField(new Am_Grid_Field('title', ___('Title'), true, '', null, '50%'))->setGetFunction(function ($r, $g, $f) {
return strip_tags($r->{$f});
});
if ($this->getDi()->db->selectCell("SELECT COUNT(*) FROM ?_product_product_category")) {
$grid->addField(new Am_Grid_Field('pgroup', ___('Product Categories'), false))->setRenderFunction(array($this, 'renderPGroup'));
}
$grid->addField(new Am_Grid_Field('terms', ___('Billing Terms'), false))->setRenderFunction(array($this, 'renderTerms'));
if ($this->getDi()->plugins_tax->getEnabled()) {
$grid->addField(new Am_Grid_Field('tax_group', ___('Tax')));
$grid->actionAdd(new Am_Grid_Action_LiveCheckbox('tax_group'))->setValue(IProduct::ALL_TAX)->setEmptyValue(IProduct::NO_TAX);
}
$grid->actionGet('edit')->setTarget('_top');
$grid->actionDelete('delete');
$grid->actionAdd(new Am_Grid_Action_Archive('delete', 1));
$grid->actionAdd(new Am_Grid_Action_LiveEdit('title'));
$grid->actionAdd(new Am_Grid_Action_Sort_Product());
$grid->setFormValueCallback('start_date', array('RECORD', 'getStartDate'), array('RECORD', 'setStartDate'));
$grid->setFormValueCallback('require_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
$grid->setFormValueCallback('prevent_if_other', array('RECORD', 'unserializeList'), array('RECORD', 'serializeList'));
$grid->addCallback(Am_Grid_Editable::CB_AFTER_SAVE, array($this, 'afterSave'));
$grid->addCallback(Am_Grid_Editable::CB_VALUES_TO_FORM, array($this, 'valuesToForm'));
$grid->addCallback(Am_Grid_ReadOnly::CB_TR_ATTRIBS, array($this, 'getTrAttribs'));
$grid->setForm(array($this, 'createForm'));
$grid->setFilter(new Am_Grid_Filter_Product());
$grid->setEventId('gridProduct');
$grid->actionAdd(new Am_Grid_Action_Url('categories', ___('Edit Categories'), REL_ROOT_URL . '/admin-product-categories'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('edit');
$grid->actionAdd(new Am_Grid_Action_Url('upgrades', ___('Manage Product Upgrade Paths'), REL_ROOT_URL . '/admin-products/upgrades'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('edit');
$grid->actionAdd(new Am_Grid_Action_CopyProduct())->setTarget('_top');
$ar_count = $this->getArchivedCount(1);
if ($ar_count) {
$grid->actionAdd(new Am_Grid_Action_Url('archived', ___("Archived products") . " ({$ar_count})", REL_ROOT_URL . '/admin-products/archived'))->setType(Am_Grid_Action_Abstract::NORECORD)->setTarget('_top')->setCssClass('link')->setPrivilegeId('browse');
}
return $grid;
}
开发者ID:grlf,项目名称:eyedock,代码行数:48,代码来源:AdminProductsController.php
示例19: 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;
}
开发者ID:alexanderTsig,项目名称:arabic,代码行数:14,代码来源:AdminLogsController.php
示例20: getQuery
protected function getQuery()
{
$q = new Am_Query($this->getDi()->uploadTable);
$q->addOrder('name');
if ($this->prefix) {
$q->addWhere('prefix=?', $this->prefix);
}
return $q;
}
开发者ID:alexanderTsig,项目名称:arabic,代码行数:9,代码来源:Storage.php
注:本文中的Am_Query类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论