<?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  = get_field(TABLE_CATE,'name',$ppid,'pidname');
        
$jumpv = 'mod_pop_catedesp.php?lang='.LANG.'&pidname='.$ppid.'&ppid='.$ppid;

          ?> 

 
 <?php
 
 $stylev = $pidname==$ppid?' style="background:red;color:#fff;padding:5px" ':'';
 $catname = '<a href="'.$jumpv.'" '.$stylev.'>'.$catname.'</a>';

 ?>

<div class="sidebarnew">

<div style="font-weight:bold;padding:10px 0">
 <?php echo $catname ?>

</div>
<?php 
 //---------------------
 $sqlsub = "SELECT * from ".TABLE_CATE." where  ppid='$ppid' $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 $pidname;  global $ppid; 
$html = '';
foreach($tree as $vsub)
{
  
  $name =  $vsub['name']; 
  $tid=$vsub['id'];  $jsname = jsdelname($vsub['name']);
  $level=$vsub['level'];$last=$vsub['last']; 
  
  $pidnamehere=$vsub['pidname']; 
  $pidhere=$vsub['pid'];  
  $langrelid=$vsub['langrelid'];  

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

 
 //$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>';
$addnodelink2t = '';
$jumpv = 'mod_pop_catedesp.php?lang='.LANG.'&pidname='.$pidnamehere.'&ppid='.$ppid;

$name = '<a class="'.$classv.$classhidev.'" href="'.$jumpv.'">'.$name.'</a>';
  $name = $sta_visiblevv<>'y'?$name.' &nbsp; &nbsp;[隐藏]':$name;
  $name = $name;
 
  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;
}




 









