function createData() { $this->supportCached(true); $module = getModuleBySection($this->section); $idcat = (int) $this->params['idcat']; $cpath = array(); if ($this->section == SECTION && A::$MAINFRAME->idcat > 0) { $catrow = A::$DB->getRowById(A::$MAINFRAME->idcat, "{$this->section}_categories"); $this->Assign("category", $catrow); $cpath[] = $catrow['id']; while ($catrow && $catrow['idker'] > 0) { $cpath[] = $catrow['idker']; $catrow = A::$DB->getRowById($catrow['idker'], "{$this->section}_categories"); } } $categories = array(); A::$DB->query("SELECT id,idker,name FROM {$this->section}_categories ORDER BY level,sort"); while ($row = A::$DB->fetchRow()) { $row['name'] = addcslashes($row['name'], "'"); $row['link'] = call_user_func($module . "_createCategoryLink", $row['id'], $this->section); $row['selected'] = $this->section == SECTION && in_array($row['id'], $cpath); $categories[] = $row; } A::$DB->free(); $this->Assign("categories", $categories); }
/** * Формирование данных доступных в шаблоне. */ function createData() { $this->supportCached(true); $module = getModuleBySection($this->section); $idcat = (int) $this->params['idcat']; $cpath = array(); if ($this->section == SECTION && A::$MAINFRAME->idcat > 0) { $catrow = A::$DB->getRowById(A::$MAINFRAME->idcat, "{$this->section}_categories"); if (isset($this->params['curcheck'])) { if (A::$DB->getCount("{$this->section}_categories", "idker=" . A::$MAINFRAME->idcat)) { $idcat = A::$MAINFRAME->idcat; } else { $idcat = $catrow['idker']; } } $this->Assign("category", $catrow); $cpath[] = $catrow['id']; while ($catrow && $catrow['idker'] > 0) { $cpath[] = $catrow['idker']; $catrow = A::$DB->getRowById($catrow['idker'], "{$this->section}_categories"); } } $levels = A::$DB->getOne("SELECT MAX(level) FROM {$this->section}_categories WHERE active='Y'"); $this->Assign("levels", $levels); if (!empty($this->params['rows'])) { A::$DB->queryLimit("SELECT * FROM {$this->section}_categories WHERE idker={$idcat} AND active='Y' ORDER BY sort", 0, (int) $this->params['rows']); } else { A::$DB->query("SELECT * FROM {$this->section}_categories WHERE idker={$idcat} AND active='Y' ORDER BY sort"); } $links = array(); while ($row = A::$DB->fetchRow()) { $row['link'] = call_user_func($module . "_createCategoryLink", $row['id'], $this->section); $row['selected'] = $this->section == SECTION && in_array($row['id'], $cpath); $row['sublinks'] = array(); A::$DB->query("SELECT * FROM {$this->section}_categories WHERE idker={$row['id']} AND active='Y' ORDER BY sort"); while ($subrow = A::$DB->fetchRow()) { $subrow['link'] = call_user_func($module . "_createCategoryLink", $subrow['id'], $this->section); $subrow['selected'] = $this->section == SECTION && in_array($subrow['id'], $cpath); $row['sublinks'][] = $subrow; } A::$DB->free(); $row['subcategories'] = $row['sublinks']; $links[] = $row; } A::$DB->free(); $this->Assign("links", $links); $this->Assign("categories", $links); }
/** * Обработчик действия: Переиндексация разделов в базу поиска. */ function indexAll() { @set_time_limit(0); A::$DB->caching = false; if (!empty($_REQUEST['sections'])) { foreach ($_REQUEST['sections'] as $id) { $section = getSectionById($id); $module = getModuleBySection($section); if (function_exists($module . '_searchIndexAll')) { A_SearchEngine::getInstance()->deleteSection($id); call_user_func($module . '_searchIndexAll', $section); } } } A::$CACHE->resetSection(SECTION); return true; }