Example #1
0
function module_cat_edit()
{
    global $global, $smarty;
    $list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = ' . $global['channel_id']);
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $list = $obj->set_cat_order($arr);
        for ($i = 0; $i < count($list); $i++) {
            $list[$i]['parent_name'] = get_data('cat_art', $list[$i]['cat_parent_id'], 'cat_name');
            $obj->set_where('');
            $obj->set_where('cat_parent_id = ' . $list[$i]['cat_id']);
            if ($obj->get_count() > 0) {
                $list[$i]['exist_child'] = 1;
            } else {
                $list[$i]['exist_child'] = 0;
            }
            $list[$i]['show'] = 1;
        }
    }
    $family = get_cat_family('cat_art', $global['id']);
    for ($i = 0; $i < count($family); $i++) {
        for ($j = 0; $j < count($list); $j++) {
            if ($family[$i] == $list[$j]['cat_id']) {
                $list[$j]['show'] = 0;
            }
        }
    }
    $smarty->assign('cat_list', $list);
    $obj = new cat_art();
    $obj->set_where('cat_id = ' . $global['id']);
    $one = $obj->get_one();
    $smarty->assign('cat', $one);
}
Example #2
0
function module_set()
{
    global $global, $smarty;
    $smarty->assign('data_username', get_varia('data_username'));
    $smarty->assign('data_password', get_varia('data_password'));
    $obj = new channel();
    $channel = $obj->get_list();
    $smarty->assign('channel', $channel);
    $obj = new varia();
    $obj->set_where("var_name = 'data_cat'");
    $list = $obj->get_list();
    if (count($list)) {
        for ($i = 0; $i < count($list); $i++) {
            $arr = explode('|', $list[$i]['var_value']);
            $cat_setting[$i]['varia_id'] = $list[$i]['var_id'];
            $cat_setting[$i]['server_id'] = $arr[0];
            $cat_setting[$i]['server_name'] = $arr[1];
            $cat_setting[$i]['channel_id'] = $arr[2];
            $cat_setting[$i]['cat_id'] = $arr[3];
        }
    } else {
        $cat_setting = array();
    }
    $smarty->assign('cat_setting', $cat_setting);
    $cat_list = array();
    for ($i = 0; $i < count($cat_setting); $i++) {
        $obj = new cat_art();
        $obj->set_where('cat_channel_id = ' . $cat_setting[$i]['channel_id']);
        $arr = $obj->get_list();
        if (count($arr) > 0) {
            $cat_list[$cat_setting[$i]['server_id']] = $obj->set_cat_order($arr);
        }
    }
    $smarty->assign('cat_list', $cat_list);
}
Example #3
0
function module_article_list()
{
    global $smarty;
    $obj = new cat_art();
    $obj->set_where('cat_best = 1');
    $best_cat = $obj->get_list();
    $art_list = array();
    if (count($best_cat) > 0) {
        $smarty->assign('show_all_art', 0);
        $list_len = get_varia('index_art_list_len');
        for ($i = 0; $i < count($best_cat); $i++) {
            $cat_id = $best_cat[$i]['cat_id'];
            $best_cat[$i]['channel'] = get_data('channel', $best_cat[$i]['cat_channel_id'], 'cha_code');
            $family = implode(',', get_cat_family('cat_art', $cat_id));
            $obj = new article();
            $obj->set_field('art_id,art_title,art_add_time');
            $obj->set_where("art_cat_id in ({$family})");
            $obj->set_page_size($list_len ? $list_len : 5);
            $list = $obj->get_list();
            for ($j = 0; $j < count($list); $j++) {
                $list[$j]['short_title'] = cut_str($list[$j]['art_title'], 22);
            }
            $art_list[$cat_id] = $list;
            unset($obj);
        }
        $smarty->assign('best_art_cat', $best_cat);
        $smarty->assign('art_list', $art_list);
    } else {
        $smarty->assign('show_all_art', 1);
    }
}
Example #4
0
function module_tailor_cat_add()
{
    global $global, $smarty;
    $obj = new channel();
    $channel = $obj->get_list();
    $smarty->assign('channel', $channel);
    $cat_list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = 1');
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $cat_list = $obj->set_cat_order($arr);
    }
    $smarty->assign('cat_list', $cat_list);
}
Example #5
0
function module_add()
{
    global $global, $smarty;
    $list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = ' . $global['channel_id']);
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $list = $obj->set_cat_order($arr);
    }
    $smarty->assign('cat_list', $list);
    $smarty->assign('editor_text', '');
    $smarty->assign('site_keywords', get_varia('site_keywords'));
    $smarty->assign('site_description', get_varia('site_description'));
    $smarty->assign('upl_date', date('Ymd'));
}
Example #6
0
function module_edit()
{
    global $global, $smarty;
    $obj = new article();
    $obj->set_where('art_id = ' . $global['id']);
    $one = $obj->get_one();
    $smarty->assign('article', $one);
    $smarty->assign('editor_text', $one['art_text']);
    $list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = ' . $global['channel_id']);
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $list = $obj->set_cat_order($arr);
    }
    $smarty->assign('cat_list', $list);
    $smarty->assign('upl_date', date('Ymd'));
}
Example #7
0
function module_cat_add()
{
    global $global, $smarty;
    $list = array();
    $obj = new cat_art();
    $obj->set_where('cat_channel_id = ' . $global['channel_id']);
    $arr = $obj->get_list();
    if (count($arr) > 0) {
        $list = $obj->set_cat_order($arr);
        for ($i = 0; $i < count($list); $i++) {
            $list[$i]['parent_name'] = get_data('cat_art', $list[$i]['cat_parent_id'], 'cat_name');
            $obj->set_where('');
            $obj->set_where('cat_parent_id = ' . $list[$i]['cat_id']);
            if ($obj->get_count() > 0) {
                $list[$i]['exist_child'] = 1;
            } else {
                $list[$i]['exist_child'] = 0;
            }
        }
    }
    $smarty->assign('cat_list', $list);
}
Example #8
0
function get_channel_cat()
{
    $val = post('val');
    if (is_numeric($val)) {
        $list = array();
        $obj = new cat_art();
        $obj->set_where('cat_channel_id = ' . $val);
        $arr = $obj->get_list();
        if (count($arr) > 0) {
            $list = $obj->set_cat_order($arr);
        }
        $str = '';
        for ($i = 0; $i < count($list); $i++) {
            $cat_id = $list[$i]['cat_id'];
            $cat_name = $list[$i]['cat_name'];
            $nbsp = '';
            for ($j = 1; $j < $list[$i]['grade']; $j++) {
                $nbsp .= '&nbsp;';
            }
            $str .= '<option value="' . $cat_id . '">' . $nbsp . $cat_name . '</option>';
        }
        echo $str;
    } else {
        echo '';
    }
}