예제 #1
0
function articlecat_list($parent_id = 0, $level = 0)
{
    global $db, $prefix;
    $cat_list = array();
    $rows = $db->get_all("SELECT * FROM {$prefix}article_cat WHERE parent_id = ? ORDER BY sort_order", array($parent_id));
    foreach ($rows as $row) {
        $row['level'] = $level;
        $cat_list[] = $row;
        $cat_list = array_merge($cat_list, articlecat_list($row['cat_id'], $level + 1));
    }
    return $cat_list;
}
예제 #2
0
        $db->exec("DELETE FROM {$table} WHERE cat_id = ?", array($cat_id));
        echo "<script>alert('删除成功!'); window.location = '?act=list';</script>";
        break;
    case 'update_order':
        $id = intval($id);
        $val = intval($val);
        $db->update($table, array('sort_order' => $val), array('cat_id' => $id));
        $res = array('error' => 0, 'message' => '', 'content' => $val);
        exit(json_encode($res));
        break;
    case 'toggle_show_in_nav':
        $id = intval($id);
        $val = intval($val);
        $db->update($table, array('show_in_nav' => $val), array('cat_id' => $id));
        $res = array('error' => 0, 'message' => '', 'content' => $val);
        exit(json_encode($res));
        break;
    case 'toggle_is_show':
        $id = intval($id);
        $val = intval($val);
        $db->update($table, array('is_show' => $val), array('cat_id' => $id));
        $res = array('error' => 0, 'message' => '', 'content' => $val);
        exit(json_encode($res));
        break;
    case 'list':
        $ur_here = '网址分类';
        $action_link['href'] = '?act=add';
        $action_link['text'] = '添加分类';
        $cat_list = articlecat_list();
        include_once 'articlecat_list.php';
}