Пример #1
0
function user_catalog_select($currentid = "0", $cid = "0", $level = 1, $args = NULL, $mid = '0')
{
    global $iCMS;
    $catalog = $iCMS->cache('catalog.array', 'include/syscache', 0, true);
    $args && parse_str($args, $T);
    if (isset($catalog[$cid])) {
        foreach ($catalog[$cid] as $root => $C) {
            if ($C['mid'] == $mid || $C['mid'] == "-1" || $mid == 'all') {
                if ($C['ishidden'] == "0" && $C['issend'] == "1") {
                    $t = $level == '1' ? "" : "├ ";
                    $c = $level == '1' ? "p3" : "p4";
                    $selected = $currentid == $C['id'] ? "selected='selected'" : "";
                    if (empty($C['url'])) {
                        if (empty($args)) {
                            $option .= "<option value='{$C['id']}' class='{$c}' {$selected}>" . str_repeat("│ ", $level - 1) . $t . $C['name'] . "[ID:{$C['id']}] </option>";
                        } else {
                            isset($T['page']) && $C['attr'] == 'page' && ($option .= "<option value='{$C['id']}' class='{$c}' {$selected}>" . str_repeat("│ ", $level - 1) . $t . $C['name'] . "[p:{$C['dir']}] </option>");
                            isset($T['index']) && $C['attr'] == 'index' && ($option .= "<option value='{$C['id']}' class='{$c}' {$selected}>" . str_repeat("│ ", $level - 1) . $t . $C['name'] . "[ID:{$C['id']}] </option>");
                            if (isset($T['channel']) && $C['attr'] == 'channel') {
                                if ($T['channel']) {
                                    $option .= "<optgroup label=\"{$C['name']}\"></optgroup>";
                                } else {
                                    $option .= "<option value='{$C['id']}' class='{$c}' {$selected}>" . str_repeat("│ ", $level - 1) . $t . $C['name'] . "[ID:{$C['id']}] </option>";
                                }
                            }
                            isset($T['list']) && $C['attr'] == 'list' && ($option .= "<option value='{$C['id']}' class='{$c}' {$selected}>" . str_repeat("│ ", $level - 1) . $t . $C['name'] . "[ID:{$C['id']}]</option>");
                        }
                        $option .= user_catalog_select($currentid, $C['id'], $level + 1, $args);
                    }
                } else {
                    $option .= user_catalog_select($currentid, $C['id'], $level + 1, $args);
                }
            }
        }
    }
    return $option;
}
Пример #2
0
 * @package iCMS V3.1
 * @copyright 2007-2009, iDreamSoft
 * @license http://www.idreamsoft.cn iDreamSoft
 * @author coolmoo <*****@*****.**>
 */
!defined('iPATH') && exit('What are you doing?');
include iPATH . 'include/catalog.class.php';
switch ($operation) {
    case 'add':
        $catalog = new catalog();
        $id = (int) $_GET['id'];
        $rs = array();
        $id && ($rs = $iCMS->db->getRow("SELECT a.*,ad.tpl,ad.body,ad.subtitle FROM `#iCMS@__article` a LEFT JOIN `#iCMS@__articledata` ad ON a.id=ad.aid WHERE a.id='{$id}' and a.userid='{$member->uId}'", ARRAY_A));
        $rs['pubdate'] = empty($id) ? get_date('', "Y-m-d H:i:s") : get_date($rs['pubdate'], 'Y-m-d H:i:s');
        $rootid = empty($rs['cid']) ? intval($_GET['cid']) : $rs['cid'];
        $cata_option = user_catalog_select($rootid, 0, 1, 'channel=1&list');
        empty($rs['editor']) && ($rs['editor'] = empty($member->admin->name) ? $member->admin->username : $member->admin->name);
        empty($rs['userid']) && ($rs['userid'] = $member->uId);
        include iCMS_usercp_tpl("article.add");
        break;
    case 'del':
        $id = intval($_GET['id']);
        !$id && alert("请选择要删除的文章");
        delArticle($id, $member->uId, 0) && alert('成功删除!', "url:1");
        break;
    case 'manage':
        $catalog = new catalog();
        $cid = (int) $_GET['cid'];
        $sql = " where 1=1";
        $cid && ($sql .= " AND `cid` ='{$cid}'");
        //	$sql.=$_GET['type']=='draft'?"`visible` ='0'":"`visible` ='1'";