Example #1
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('published' => 1, 'deleted' => 0));
     if ($parents = $this->getProperty('parents')) {
         $parents = explode(',', $parents);
         $in = array();
         foreach ($parents as $id) {
             $in = array_merge($in, $this->modx->getChildIds($id));
         }
         $c->where(array('parent:IN' => array_unique($in)));
     }
     if ($resources = $this->getProperty('resources')) {
         $resources = explode(',', $resources);
         $in = $out = array();
         foreach ($resources as $id) {
             if ($id > 0) {
                 $in[] = $id;
             } else {
                 if ($id < 0) {
                     $out[] = abs($id);
                 }
             }
         }
         if (!empty($in)) {
             $c->where(array('id:IN' => $in));
         }
         if (!empty($out)) {
             $c->where(array('id:NOT IN' => $out));
         }
     }
     if ($search = $this->getProperty('search')) {
         $c->where(array('pagetitle:LIKE' => "%{$search}%"));
     }
     return $c;
 }
 /**
  * {@inheritdoc}
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $this->elementId = $this->getProperty('elementId', false);
     $this->elementType = $this->getProperty('elementType', false);
     $id = $this->getProperty('id', 0);
     /*$tagNameParts = xPDO :: escSplit('@', $this->getProperty('tag'));
       $propertySet = isset($tagNameParts[1]) ? trim($tagNameParts[1]) : null;
       if (isset($propertySet) && strpos($propertySet,':') != false) {
           $propSetParts = xPDO :: escSplit(':', $propertySet);
           $propertySet = trim($propSetParts[0]);
       }*/
     $c->leftJoin('modElementPropertySet', 'Elements', array('Elements.element_class' => $this->elementType, 'Elements.element' => $this->elementId, 'Elements.property_set = modPropertySet.id'));
     $this->showNotAssociated = (bool) $this->getProperty('showNotAssociated', false);
     $showAssociated = (bool) $this->getProperty('showAssociated', false);
     if ($this->showNotAssociated) {
         $c->where(array('Elements.property_set' => null));
     } else {
         if ($showAssociated) {
             $c->where(array('Elements.property_set:!=' => null));
         }
     }
     /*if (empty($id)) {
           $propertySet = $this->getProperty('propertySet', '');
           if (!empty($propertySet) && $this->modx->getCount('modPropertySet', array('name'=>$propertySet))) {
               $c->orCondition("modPropertySet.name = {$this->modx->quote($propertySet)}");
           }
       }*/
     return $c;
 }
