public function prepareQueryBeforeCount(xPDOQuery $c) { $c = parent::prepareQueryBeforeCount($c); $folders = array(startId); $where = array('id:in' => $this->getFolders((int) $this->getProperty('startId'), $folders), 'or:parent:in' => $this->getFolders((int) $this->getProperty('startId'), $folders)); $c->where($where); return $c; }
public function afterIteration(array $list) { $list = parent::afterIteration($list); $process_tags = $this->getProperty('process_tags'); switch ($this->getProperty('image_url_schema')) { case 'base': $images_base_url = $this->getSourcePath(); break; case 'full': $images_base_url = $this->modx->getOption('site_url'); $images_base_url .= preg_replace("/^\\/*/", "", $this->getSourcePath()); break; default: $images_base_url = ''; } foreach ($list as &$l) { // Картинка # = ''; if (!empty($l['image'])) { $l['public_image'] = $images_base_url . $l['image']; } // Тэги if ($process_tags and $tags = $l['tags']) { $tags_ids = explode(",", $tags); $tags_q = $this->modx->newQuery("modResource", array("id:in" => $tags_ids, "published" => 1, "hidemenu" => 0, "deleted" => 0)); $tags_q->select(array("id as id", "pagetitle as tag", "uri as uri")); $s = $tags_q->prepare(); $s->execute(); $l['tags_array'] = $s->fetchAll(PDO::FETCH_ASSOC); } $l['gallery'] = array(); if (!empty($l['tvs']['gallery']['value']) and $gallery = json_decode($l['tvs']['gallery']['value'], 1)) { foreach ($gallery as $image) { $image['image'] = $images_base_url . $image['image']; # $image['image'] = $image['image']; $l['gallery'][] = $image; if (!$l['image']) { $l['image'] = $image['image']; } } } $l['sell_link'] = array(); if (!empty($l['tvs']['sell_link']['value']) and $sell_link = json_decode($l['tvs']['sell_link']['value'], 1)) { foreach ($sell_link as $link) { # $image['image'] = $image['image']; $l['sell_link'][] = $link; } } } return $list; }