/** * @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; }
/** * Единые обработки массива с данными о документе для всех контроллеров * * @param array $data массив с данными о текущем документе * @param int $i номер итерации в цикле * @return array массив с данными которые можно использовать в цикле render метода */ protected function uniformPrepare(&$data, $i = 0) { $class = array(); $iterationName = $i % 2 == 0 ? 'Odd' : 'Even'; $tmp = strtolower($iterationName); $class[] = $this->getCFGDef($tmp . 'Class', $tmp); $this->renderTPL = $this->getCFGDef('tplId' . $i, $this->renderTPL); $this->renderTPL = $this->getCFGDef('tpl' . $iterationName, $this->renderTPL); $data[$this->getCFGDef("sysKey", "dl") . '.full_iteration'] = $this->extPaginate ? $i + $this->getCFGDef('display', 0) * ($this->extPaginate->currentPage() - 1) : $i; if ($i == 1) { $this->renderTPL = $this->getCFGDef('tplFirst', $this->renderTPL); $class[] = $this->getCFGDef('firstClass', 'first'); } if ($i == count($this->_docs) - $this->skippedDocs) { $this->renderTPL = $this->getCFGDef('tplLast', $this->renderTPL); $class[] = $this->getCFGDef('lastClass', 'last'); } if ($this->modx->documentIdentifier == $data['id']) { $this->renderTPL = $this->getCFGDef('tplCurrent', $this->renderTPL); $data[$this->getCFGDef("sysKey", "dl") . '.active'] = 1; //[+active+] - 1 if $modx->documentIdentifer equal ID this element $class[] = $this->getCFGDef('currentClass', 'current'); } else { $data[$this->getCFGDef("sysKey", "dl") . '.active'] = 0; } $class = implode(" ", $class); $data[$this->getCFGDef("sysKey", "dl") . '.class'] = $class; /** * @var $extE e_DL_Extender */ $extE = $this->getExtender('e', true, true); if ($out = $extE->init($this, compact('data'))) { if (is_array($out)) { $data = $out; } } return compact('class', 'iterationName'); }