Пример #1
0
function html_cate_list($tree = array(), $i = 0, $state = 0)
{
    global $c, $template;
    $i++;
    foreach ($tree as $k => $t) {
        //验证权限
        if (!check_admin_level($t['cate_id'])) {
            continue;
        }
        $flag = '';
        for ($j = 1; $j < $i; $j++) {
            $flag .= '';
        }
        $is_set = 0;
        // 分类类型
        $style = '';
        $_GET['cate_id'] = isset($_GET['cate_id']) ? $_GET['cate_id'] : '';
        if ($t['cate_id'] == $_GET['cate_id']) {
            $style = 'style="color:red;"';
        }
        $ctype = '<font color=red>目录分类</font>';
        if ($c->cate_last($t['cate_id']) == 0) {
            $ctype = '<font color=#888>终极分类</font>';
            $is_set = 1;
        }
        if ($c->cate_last($t['cate_id']) == 0 && $t['cdata'] > 0) {
            $ctype = '<font color=green>文档分类</font>';
            $is_set = 1;
        }
        // 前缀图标
        if (count($t['son']) > 0) {
            $onclick = ' onclick="show_hidden(' . $t['cate_id'] . ',this)" style="cursor:pointer;" title="点击展开子分类"';
            $flag .= '<img src="' . $template . '/css/img/folder.gif"' . $onclick . '> ';
        } else {
            $onclick = '';
            if ($ctype == '<font color=#888>终极分类</font>') {
                $flag .= '<img src="' . $template . '/css/img/file.gif"> ';
                $is_set = 1;
            } else {
                $flag .= '<img src="' . $template . '/css/img/file.gif"> ';
            }
        }
        echo '<table class="tb tbcate" style="background:#fff;font-size:10px;"><tr>';
        echo '<td class="col4"><div style="float:left"><a name="cate_' . $t['cate_id'] . '" id="cate_' . $t['cate_id'] . '"></a>' . $flag . '<b style="color:#666;"><a      ' . $style . ' onclick="window.parent.location.href=\'info.php?state=' . $state . '&cate_id=' . $t['cate_id'] . '&is_set=' . $is_set . '\'" href="javascript:void(0);">' . $t['cname'] . '</a></b> ' . ' ' . '</div></td>';
        //echo('<td class="col8">');
        echo '</tr></table>' . chr(10);
        if (is_array($t['son']) && count($t['son']) > 0) {
            echo chr(10) . '<div id="tbody_' . $t['cate_id'] . '" style="display:block;">' . chr(10);
            html_cate_list($t['son'], $i);
            echo chr(10) . '</div>' . chr(10);
        }
    }
}
Пример #2
0
            continue;
        }
        if (check_admin_level($son['level']) || check_group_level($son['level'])) {
            echo '<a href="' . SITE_PATH . ADMIN_PATH . '/' . $son['url'] . '" class="menu_1' . $selected . '" style="background:url(' . SITE_PATH . ADMIN_PATH . '/' . $template . "/" . $a['bgimg'] . ') 12px 4px no-repeat;">' . $a['title'] . '</a>';
            break;
        }
    }
    if ($selected == 'selected') {
        if ($a['title'] == '模型管理') {
            foreach ($c->externs as $ext) {
                if ($ext['extern_type'] == 1) {
                    array_push($a['sonmenu'], array('title' => $ext['extern_title'], 'url' => 'extern_list.php?extern_id=' . $ext['extern_id']));
                }
            }
        }
        foreach ($a['sonmenu'] as $b) {
            //验证权限
            if (!check_admin_level($b['level']) && !check_group_level($b['level'])) {
                continue;
            }
            $selected = isset($b['selected']) ? 'selected' : '';
            $target = $b['title'] == '我的账号' ? ' target="_blank"' : '';
            echo '<a href="' . SITE_PATH . ADMIN_PATH . '/' . $b['url'] . '" class="menu_2' . $selected . '"' . $target . '>' . $b['title'] . '</a>';
        }
    }
    echo '</li>';
}
echo '</ul>';
?>
    
