示例#1
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($active = $this->getProperty('active')) {
         $c->where(array('active' => 1));
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select(array('qsbSetUserGroup.*', 'UserGroup.name'));
     $c->innerJoin('modUserGroup', 'UserGroup');
     $c->where(array('set' => $this->getProperty('id')));
     return $c;
 }
示例#3
0
 /**
  * Can be used to adjust the query prior to the COUNT statement
  *
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($query = $this->getProperty('query', null)) {
         $c->where(array('ip:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->rightJoin('modResourceGroup', 'modResourceGroup', 'modResourceGroup.id = msdProductGroup.id');
     $c->select($this->modx->getSelectColumns($this->classKey, $this->classKey));
     $c->select($this->modx->getSelectColumns('modResourceGroup', 'modResourceGroup'));
     return $c;
 }
示例#5
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('searchbox');
     $combo = $this->getProperty('combobox');
     $history = $this->getProperty('historical');
     //$qu = array();
     if (!empty($query)) {
         $qu = array('title:LIKE' => '%' . preg_replace('/[^a-rtzA-Z0-9]/', '%', $query) . '%');
     }
     $andState = !empty($query) ? 'AND:' : '';
     if (!empty($combo)) {
         $calfilt = $this->modx->newQuery('GcCalendarCalsConnect');
         $calfilt->where(array('calid:=' => $combo));
         $cals = $this->modx->getCollection('GcCalendarCalsConnect', $calfilt);
         $cids = array();
         foreach ($cals as $ca) {
             $cids[] = $ca->get('evid');
         }
         $tp = array($andState . 'id:IN' => $cids);
     }
     $andState = !empty($query) || !empty($combo) ? 'AND:' : '';
     $stime = strtotime('-1 day');
     $tim = $history == 1 ? array($andState . 'start:<=' => $stime, 'AND:end:<=' => $stime, 'or:repeatenddate:<=' => $stime) : array($andState . 'start:>=' => $stime, 'OR:end:>=' => $stime, 'OR:repeatenddate:>=' => $stime);
     $c->where(array($qu, $tp, $tim));
     return $c;
 }
示例#6
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($tid = $this->getProperty('tid')) {
         $c->where(array('tid' => $tid));
     }
     return parent::prepareQueryBeforeCount($c);
 }
示例#7
0
 protected function getResults(xPDOQuery &$c)
 {
     $list = array();
     $this->currentIndex = 0;
     if ($c->prepare()) {
         if ($c->stmt->execute()) {
             while ($row = $c->stmt->fetch(PDO::FETCH_ASSOC)) {
                 $object_id = $row['object_id'];
                 if (empty($list[$object_id])) {
                     $list[$object_id] = $row;
                     $list[$object_id]['tvs'] = array();
                     $this->currentIndex++;
                 }
                 if (!empty($row['tv_name'])) {
                     $list[$object_id]['tvs'][$row['tv_name']] = array('tv_id' => $row['tv_id'], 'caption' => $row['tv_caption'], 'category' => $row['tv_category'], 'value_id' => $row['tv_value_id'], 'value' => $row['tv_value']);
                 }
             }
         } else {
             if ($c->stmt->errorCode() !== "00000") {
                 $this->modx->log(xPDO::LOG_LEVEL_ERROR, __CLASS__);
                 $this->modx->log(xPDO::LOG_LEVEL_ERROR, print_r($c->stmt->errorInfo(), true));
                 $this->modx->log(xPDO::LOG_LEVEL_ERROR, $c->toSQL());
             }
         }
     }
     return $list;
 }
示例#8
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;
 }
 /**
  * {@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;
 }
示例#10
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $lang_key = $this->getProperty('langid');
     $contextlm = $this->getProperty('contextlm');
     $c->where(array('lang_key' => $lang_key, 'context' => $contextlm));
     return $c;
 }
示例#11
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->innerJoin('sxNewsletter', 'sxNewsletter', 'sxNewsletter.id = sxQueue.newsletter_id');
     $c->select($this->modx->getSelectColumns('sxQueue', 'sxQueue'));
     $c->select('sxNewsletter.name as newsletter');
     return $c;
 }
 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($query = $this->getProperty('query')) {
         $c->where(array('word:LIKE' => "%{$query}%", 'OR:alias:LIKE' => "%{$query}%"));
     }
     return $c;
 }
示例#13
0
 public function prepareQueryAfterCount(xPDOQuery $c)
 {
     if ($this->getProperty('sort') == 'category') {
         $c->sortby('parent', $this->getProperty('dir', 'ASC'));
     }
     return $c;
 }
示例#14
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $search = $this->getProperty('search', '');
     if (!empty($search)) {
         $c->where(array('name:LIKE' => '%' . $search . '%', 'OR:path:LIKE' => '%' . $search . '%'));
     }
     return $c;
 }
示例#15
0
 /**
  * @return mixed
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $tid = $this->getProperty('tid');
     if ($tid) {
         $c->where(array('template' => $tid));
     }
     return $c;
 }
示例#16
0
 protected function setSelection(xPDOQuery $c)
 {
     $c->select(array("Product.*", "Product.id as `product_id`", "{$this->classKey}.id as object_id"));
     /*$c->prepare();
       print $c->toSQL();
       exit;*/
     return $c;
 }