Example #3
0
 /** {@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;
 }
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('modMediaSource', 'Source');
     $c->leftJoin($this->classKey, 'Thumb', "`{$this->classKey}`.`id` = `Thumb`.`parent`");
     $c->groupby($this->classKey . '.id');
     $c->select('`Source`.`name` as `source_name`');
     $c->select('`Thumb`.`url` as `thumbnail`');
     $c->where(array('resource_id' => $this->getProperty('resource_id')));
     $parent = $this->getProperty('parent');
     if ($parent !== false) {
         $c->where(array('parent' => $parent));
     }
     $query = trim($this->getProperty('query'));
     if (!empty($query)) {
         $c->where(array('file:LIKE' => "%{$query}%", 'OR:name:LIKE' => "%{$query}%", 'OR:alt:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%", 'OR:add:LIKE' => "%{$query}%"));
     }
     $tags = array_map('trim', explode(',', $this->getProperty('tags')));
     if (!empty($tags[0])) {
         $tags = implode("','", $tags);
         $c->innerJoin('msResourceFileTag', 'Tag', "`{$this->classKey}`.`id` = `Tag`.`file_id` AND `Tag`.`tag` IN ('" . $tags . "')");
         $c->groupby($this->classKey . '.id');
         $c->prepare();
         $this->modx->log(1, $c->toSQL());
     }
     return $c;
 }
Example #5
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $id = $this->getProperty('id');
     if (!empty($id) and $this->getProperty('combo')) {
         $q = $this->modx->newQuery($this->objectType);
         $q->where(array('id!=' => $id));
         $q->select('id');
         $q->limit(11);
         $q->prepare();
         $q->stmt->execute();
         $ids = $q->stmt->fetchAll(PDO::FETCH_COLUMN, 0);
         $ids = array_merge_recursive(array($id), $ids);
         $c->where(array("{$this->objectType}.id:IN" => $ids));
     }
     $active = $this->getProperty('active');
     if ($active != '') {
         $c->where("{$this->objectType}.active={$active}");
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array("{$this->objectType}.name_ru:LIKE" => "%{$query}%", "OR:{$this->objectType}.name_en:LIKE" => "%{$query}%"));
     }
     $c->sortby('active', 'DESC');
     $c->sortby('name_ru', 'ASC');
     return $c;
 }
Example #6
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $context = array_map('trim', explode(',', $this->getProperty('context', $this->modx->context->key)));
     $c->where(array('class_key' => 'TicketsSection', 'published' => 1, 'deleted' => 0, 'context_key:IN' => $context));
     $sortby = $this->getProperty('sortby');
     $sortdir = $this->getProperty('sortdir');
     if ($sortby && $sortdir) {
         $c->sortby($sortby, $sortdir);
     }
     if (!empty($_REQUEST['tid']) && ($tmp = $this->modx->getObject('Ticket', (int) $_REQUEST['tid']))) {
         $this->current_category = $tmp->get('parent');
     }
     if ($parents = $this->getProperty('parents')) {
         $depth = $this->getProperty('depth', 0);
         $parents = array_map('trim', explode(',', $parents));
         foreach ($parents as $pid) {
             $parents = array_merge($parents, $this->modx->getChildIds($pid, $depth));
         }
         if (!empty($parents) && !empty($this->current_category)) {
             $c->where(array('parent:IN' => $parents, 'OR:id:=' => $this->current_category));
         } else {
             $c->where(array('parent:IN' => $parents));
         }
     }
     if ($resources = $this->getProperty('resources')) {
         $resources = array_map('trim', explode(',', $resources));
         $c->where(array('id:IN' => $resources));
     }
     return $c;
 }
Example #7
0
 /**
  * @return mixed
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select($this->modx->getSelectColumns('modManagerLog', 'modManagerLog', '', array('action'), true));
     //        $c->select($this->modx->getSelectColumns('modManagerLog','modManagerLog'));
     $c->select(array('User.username', 'Template.templatename', 'Chunk.name as chunkname', 'Snippet.name as snippetname', 'Plugin.name as pluginname', 'TV.name as tvname'));
     $c->innerJoin('modUser', 'User');
     $c->leftJoin('modTemplate', 'Template', '`modManagerLog`.item = `Template`.`id` AND `modManagerLog`.`classKey` = "modTemplate"');
     $c->leftJoin('modChunk', 'Chunk', '`modManagerLog`.item = `Chunk`.`id` AND `modManagerLog`.`classKey` = "modChunk"');
     $c->leftJoin('modSnippet', 'Snippet', '`modManagerLog`.item = `Snippet`.`id` AND `modManagerLog`.`classKey` = "modSnippet"');
     $c->leftJoin('modPlugin', 'Plugin', '`modManagerLog`.item = `Plugin`.`id` AND `modManagerLog`.`classKey` = "modPlugin"');
     $c->leftJoin('modTemplateVar', 'TV', '`modManagerLog`.item = `TV`.`id` AND `modManagerLog`.`classKey` = "modTemplateVar"');
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where('(Template.templatename LIKE "%' . $query . '%" OR Chunk.name LIKE "%' . $query . '%" OR Snippet.name LIKE "%' . $query . '%" OR Plugin.name LIKE "%' . $query . '%" OR TV.name LIKE "%' . $query . '%")');
     } else {
         $c->where('(modManagerLog.action LIKE "template_%" OR modManagerLog.action LIKE "chunk_%" OR modManagerLog.action LIKE "snippet_%" OR modManagerLog.action LIKE "plugin_%" OR modManagerLog.action LIKE "tv_%")');
     }
     $user = intval($this->getProperty('user'));
     if ($user) {
         $c->andCondition(array('modManagerLog.user' => $user));
     }
     $dateStart = trim($this->getProperty('datestart'));
     if ($dateStart) {
         $dateStart = date('Y-m-d', strtotime($dateStart));
         $c->andCondition(array('modManagerLog.occurred:>=' => $dateStart));
     }
     $dateEnd = trim($this->getProperty('dateend'));
     if ($dateEnd) {
         $dateEnd = date('Y-m-d 23:59:59', strtotime($dateEnd));
         $c->andCondition(array('modManagerLog.occurred:<=' => $dateEnd));
     }
     return $c;
 }
Example #8
0
 /**
  * @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;
 }
Example #9
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin("glData", "glData", "glData.identifier = {$this->classKey}.id");
     $c->select($this->modx->getSelectColumns("glData", "glData"));
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
     switch ($this->classKey) {
         case 'glCountry':
             break;
         case 'glRegion':
             $c->leftJoin("glCountry", "glCountry", "glCountry.iso = {$this->classKey}.country");
             $c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
             break;
         case 'glCity':
             $c->leftJoin("glRegion", "glRegion", "glRegion.id = {$this->classKey}.region_id");
             $c->select($this->modx->getSelectColumns("glRegion", "glRegion", 'region_', array('id'), true));
             $c->leftJoin("glCountry", "glCountry", "glCountry.iso = glRegion.country");
             $c->select($this->modx->getSelectColumns("glCountry", "glCountry", 'country_', array('id'), true));
             break;
     }
     $active = $this->getProperty('active');
     if ($active != '') {
         $c->where(array("{$this->objectType}.active" => $active));
     }
     $default = $this->getProperty('default');
     if ($default != '') {
         $c->where(array("{$this->objectType}.default" => $default));
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array("{$this->objectType}.name_ru:LIKE" => "%{$query}%", "OR:{$this->objectType}.name_en:LIKE" => "%{$query}%"));
     }
     return $c;
 }
Example #10
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $class = $this->getProperty('class');
     if ($class) {
         $c->where(array('class' => $class));
     }
     if ($this->getProperty('combo')) {
         $c->select('id,name');
         if ($instance_id = $this->getProperty('instance_id')) {
             if ($instance = $this->modx->getObject($class, $instance_id)) {
                 $status = $instance->getOne('Status');
                 if ($status->get('final') == 1) {
                     $c->where(array('id' => $status->get('id')));
                 } else {
                     if ($status->get('fixed') == 1) {
                         $c->where(array('rank:>=' => $status->get('rank')));
                     }
                 }
             }
         }
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
     }
     return $c;
 }
Example #11
0
 function prepareQueryBeforeCount(xPDOQuery $c)
 {
     // Filter by position
     if ($position = $this->getProperty('position')) {
         $mode = $this->getProperty('mode', 'include');
         $q = $this->modx->newQuery('byAdPosition');
         $q->select('ad');
         $q->where(array('position' => $position));
         if ($q->prepare() && $q->stmt->execute()) {
             $ads = array_unique($q->stmt->fetchAll(PDO::FETCH_COLUMN));
         }
         if (!empty($ads)) {
             if ($mode == 'exclude') {
                 $c->where(array('id:NOT IN' => $ads));
             } else {
                 $c->where(array('id:IN' => $ads));
             }
         }
     }
     // Filter by search query
     if ($query = $this->getProperty('query')) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
     }
     return $c;
 }
Example #12
0
 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('class_key' => 'msCategory'));
     if ($query = $this->getProperty('query')) {
         $c->where(array('pagetitle:LIKE' => "%{$query}%"));
     }
     return $c;
 }
Example #13
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('product_id' => $this->getProperty('product_id')));
     $parent = $this->getProperty('parent');
     if ($parent !== false) {
         $c->where(array('parent' => $parent));
     }
     return $c;
 }
Example #14
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('pagetitle:LIKE' => '%' . $query . '%'));
     }
     $c->where(array('deleted' => false, 'published' => true));
     $c->sortby('pagetitle', 'ASC');
     return $c;
 }
Example #15
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('quipThread', 'Thread');
     $c->where(array('quipCommentNotify.thread:=' => $this->getProperty('thread')));
     $search = $this->getProperty('search');
     if ($search) {
         $c->where(array('quipCommentNotify.email:LIKE' => '%' . $search . '%'), null, 2);
     }
     return $c;
 }
Example #16
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('modCategory', 'Category');
     $props = $this->getProperties();
     if (isset($props['onlySmartTag']) && $props['onlySmartTag'] === 'true') {
         $c->where(array('type' => 'smarttag'));
     } else {
         $c->where(array('type:IN' => array('autotag', 'tag', 'smarttag')));
     }
     return $c;
 }
Example #17
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($parents = $this->getProperty('parents')) {
         if (!is_array($parents)) {
             $parents = explode(',', $parents);
         }
         $c->where(array('parent:IN' => $parents));
     }
     $c->where(array('class_key' => 'Ticket', 'published' => 1, 'deleted' => 0));
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     $tagId = $this->getProperty('tagId');
     $c->leftJoin('TaggerTagResource', 'TagResource', array('modResource.id = TagResource.resource'));
     $c->where(array('TagResource.tag' => $tagId));
     if (!empty($query)) {
         $c->where(array('pagetitle:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
Example #19
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('domain:LIKE' => "%{$query}%", 'OR:tic:LIKE' => "%{$query}%", 'OR:pr:LIKE' => "%{$query}%", 'OR:yaca:LIKE' => "%{$query}%", 'OR:dmoz:LIKE' => "%{$query}%", 'OR:yaindex:LIKE' => "%{$query}%", 'OR:yaindex_up:LIKE' => "%{$query}%", 'OR:gooindex:LIKE' => "%{$query}%", 'OR:gooindex_up:LIKE' => "%{$query}%", 'OR:liveinternet:LIKE' => "%{$query}%", 'OR:domainend:LIKE' => "%{$query}%", 'OR:update:LIKE' => "%{$query}%", 'OR:sorting_id:LIKE' => "%{$query}%"));
     }
     if ($this->getProperty('combo')) {
         $c->where(array('active' => 1));
     }
     return $c;
 }
Example #20
0
 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($active = $this->getProperty('active')) {
         $c->where(array('active' => $active));
     }
     if ($this->getProperty('combo')) {
         $c->select('id,name_in');
         $c->where(array('active' => 1));
     }
     return $c;
 }
 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->where(array('id:IN' => array_keys($this->ids)));
     $c->leftJoin('mseIntro', 'mseIntro', '`modResource`.`id` = `mseIntro`.`resource`');
     if (!$this->getProperty('unpublished')) {
         $c->where(array('published' => 1));
     }
     if (!$this->getProperty('deleted')) {
         $c->where(array('deleted' => 0));
     }
     return $c;
 }
Example #22
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey, ''));
     if ($this->getProperty('target')) {
         $c->where(array('target' => $this->getProperty('target')));
     }
     $c->where(array('principal_class' => $this->getProperty('principal_class')));
     if ($this->getProperty('principal')) {
         $c->where(array('principal' => $this->getProperty('principal')));
     }
     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 prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('pagetitle:LIKE' => "{$query}%"));
     }
     $ctx = $this->getProperty('context');
     if (!empty($ctx)) {
         $c->where(array('context_key:=' => $ctx));
     }
     return $c;
 }
Example #25
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $resource_id = intval($this->getProperty('resource_id'));
     if (!empty($resource_id)) {
         $c->where(array('resource' => $resource_id));
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:title:LIKE' => "%{$query}%"));
     }
     return $c;
 }
Example #26
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('name:LIKE' => '%' . $query . '%'));
     }
     $fieldType = $this->getProperty('fieldType');
     if ($fieldType) {
         $c->where(array('field_type' => $fieldType));
     }
     return $c;
 }
Example #27
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $class = $this->getProperty('class');
     if ($class) {
         $c->where(array('class' => $class));
     }
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%", 'OR:event:LIKE' => "%{$query}%"));
     }
     return $c;
 }
Example #28
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $search = $this->getProperty('search');
     if (!empty($search)) {
         $c->where(array('key:LIKE' => '%' . $search . '%', 'OR:description:LIKE' => '%' . $search . '%'));
     }
     $exclude = $this->getProperty('exclude');
     if (!empty($exclude)) {
         $c->where(array('key:NOT IN' => is_string($exclude) ? explode(',', $exclude) : $exclude));
     }
     return $c;
 }
Example #29
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $exclude = array('virtualpage');
     $exclude = array_merge($exclude, array_map('trim', explode(',', $this->modx->getOption('virtualpage_exclude_event_groupname'))));
     $eventColumns = $this->modx->getSelectColumns('modEvent', 'modEvent', '', array(), true);
     $c->select($eventColumns);
     $c->where(array('groupname:NOT IN' => $exclude));
     if ($query = $this->getProperty('query')) {
         $c->where(array('name:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->leftJoin('modCategory', 'Category');
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('modSnippet.name:LIKE' => '%' . $query . '%', 'OR:Category.category:LIKE' => '%' . $query . '%'));
     }
     $id = $this->getProperty('id');
     if (!empty($id)) {
         $c->where(array('id' => $id));
     }
     return $c;
 }