function getTree($module = '') { $items = array(); $sql = 'SELECT * FROM {{tree}} WHERE id=' . Funcs::$uri[2] . ''; $data = DB::getRow($sql); $sql = 'SELECT modul2 FROM {{relations}} WHERE modul1=\'tree\' AND id1=' . Funcs::$uri[2] . ' AND id2=0'; $path = DB::getOne($sql); if ($path) { $sql = 'SELECT * FROM {{modules}} WHERE path=\'' . $path . '\''; $moduleraz = DB::getRow($sql); } $sql = 'SELECT modul2 FROM {{relations}} WHERE modul1=\'tree\' AND id1=' . Funcs::$uri[2] . ' AND id2=1'; $path = DB::getOne($sql); $sql = 'SELECT * FROM {{modules}} WHERE path=\'' . $path . '\''; $module = DB::getRow($sql); if (!$moduleraz) { $moduleraz = $module; } $data['module'] = $module; $data['moduleraz'] = $moduleraz; $data['list'] = array(); $order = 'num'; if (trim($_GET['sort']) != '') { $order = $_GET['sort'] . ' ' . (isset($_GET['desc']) ? 'DESC' : ''); } if (strpos($data['moduleraz']['path'], 'struct_') !== false && is_numeric($_GET['ve'])) { $sql = ' SELECT {{tree}}.* FROM {{tree}} LEFT JOIN {{catalog}} ON {{tree}}.id={{catalog}}.tree WHERE {{tree}}.parent=' . Funcs::$uri[2] . ' AND {{catalog}}.vendor=' . $_GET['ve'] . ' ORDER BY {{tree}}' . $order . ' '; } else { $sql = 'SELECT * FROM {{tree}} WHERE parent=' . Funcs::$uri[2] . ' ORDER BY ' . $order . ''; } $items = DB::getPagi($sql); $fields = Fields::getOutFieldsByTree(1); foreach ($items as $item) { $sql = 'SELECT modul2 FROM {{relations}} WHERE modul1=\'tree\' AND id1=' . $item['id'] . ' AND id2=1'; $path = DB::getOne($sql); $sql = 'SELECT * FROM {{modules}} WHERE path=\'' . $path . '\''; $module = DB::getRow($sql); $item['udate'] = date('d.m.Y H:i:s', strtotime($item['udate'])); $item['module'] = array('id' => $module['id'], 'name' => $module['name'], 'path' => $module['path'], 'type' => $module['type']); foreach ($fields as $field) { $text = OutFieldWidget::run($item['id'], $field, $data['module']); if ($field['type'] == 'editor') { if (strlen(strip_tags($text)) > 50) { $text = substr(strip_tags($text), 0, strpos(strip_tags($text), ' ', 50)) . '...'; } else { $text = strip_tags($text); } } $item['fields'][$field['path']] = $text; } $data['list'][] = $item; } return $data; }
</div> </div> </div> <section class="popup popup_sections-settings jsSectionsSettingsPopup"> <div class="ltContainer ltFullWidth"> <div class="ltRow"> <header class="popup_sections-settings_header"> <span class="button_select-all jsSelectAll">Выбрать все</span> <span class="button_clear-all jsClearAll">Очистить</span> </header> </div> <div class="ltRow jsScrollContainer"> <div class="jsScrollWrapper"> <div class="jsScroll beigeOverflow"> <ul class="popup_sections-settings_list"> <?php foreach (Fields::getOutFieldsByTree() as $key => $item) { ?> <li class="popup_sections-settings_option"> <label class="form_label selectColumn"> <input type="checkbox" class="selectColumnCheckbox <?php if ($key === 'tree_name') { ?> selectColumnCheckboxName<?php } ?> " value="<?php echo $item['path']; ?> " <?php if (in_array($item['path'], Funcs::getUserOptions())) { ?>