public function prepareQueryBeforeCount(xPDOQuery $c) { $c->leftJoin('modUserProfile', 'Profile'); $query = $this->getProperty('query', ''); if (!empty($query)) { $c->where(array('modUser.username:LIKE' => '%' . $query . '%')); $c->orCondition(array('Profile.fullname:LIKE' => '%' . $query . '%')); $c->orCondition(array('Profile.email:LIKE' => '%' . $query . '%')); } return $c; }
/** {@inheritDoc} */ public function prepareQueryBeforeCount(xPDOQuery $c) { $c->where(array('class_key' => 'msProduct')); $c->leftJoin('msProductData', 'Data', 'msProduct.id = Data.id'); $c->leftJoin('msCategoryMember', 'Member', 'msProduct.id = Member.product_id'); $c->leftJoin('msVendor', 'Vendor', 'Data.vendor = Vendor.id'); $c->leftJoin('msCategory', 'Category', 'Category.id = msProduct.parent'); if ($this->getProperty('combo')) { $c->select('msProduct.id,msProduct.pagetitle,msProduct.context_key'); } else { $c->select($this->modx->getSelectColumns('msProduct', 'msProduct')); $c->select($this->modx->getSelectColumns('msProductData', 'Data', '', array('id'), true)); $c->select($this->modx->getSelectColumns('msVendor', 'Vendor', 'vendor_', array('name'))); $c->select($this->modx->getSelectColumns('msCategory', 'Category', 'category_', array('pagetitle'))); } if ($query = $this->getProperty('query', null)) { $queryWhere = array('msProduct.id' => $query, 'OR:msProduct.pagetitle:LIKE' => '%' . $query . '%', 'OR:description:LIKE' => '%' . $query . '%', 'OR:introtext:LIKE' => '%' . $query . '%', 'OR:Data.article:LIKE' => '%' . $query . '%', 'OR:Data.vendor:LIKE' => '%' . $query . '%', 'OR:Data.made_in:LIKE' => '%' . $query . '%', 'OR:Vendor.name:LIKE' => '%' . $query . '%', 'OR:Category.pagetitle:LIKE' => '%' . $query . '%'); $c->where($queryWhere); } $parent = $this->getProperty('parent'); if (!empty($parent)) { $category = $this->modx->getObject('modResource', $this->getProperty('parent')); $this->parent = $parent; $parents = array($parent); if ($this->modx->getOption('ms2_category_show_nested_products', null, true)) { $tmp = $this->modx->getChildIds($parent, 10, array('context' => $category->get('context_key'))); foreach ($tmp as $v) { $parents[] = $v; } } $c->orCondition(array('parent:IN' => $parents, 'Member.category_id:IN' => $parents), '', 1); } return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c->leftJoin('modUserProfile', 'Profile'); $query = $this->getProperty('query', ''); if (!empty($query)) { $c->where(array('modUser.username:LIKE' => '%' . $query . '%')); $c->orCondition(array('Profile.fullname:LIKE' => '%' . $query . '%')); $c->orCondition(array('Profile.email:LIKE' => '%' . $query . '%')); } $userGroup = $this->getProperty('usergroup', 0); if (!empty($userGroup)) { $c->innerJoin('modUserGroupMember', 'UserGroupMembers'); $c->where(array('UserGroupMembers.user_group' => $userGroup)); } return $c; }
/** * @param xPDOQuery $c * * @return xPDOQuery */ public function prepareQueryBeforeCount(xPDOQuery $c) { if ($linkType = $this->getProperty('link_type', false)) { $templates = array(); $resources = array(); if ($linkType === 'res-chunk') { $templates = $this->getParentsByLink('temp-chunk'); $templates = array_merge($templates, $this->getParentsByLink('chunk-chunk', 'temp-chunk')); $resources = $this->getParentsByLink('res-chunk'); } else { if ($linkType === 'res-snip') { $templates = $this->getParentsByLink('temp-snip'); $templates = array_merge($templates, $this->getParentsByLink('chunk-snip', 'temp-chunk')); $resources = $this->getParentsByLink('res-snip'); } } $templates = array_unique($templates); $tempCount = count($templates); $resCount = count($resources); if ($tempCount == 0 && $resCount == 0) { $c->where(array('id' => 0)); } else { if ($tempCount > 0) { $c->where(array('template:IN' => $templates)); } if ($resCount > 0) { $c->orCondition(array('id:IN' => $resources)); } } } else { $c->where(array('template' => $this->getProperty('id'))); } return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $query = $this->getProperty('query'); if (!empty($query)) { $c->where(array('modDashboardWidget.name:LIKE' => '%' . $query . '%')); $c->orCondition(array('modDashboardWidget.description:LIKE' => '%' . $query . '%')); } return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $query = $this->getProperty('query'); if (!empty($query)) { $c->where(array('modMediaSource.name:LIKE' => '%' . $query . '%')); $c->orCondition(array('modMediaSource.description:LIKE' => '%' . $query . '%')); } if ($this->getProperty('streamsOnly')) { $c->where(array('modMediaSource.is_stream' => true)); } return $c; }
public function prepareQueryAfterCount(xPDOQuery $c) { $query = $this->getProperty('query'); if (!empty($query)) { $c->where(array('modDashboard.name:LIKE' => '%' . $query . '%')); $c->orCondition(array('modDashboard.description:LIKE' => '%' . $query . '%')); } $userGroup = $this->getProperty('usergroup', false); if (!empty($userGroup)) { $c->innerJoin('modUserGroup', 'UserGroups'); $c->where(array('UserGroups.id' => $userGroup)); } return $c; }
/** {@inheritDoc} */ public function prepareQueryBeforeCount(xPDOQuery $c) { if ($master = $this->getProperty('master')) { $c->orCondition(array('master' => $master, 'slave' => $master)); } $c->innerJoin('msLink', 'msLink', 'msProductLink.link=msLink.id'); $c->leftJoin('msProduct', 'Master', 'Master.id=msProductLink.master'); $c->leftJoin('msProduct', 'Slave', 'Slave.id=msProductLink.slave'); $c->select($this->modx->getSelectColumns('msProductLink', 'msProductLink')); $c->select($this->modx->getSelectColumns('msLink', 'msLink', '', array('id'), true)); $c->select('`Master`.`pagetitle` as `master_pagetitle`, `Slave`.`pagetitle` as `slave_pagetitle`'); return $c; }