/** * Пересортировка всего дерева * * @param <type> $id * @param <type> $cnt * @param <type> $level * @return <type> */ function resort($id = 0, $cnt = 0, $level = 0) { set_time_limit(0); if ($id > 0) { CI()->db->query("UPDATE pages SET " . " rt = " . IntVal($cnt) . ", " . " lt = " . IntVal($cnt) . " " . "WHERE id=" . IntVal($id), FALSE); } $strSql = "SELECT id FROM pages WHERE pid = " . IntVal($id) . " ORDER BY 'ord'"; $cnt++; $res = CI()->db->query($strSql, FALSE); foreach ($res->result_array() as $arr) { $cnt = resort($arr["id"], $cnt, $level + 1); } if ($id == 0) { return true; } CI()->db->query("UPDATE pages SET " . " rt = " . IntVal($cnt) . ", " . " lvl = " . IntVal($level) . " " . "WHERE id=" . IntVal($id), FALSE); return $cnt + 1; }
$value['upid'] = "do{$value['doid']}"; } $tree->setNode($value['id'], $value['upid'], $value); } } foreach ($newdoids as $cdoid) { $values = $tree->getChilds("do{$cdoid}"); foreach ($values as $key => $id) { $one = $tree->getValue($id); $one['layer'] = $tree->getLayer($id) * 2 - 2; $one['style'] = "padding-left:{$one['layer']}em;"; if ($_GET['highlight'] && $one['id'] == $_GET['highlight']) { $one['style'] .= 'color:red;font-weight:bold;'; } $clist[$cdoid][] = $one; } } $dolist = resort($itemids, $dolist); $_TPL['css'] = 'doing'; realname_get(); include_once template("space_search_complain"); } } } } } } } } } }