예제 #1
0
<?php

defined('IN_DESTOON') or exit('Access Denied');
$category_title = convert($category_title, 'UTF-8', DT_CHARSET);
$category_extend = isset($category_extend) ? stripslashes($category_extend) : '';
$category_moduleid = isset($category_moduleid) ? intval($category_moduleid) : 1;
if (!$category_moduleid) {
    exit;
}
$category_deep = isset($category_deep) ? intval($category_deep) : 0;
$cat_id = isset($cat_id) ? intval($cat_id) : 1;
$_child = array();
if ($_groupid == 1 && $_admin == 2) {
    $R = cache_read('right-' . $_userid . '.php');
    if (isset($R[$category_moduleid]['index']['catid'])) {
        $_catids = $R[$category_moduleid]['index']['catid'];
        if ($_catids && is_array($_catids)) {
            $_childs = '';
            $result = $db->query("SELECT arrchildid FROM {$DT_PRE}category WHERE catid IN (" . implode(',', $_catids) . ")");
            while ($r = $db->fetch_array($result)) {
                $_childs .= ',' . $r['arrchildid'];
            }
            if ($_childs) {
                $_childs = substr($_childs, 1);
                $_child = explode(',', $_childs);
            }
        }
    }
}
echo get_category_select($category_title, $catid, $category_moduleid, $category_extend, $category_deep, $cat_id);
예제 #2
0
function ajax_category_select($name = 'catid', $title = '', $catid = 0, $moduleid = 1, $extend = '', $deep = 0)
{
    global $cat_id;
    if ($cat_id) {
        $cat_id++;
    } else {
        $cat_id = 1;
    }
    $catid = intval($catid);
    $deep = intval($deep);
    $select = '';
    $select .= '<input name="' . $name . '" id="catid_' . $cat_id . '" type="hidden" value="' . $catid . '"/>';
    $select .= '<span id="load_category_' . $cat_id . '">' . get_category_select($title, $catid, $moduleid, $extend, $deep, $cat_id) . '</span>';
    $select .= '<script type="text/javascript">';
    if ($cat_id == 1) {
        $select .= 'var category_moduleid = new Array;';
    }
    $select .= 'category_moduleid[' . $cat_id . ']="' . $moduleid . '";';
    if ($cat_id == 1) {
        $select .= 'var category_title = new Array;';
    }
    $select .= 'category_title[' . $cat_id . ']=\'' . $title . '\';';
    if ($cat_id == 1) {
        $select .= 'var category_extend = new Array;';
    }
    $select .= 'category_extend[' . $cat_id . ']=\'' . $extend . '\';';
    if ($cat_id == 1) {
        $select .= 'var category_catid = new Array;';
    }
    $select .= 'category_catid[' . $cat_id . ']=\'' . $catid . '\';';
    if ($cat_id == 1) {
        $select .= 'var category_deep = new Array;';
    }
    $select .= 'category_deep[' . $cat_id . ']=\'' . $deep . '\';';
    $select .= '</script>';
    if ($cat_id == 1) {
        $select .= '<script type="text/javascript" src="' . DT_STATIC . 'file/script/category.js"></script>';
    }
    return $select;
}