public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $alias = $c->getAlias();
     $c->select(array("{$alias}.*", "{$alias}.pathRelative as relativeUrl"));
     $where = array("source" => $this->source->id);
     // Скрытие файлов
     if ($this->getProperty('hideFiles')) {
         $where['type!:='] = 'file';
     }
     // Фильтр файлов по названию
     if ($query = trim($this->getProperty('query'))) {
         $c->where(array('name:like' => "%{$query}%", 'OR:tags:like' => "%{$query}%"));
     }
     /*
         Только свои
     */
     if ($this->getProperty('own_only')) {
         $c->where(array('createdby' => $this->modx->user->id, 'OR:modifiedby:=' => $this->modx->user->id));
     }
     $c->where($where);
     # $c->prepare();
     # print $c->toSQL();
     # exit;
     # if($where = $this->getProperty('where')){
     #     $c->where($where);
     # }
     return $c;
 }
Beispiel #2
0
 public function prepareQueryBeforeCount(xPDOQuery $c)
 {
     $c = parent::prepareQueryBeforeCount($c);
     $c->select(array("`{$this->classKey}`.*"));
     return $c;
 }