/** * Единые обработки массива с данными о документе для всех контроллеров * * @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'); }