示例#1
0
function getJG($id = 0, $reid = 0, $tt = "", $select = "", $channel = '')
{
    $jg = M("Arctype");
    if ($reid == 0 && $id == 0) {
        if ($channel) {
            $channel = ' and channeltype=' . $channel;
        }
        $list = $jg->where("topid=0" . $channel)->field("id,reid,typename")->select();
        foreach ($list as $value) {
            $tmp = getJG(0, $value['id'], '  ─', $select, $where);
            $tmp1 = '';
            if ($select == $value['id']) {
                $tmp1 = 'selected';
            }
            $arr .= "<option value='{$value['id']}' {$tmp1}>{$value['typename']}</option>" . $tmp;
        }
    } elseif ($id > 0 && $reid == 0) {
        if ($channel) {
            $channel = ' and channeltype=' . $channel;
        }
        $vo = $jg->where("id={$id}" . $channel)->field("id,reid,typename")->find();
        $tmp = getJG(0, $vo['id'], '&nbsp;&nbsp;─', $select, $channel);
        $tmp1 = '';
        if ($select == $vo['id']) {
            $tmp1 = 'selected';
        }
        $arr .= "<option value='{$vo['id']}' {$tmp1}>{$vo['typename']}</option>" . $tmp;
    } else {
        if ($channel) {
            $channel = ' and channeltype=' . $channel;
        }
        $list = $jg->where("reid=" . $reid . $channel)->field("id,reid,typename")->select();
        foreach ($list as $value) {
            $tmp = getJG(0, $value['id'], '&nbsp;&nbsp;' . $tt . '─', $select, $channel);
            $tmp1 = '';
            if ($select == $value['id']) {
                $tmp1 = 'selected';
            }
            $arr .= "<option value='{$value['id']}' {$tmp1}>{$tt}{$value['typename']}</option>" . $tmp;
        }
    }
    return $arr;
}
" >
                  <input type="hidden" name="aid" value="<?php 
echo $vo["id"];
?>
" >
                  <input type="hidden" name="channel" value="<?php 
echo $vo["channel"];
?>
" >
                  <div class="box-body">

                    <div class="form-group">
                      <label>文档主栏目</label>
                      <select name="typeid" class="form-control required number">
                      <?php 
echo getJG(0, 0, "", $vo['typeid'], $vo['channel']);
?>
                      </select>
                    </div>
                    <div class="form-group">
                      <label>标题</label>
                      <input type="text" name="title"  class="form-control required"  value="<?php 
echo $vo["title"];
?>
">
                    </div>

                   
                    <div class="form-group">
                      <label>缩略图</label>
                      <div class="input-group">
                </div><!-- /.box-header -->
                <!-- form start -->
                <form role="form" method="post" id="form1" action="<?php 
echo U("Type/article_insert");
?>
" class="pageForm required-validate">
                  <input type="hidden" name="channel" value="<?php 
echo $_GET['channel'];
?>
">
                  <div class="box-body">
                    <div class="form-group">
                      <label>文档主栏目</label>
                      <select name="typeid" class="form-control required number">
                      <?php 
echo getJG(0, 0, "", $_GET['typeid'], $_GET['channel']);
?>
                      </select>
                    </div>
                    <div class="form-group">
                      <label>标题</label>
                      <input type="text" name="title"  class="form-control required"  value="<?php 
echo $vo["title"];
?>
">
                    </div>

                   
                    <div class="form-group">
                      <label>缩略图</label>
                      <div class="input-group">