/** * @absctract */ public function getDocs($tvlist = '') { if ($tvlist == '') { $tvlist = $this->getCFGDef('tvList', ''); } $this->extTV->getAllTV_Name(); if ($this->extPaginate = $this->getExtender('paginate')) { $this->extPaginate->init($this); } else { $this->setConfig(array('start' => 0)); } $type = $this->getCFGDef('idType', 'parents'); $this->_docs = $type == 'parents' ? $this->getChildrenList() : $this->getDocList(); if ($tvlist != '' && count($this->_docs) > 0) { $tv = $this->extTV->getTVList(array_keys($this->_docs), $tvlist); if (!is_array($tv)) { $tv = array(); } foreach ($tv as $docID => $TVitem) { if (isset($this->_docs[$docID]) && is_array($this->_docs[$docID])) { $this->_docs[$docID] = array_merge($this->_docs[$docID], $TVitem); } else { unset($this->_docs[$docID]); } } } if (1 == $this->getCFGDef('tree', '0')) { $this->treeBuild('id', 'parent'); } return $this->_docs; }
protected function parseFilter($filter) { $return = false; // use the parsing mechanism of the content filter for the start if (parent::parseFilter($filter)) { $this->extTV->getAllTV_Name(); $tmp = $this->extTV->getTVid($this->field); if (!is_array($tmp)) { $tmp = array(); } $tmp = array_keys($tmp); if (count($tmp) == 1) { $this->tv_id = $tmp[0]; } if (!$this->tv_id) { $tvid = $this->modx->db->query("SELECT id FROM " . $this->DocLister->getTable('site_tmplvars') . " WHERE `name` = '" . $this->modx->db->escape($this->field) . "'"); $this->tv_id = intval($this->modx->db->getValue($tvid)); } if (!$this->tv_id) { $this->DocLister->debug->warning('DocLister filtering by template variable "' . $this->DocLister->debug->dumpData($this->field) . '" failed. TV not found!'); } else { // create the alias for the join $alias = 'dltv_' . $this->field; if ($this->totalFilters > 0) { $alias .= '_' . $this->totalFilters; } $this->setTableAlias($alias); $this->tvName = $this->field; $this->field = 'value'; $return = true; } } return $return; }