</div><!-- 左侧菜单结束 -->
Пример #3
0
function show_button($params)
{
    //处理参数
    if (!isset($params['href'])) {
        $params['href'] = "javascript:void(0)";
    }
    if (!isset($params['class'])) {
        $params['class'] = "but2";
    }
    if (!isset($params['onclick'])) {
        $params['onclick'] = "";
    }
    if (!isset($params['text'])) {
        $params['text'] = "显示名字";
    }
    if (!isset($params['level'])) {
        $params['level'] = "";
    }
    if (!isset($params['other'])) {
        $params['other'] = "";
    }
    //判断权限 有权限才输出功能按钮
    //先判断组权限
    if (!check_g_level($params['level'])) {
        //判断用户权限
        if (!check_admin_level($params['level'])) {
            return;
        }
    }
    return '<a href="' . $params['href'] . '" class="' . $params['class'] . '" onclick="' . $params['onclick'] . '"   ' . $params['other'] . '>' . $params['text'] . '</a>';
}
Пример #4
0
 /**
  * 根据分类ID输出select下拉框
  *
  * @param  $cate_id
  * @param  $disabled = ' disabled="disabled" '
  * @param  $styles =' style="background:pink;margin-top:1px;"'
  */
 public function html_cate_select($tree = array(), $i = 0, $disabled = ' disabled="disabled" ', $styles = ' style="background:pink;margin-top:1px;"')
 {
     $i++;
     foreach ($tree as $t) {
         //if ($t['go_url'] != '') continue;
         // 验证权限
         if (!check_admin_level($t['cate_id'])) {
             continue;
         }
         $flag = '';
         for ($j = 1; $j < $i; $j++) {
             $flag .= ' ';
         }
         if (count($t['son']) > 0) {
             $flag .= '┗';
         } else {
             $flag .= '┗';
         }
         $readonly = '';
         $style = '';
         if (count($t['son']) > 0) {
             $readonly = $disabled;
         }
         if (count($t['son']) == 0) {
             $style = $styles;
         }
         echo '<option value="' . $t['cate_id'] . '"' . $readonly . $style . '>' . $flag . $t['cname'] . '(' . $t['cdata'] . ')</option>';
         $this->html_cate_select($t['son'], $i, $disabled, $styles);
     }
 }
