<?php
/*
	欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/
if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}
 ?>
 
      <?php   
      //    <div class="fl col-md-4">  
       // $jumpvnodeadd ='../mod_node/mod_pop_nodeadd.php?lang='.LANG.'&act=add&catpid='.$catpid.'&catid='.$catid;
       // echo '<a class="needpopup" href="'.$jumpvnodeadd.'"><i class="fa fa-plus-circle"></i> 添加内容</a>';
        //  </div>
    ?>
    
    <?php
        $catname  = $title;
          if($catid=='') {
             $pidnamesub = '';   
             $catesubcur = '';          
          }
          else{
               $pidnamesub = $catid;
               $catesubcur = '<span class="cred">(当前选择分类：'.get_field(TABLE_CATE,'name',$catid,'pidname').')</span>'; 

          }

          ?>
 


 <div class="sidebartitle">
    <span>内容管理</span>
</div>

 
 <?php
 
 $stylev = $catid==$catpid?' style="background:red;color:#fff;padding:5px" ':'';
 $catname = '<a href="'.$jumpv.'" '.$stylev.'>'.$catname.'</a>';
 $addnodelink = 'mod_node_pop.php?lang='.LANG.'&file=addnode&catpid='.$catpid.'&catid='.$catpid;
 
 ?>

<div class="sidebarnew">

<div style="font-weight:bold;padding:10px 0">
 <?php echo $catname ?>
&nbsp;&nbsp; <a  style="color:#666" class="needpopup" href="<?php echo$addnodelink ?>">(添加)</a>
</div>
<?php 
 //---------------------
 $sqlsub = "SELECT * from ".TABLE_CATE." where  ppid='$catpid' $andlangbh order by pos desc,id";

 $rowlistsub = getall($sqlsub);
 if($rowlistsub=='no') {
  echo '<p>&nbsp;&nbsp;还没有分类，请添加...</p>';
  }
  else{

    
      $indexarr = indexingarr($rowlistsub);
      $getnewarr = getnewtreearr($indexarr);
      //pre($getnewarr);

        echo   echoarrhtml($getnewarr);
   
}
//-----------------

?>
</div>

 




<?php

function echoarrhtml($tree,$multicate='')
{
  global $jumpv;    global $pidnamesub;  global $catpid; 
$html = '';
foreach($tree as $vsub)
{
  
  $name =  $vsub['name']; 
  $tid=$vsub['id'];  $jsname = jsdelname($vsub['name']);
  $level=$vsub['level'];$last=$vsub['last']; 
  
  $pidname=$vsub['pidname']; 
  $langrelid= dmaddslashes($vsub['langrelid']); 

  $pidhere=$vsub['pid'];  $sta_visiblevv=$vsub['sta_visible']; 
  
  $alias_jump=$vsub['alias_jump'];         
  $aliascc = alias($pidname,'cate');  
  
 $classv = ($pidname == $pidnamesub )?'active':'';
 $classhidev = $sta_visiblevv<>'y'?' hidediv':'';

 $numnode = num_subnode(TABLE_NODE,'pid',$pidname);
$numnodev = ' <span class="cred">('.$numnode.')</span>';

$addnodelink2 = 'mod_node_pop.php?lang='.LANG.'&file=addnode&catpid='.$catpid.'&catid='.$pidname;
$addnodelink2t =  '&nbsp; &nbsp; <a style="color:#666" class="needpopup" href="'.$addnodelink2.'">(添加)</a>';

$name = '<a class="'.$classv.$classhidev.'" href="'.$jumpv.'&catid='.$pidname.'">'.$name.'</a>';
  $name = $sta_visiblevv<>'y'?$name.' &nbsp; &nbsp;[隐藏]':$name;
  $name = $name.$numnodev;
 
  if(@$vsub['son'] == '')
  {

    $langrelname =  langrel_show_inname(TABLE_CATE,'name',$langrelid,'');
   $html .= '<li>├  '.$name.$langrelname.$addnodelink2t.'</li>';  //span for js,avoid li
  }
  else
  {
    $langrelname =  langrel_show_inname(TABLE_CATE,'name',$langrelid,'');
   $html .= '<li>├  '.$name.$langrelname.$addnodelink2t;
   if(MULTICATE=='y' || $multicate=='')  $html .= echoarrhtml($vsub['son'],MULTICATE);
   $html = $html."</li>";
  }
}
 return $html ? '<ul class="tree">'.$html.'</ul>' : $html ;
 // return $html;
}




 









