$block['row'] = array(); if ($param['option']['nocount']) { $row = array('title' => 'Не указано', 'filter' => $param['nofilter']); $row['checked'] = !!$mymd['no']; if ($row['checked']) { $row['add'] = $add . $paramid . '.no:'; } else { $row['add'] = $add . $paramid . '.no:1'; } $block['row'][] = $row; } if ($block['type'] == 'string') { foreach ($param['option']['values'] as $value) { $row = array('title' => $value['title'], 'filter' => $value['filter']); $row['checked'] = !!$mymd[$value['id']]; $valueid = infra_seq_short(array(Catalog::urlencode($value['id']))); if ($row['checked']) { $row['add'] = $add . $paramid . '.' . $valueid . ':'; } else { $row['add'] = $add . $paramid . '.' . $valueid . ':1'; } $block['row'][] = $row; } } if ($conf['catalog']['filteroneitem'] || sizeof($block['row']) > 1) { $ans['template'][] = $block; } } return $ans; }, $args, isset($_GET['re'])); $ans = array_merge($ans, $res);
$ans['breadcrumbs'][] = array('href' => '', 'title' => $group['name'], 'add' => 'group::group.' . $p . ':1'); }, $group['path']); if (sizeof($ans['breadcrumbs']) == 1) { array_unshift($ans['breadcrumbs'], array('main' => true, "title" => "Главная", "nomark" => true)); } $ans['name'] = $group['name']; //имя группы длинное $ans['descr'] = @$group['descr']['Описание группы']; $ans['title'] = $group['title']; } } Catalog::sort($ans['list'], $md); //Numbers $pages = ceil(sizeof($ans['list']) / $md['count']); if ($pages < $page) { $page = $pages; } $ans['numbers'] = Catalog::numbers($page, $pages, 11); $ans['list'] = array_slice($ans['list'], ($page - 1) * $md['count'], $md['count']); //Text $ans['text'] = infra_loadTEXT('*files/get.php?' . $conf['catalog']['dir'] . 'articals/' . $ans['title']); //Изменение текста не отражается как изменение каталога, должно быть вне кэша foreach ($ans['list'] as $k => $pos) { $pos = Catalog::getPos($pos); unset($pos['texts']); unset($pos['files']); $ans['list'][$k] = $pos; } return $ans; }, $args, $re); return infra_ret($ans);
$fd = Catalog::initMark($ans); if (isset($_GET['lim'])) { $lim = $_GET['lim']; } else { $lim = '0,20'; } $p = explode(',', $lim); if (sizeof($p) != 2) { return infra_err($ans, 'Is wrong paramter lim'); } $start = (int) $p[0]; $count = (int) $p[1]; $args = array($start, $count); $list = Catalog::cache('producers.php', function ($start, $count) { $ans = array(); $conf = infra_config(); $data = Catalog::init(); $prods = array(); Xlsx::runPoss($data, function (&$pos) use(&$prods) { @$prods[$pos['Производитель']]++; }); arsort($prods, SORT_NUMERIC); $prods = array_slice($prods, $start, $count); return $prods; }, $args, isset($_GET['re'])); $ans['menu'] = infra_loadJSON('*catalog/menu.json'); $ans['list'] = $list; $conf = infra_config(); $ans['breadcrumbs'][] = array('href' => '', 'title' => $conf['catalog']['title'], 'add' => 'group'); $ans['breadcrumbs'][] = array('href' => 'producers', 'title' => 'Производители'); return infra_ret($ans);
<?php namespace itlife\catalog; use itlife\files\Xlsx; $ans = array(); $fd = Catalog::initMark($ans); //На главной странице каталога показываются $data = infra_loadJSON('*catalog/search.php?m=' . $ans['m']); $ans['childs'] = $data['childs']; return infra_ret($ans);
public static function search($md, &$ans = array()) { $args = array(Catalog::nocache($md)); $res = Catalog::cache('search.php filter list', function ($md) { $conf = infra_config(); $ans['list'] = Catalog::getPoss($md['group']); //ЭТАП filters list $ans['filters'] = Catalog::filtering($ans['list'], $md); foreach ($md['group'] as $now => $one) { break; } $ans['childs'] = Catalog::getGroups($ans['list'], $now); $ans['count'] = sizeof($ans['list']); return $ans; }, $args, isset($_GET['re'])); $ans = array_merge($ans, $res); return $ans; }