Пример #5
0
function m__list()
{
    global $dbm, $c, $infos;
    $_GET = helper::sqlxss($_GET);
    $state = isset($_GET['state']) ? intval($_GET['state']) : '0';
    $params = array("resource" => 1, "count" => 1, "p" => $_GET['p'], "where" => " 1=1 ", "pagesize" => PAGESIZE, "extern" => "1");
    if (isset($_GET['cate_id']) && is_numeric($_GET['cate_id'])) {
        $params['cate_id'] = $_GET['cate_id'];
        //判断分类
        //验证分类权限
        if (!check_admin_level($params['cate_id'])) {
            unset($params['cate_id']);
        }
    }
    //分类限制
    $cate_level = array();
    foreach ($c->categories() as $cval) {
        //验证分类权限
        /*if(!check_admin_level($cval['cate_id'])){
              $params['where'] .=" and last_cate_id != ".$cval['cate_id'];
          }*/
        if (check_admin_level($cval['cate_id'])) {
            array_push($cate_level, $cval['cate_id']);
        }
    }
    if (count($cate_level) > 0) {
        $params['where'] .= " and last_cate_id in (" . implode(',', $cate_level) . ")";
    }
    //如果不是超级管理员,只能看到自己的
    if ($_SESSION['admin']['group_level'] != '100') {
        $params['where'] .= ' and (uid = ' . $_SESSION['admin']['admin_id'];
        //看自己发布的
        $params['where'] .= " or is_admin=0 or uid=1)";
        //和非管理员发布文档
    }
    if (isset($_GET['search_type']) && $_GET['search_type'] == 'info_id') {
        //匹配ID
        if (isset($_GET['search_txt']) && $_GET['search_txt'] != '') {
            $params['where'] .= " and info_id='{$_GET['search_txt']}'";
        }
    } else {
        //匹配标题
        if (isset($_GET['search_txt']) && $_GET['search_txt'] != '') {
            $params['where'] .= " and info_title like '%{$_GET['search_txt']}%'";
        }
    }
    //文档类型
    $params['state'] = $state;
    if (isset($_GET['order']) && $_GET['order'] == 'create_time') {
        $params['order'] = " order by {$_GET['order']} desc";
        //置顶排序
    } else {
        $params['order'] = " order by publish_time desc";
        //发布时间排序
    }
    $params['state'] = $state;
    $params['no_cache'] = 1;
    $params['show_recommend'] = 1;
    $infos = $c->get_list($params);
    //print_r($params);
    //echo $infos['sql'];
}
Пример #6
0
function html_cate_list($tree = array(), $i = 0)
{
    global $c, $template;
    $i++;
    $tree_ids = explode(',', isset($_COOKIE['tree_ids']) ? $_COOKIE['tree_ids'] : '');
    foreach ($tree as $k => $t) {
        //验证权限
        if (!check_admin_level($t['cate_id'])) {
            continue;
        }
        $flag = '';
        for ($j = 1; $j < $i; $j++) {
            $flag .= '  ';
        }
        // 分类类型
        $ctype = '<font color=red>目录分类</font>';
        if ($c->cate_last($t['cate_id']) == 0) {
            $ctype = '<font color=#888>终极分类</font>';
        }
        if ($c->cate_last($t['cate_id']) == 0 && $t['cdata'] > 0) {
            $ctype = '<font color=green>文档分类</font>';
        }
        // 前缀图标
        if (count($t['son']) > 0) {
            $onclick = ' onclick="show_hidden(' . $t['cate_id'] . ',this)" style="cursor:pointer;" title="点击展开子分类"';
            $flag .= '<img src="' . $template . '/css/img/folder.png"' . $onclick . ' width="16"> ';
        } else {
            $onclick = '';
            if ($ctype == '<font color=#888>终极分类</font>') {
                $flag .= '<img src="' . $template . '/css/img/file.png" width="16"> ';
            } else {
                $flag .= '<img src="' . $template . '/css/img/www_link.png" width="16"> ';
            }
        }
        echo '<table class="tb tbcate"><tr>';
        echo '<td class="col1"><input class="corder ipt" pid="' . $t['cate_id'] . '" type="text" style="width:40px;" value="' . $t['corder'] . '"></td>';
        echo '<td class="col2">' . $t['cate_id'] . '</td>';
        echo '<td class="col3">' . $c->externs[$t['extern_id']]['extern_title'] . '</td>';
        echo '<td class="col4"><div style="float:left">' . $flag . '<b style="color:#666;"><a href="info.php?state=0&cate_id=' . $t['cate_id'] . '">' . $t['cname'] . '</a></b> ' . $ctype . ' ' . ($t['nav_show'] == 1 ? '导航显示' : '') . ' <font color=#ccc>' . ($t['go_url'] == '' ? $t['cname_py'] : ' ' . $t['go_url'] . ' ') . '</font> <font color=deeppink>' . (count($t['son']) > 0 ? count($t['son']) : '') . '</font></div></td>';
        echo '<td class="col41" style="text-align:left">' . ($t['tpl_index'] == '' ? '' : '封面:' . $t['tpl_index'] . '<br>') . ($t['tpl_listvar'] == '' ? '' : '列表:' . $t['tpl_listvar'] . '<br>') . ($t['tpl_content'] == '' ? '' : '内容:' . $t['tpl_content']) . '</td>';
        echo '<td class="col7">' . $t['cdata'] . '</td>';
        echo '<td class="col8">';
        if ($c->cate_last($t['cate_id']) == 1 && $c->categories[$t['cate_id']]['cdata'] > 0) {
            echo show_button(array('class' => 'but2 but2s', 'onclick' => 'javascript:void(0);', 'other' => 'style="background:#ccc;border-color:#ccc;color:#888;cursor:default;"', 'text' => '移动', 'level' => 'C0405'));
        } else {
            echo show_button(array('class' => 'but2 but2s', 'onclick' => "cate_move_show('{$t['cate_id']}','{$t['cname']}');", 'text' => '移动', 'level' => 'C0405'));
        }
        if ($t['cdata'] == 0) {
            echo show_button(array('class' => 'but2 but2s but2r', 'onclick' => "cate_del('{$t['cate_id']}');", 'text' => '删除', 'level' => 'C0402'));
        } else {
            echo show_button(array('class' => 'but2 but2s', 'onclick' => "javascript:void(0);", 'text' => '删除', 'level' => 'C0402', 'other' => 'style="background:#ccc;border-color:#ccc;color:#888;cursor:default;"'));
        }
        echo show_button(array('class' => 'but2 but2s', 'onclick' => "cate_show('{$t['cate_id']}','{$t['parent_id']}','{$t['extern_id']}');", 'text' => '修改', 'level' => 'C0401'));
        if ($t['cdata'] == 0 || $c->cate_last($t['cate_id']) == 1) {
            echo show_button(array('class' => 'but2 but2s but2o', 'onclick' => "cate_show(0,'{$t['cate_id']}','{$t['extern_id']}');", 'text' => '添加子类', 'level' => 'C0401'));
        } else {
            echo show_button(array('class' => 'but2 but2s', 'onclick' => "javascript:void(0);", 'text' => '添加子类', 'level' => 'C0401', 'other' => 'style="background:#ccc;border-color:#ccc;color:#888;cursor:default;"'));
        }
        echo '</td>';
        echo '</tr></table>' . chr(10);
        $dis_show = 'none';
        foreach ($tree_ids as $tree_id) {
            if ($tree_id == $t['cate_id']) {
                $dis_show = '';
            }
        }
        if (is_array($t['son']) && count($t['son']) > 0) {
            echo chr(10) . '<div id="tbody_' . $t['cate_id'] . '" style="display:' . $dis_show . ';">' . chr(10);
            html_cate_list($t['son'], $i);
            echo chr(10) . '</div>' . chr(10);
        }
    }
}