示例#17
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $form = (int) $this->getProperty('form');
     if ($form) {
         $c->where(array('form' => $form));
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->andCondition(array('id' => $query, 'OR:name:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#19
0
 /**
  * {@inheritDoc}
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c->select('id,parent,pagetitle,context_key');
     if ($query = $this->getProperty('query')) {
         $c->where(array('pagetitle:LIKE' => "%{$query}%"));
     }
     return $c;
 }
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('local_name:LIKE' => '%' . $query . '%', 'OR:lang_code:LIKE' => '%' . $query . '%', 'OR:lcid_string:LIKE' => '%' . $query . '%', 'OR:lcid_dec:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#21
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $form = $this->getProperty('form_id');
     if (!empty($form)) {
         $c->where(array('form_id' => $form));
     }
     return $c;
 }
示例#22
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('resource_id:LIKE' => "%{$query}%", 'OR:maxposter_id:LIKE' => "%{$query}%"));
     }
     return $c;
 }
示例#23
0
 /** {@inheritDoc} */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = $this->getProperty('query');
     if (!empty($query)) {
         $c->where(array('name:LIKE' => '%' . $query . '%'));
     }
     return $c;
 }
示例#24
0
 /**
  * Can be used to adjust the query prior to the COUNT statement
  *
  * @param xPDOQuery $c
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $parentId = $this->getProperty('parentId');
     if (!empty($parentId)) {
         $c->where(array('parent_id' => $parentId));
     }
     return $c;
 }
示例#25
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('name:LIKE' => "%{$query}%", 'OR:description:LIKE' => "%{$query}%"));
     }
     return $c;
 }
示例#26
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $exclude = $this->getProperty('exclude', '');
     if (!empty($exclude)) {
         $c->where(array('id:NOT IN' => is_array($exclude) ? $exclude : explode(',', $exclude)));
     }
     return $c;
 }
示例#27
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;
 }
示例#28
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     if ($this->getProperty('combo')) {
         $c->select('id,name');
         $c->where(array('active' => 1));
     }
     return $c;
 }
示例#29
0
 /**
  * @param xPDOQuery $c
  *
  * @return xPDOQuery
  */
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $query = trim($this->getProperty('query'));
     if ($query) {
         $c->where(array('id:LIKE' => "%{$query}%", 'OR:title:LIKE' => "%{$query}%", 'OR:parent:LIKE' => "%{$query}%", 'OR:level:LIKE' => "%{$query}%", 'OR:active:LIKE' => "%{$query}%"));
     }
     return $c;
 }
示例#30
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $parentClass = $this->getProperty('parentClass', '');
     if (!empty($parentClass)) {
         $c->where(array('parent_class' => $parentClass));
     }
     return $c;
 }