public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); # if($this->getProperty('parent_joining_type') == 'inner'){ # $c->innerJoin('modResource', "Parent"); # } # else{ # $c->leftJoin('modResource', "Parent"); # } # $c->innerJoin('modUser', 'Author', "Author.id = {$alias}.createdby"); # $where = array("parent" => 86855, "OR:rss:=" => 1); # # $c->where($where); # print '<pre>'; # print_r($this->properties); # print '</pre>'; # $c->select(array( # "{$alias}.id", # "{$alias}.pagetitle", # )); # $c->prepare(); # print $c->toSQL(); # exit; return $c; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); $c->innerJoin('view.modResourceVisitView', "visits", "visits.resource_id = {$alias}.id"); $where = array(); if ($where) { $c->where($where); } return $c; }
public function prepareQueryBeforeCount(xPDOQuery $q) { $q = parent::prepareQueryBeforeCount($q); # $q->innerJoin('modResource', 'Parent'); # $q->innerJoin('SocietyBlogTopic', 'bt', "bt.topicid = {$this->classKey}.id"); // По типу заведения # if($facility_type = (int)$this->getProperty('facility_type')){ # $q->innerJoin("modTemplateVarResource", "facility_type", "facility_type.contentid = Parent.id AND facility_type.tmplvarid = 25 AND facility_type.value = {$facility_type}"); # } return $q; }
public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $alias = $c->getAlias(); # $c->leftJoin('ShopmodxProduct', 'Product'); $where = array(); # if($this->getProperty('listType') == 'products'){ # $where["Product.id:!="] = null; # } # else{ # $where["{$this->classKey}.parent"] = $this->getProperty('parent'); # } switch ($this->getProperty('listType')) { case 'articles': if (!$this->getProperty('parent')) { $this->setProperty('parent', null); } $where['template'] = 2; break; default: $parent = $this->getProperty('parent'); if (is_numeric($parent)) { $where["{$alias}.parent"] = $parent; } } if ($context_key = $this->getProperty('context_key')) { $where["{$this->classKey}.context_key"] = $this->getProperty('context_key'); } if ($where) { $c->where($where); } return $c; }