<?php
/*
	power by JASON.ZHANG  DM建站  www.demososo.com
*/
if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}

 
?>
 <div class="contenttop">
  <a   href="<?php echo $jumpv?>&file=add&act=add"><i class="fa fa-plus-circle"></i> 添加子分类 </a>
</div>

<?php 
    $arr = getarr_cate2010($catid);
    //pre($arr);
    if($arr['datares']=='yes') {
      ?>
<form method=post action="<?php echo $jumpv;?>&act=subpos">


<table class="formtab formtabhovertr" style="width:100%">
  <tbody><tr style="font-weight:bold;" class="">
  <td align="center">排序号</td>
    <td>分类名称</td>
    <td>标识</td>
    <td align="center">操作</td>
   
    <td align="center">状态</td>
  

  </tr> 
 
  <?php 
 
      foreach ($arr['data'] as $k => $v) {
     
 $url  = admlink($v);
 $tid = $v['id'];  $pidname = $v['pidname'];
 menu_changesta($v['sta_visible'],$jumpv,$tid,'sta_catesub');
 

  //-------------
 $editlinkhere = $jumpv.'&file=edit&act=edit&pidname='.$pidname;
 $editv=' &nbsp; &nbsp; &nbsp; <a class="but1" href="'.$editlinkhere.'"><i class="fa fa-pencil-square-o"></i> 修改 </a>';

//--------------

 $numnode = num_subnode(TABLE_NODE,'pid',$pidname);

 $title = $v['name'];
 $jsname = jsdelname($title);

 if($numnode==0 && !ifhasrecord(TABLE_CATE,$pidname,'pid','')) {
  $del_text= " <a class=but2  href=javascript:del('delsubcate','$pidname','$jumpv','$jsname') ><i class='fa fa-trash-o'></i> 删除 </a>";

}
else  $del_text='';

   ?>
  <tr  <?php echo $tr_hide;?>>
  <td align="center">
  <input type="text" name="<?php echo $v['id']?>" value="<?php echo $v['pos']?>" size="5">
  </td> 

    <td align="left">
       <?php echo $v['name']?>
  </td>

  <td align="left">
       <?php echo $v['pidname']?>
   
       <br /> <?php echo $url?>
  </td>

  
    <td align="center">
     <?php 
      echo $editv;
      echo $del_text;
    ?>

    </td>
    <td align="center">
    <?php echo $sta_visible?>
      
    </td>
    
  </tr>

  <?php
  
  if(isset($v['son'])) {
       $arrsub=  $v['son'];

 foreach ($arrsub as $k2 => $v2) {
     
 $url2  = admlink($v2);



 $tid2= $v2['id'];   $pidname2= $v2['pidname'];
 menu_changesta($v2['sta_visible'],$jumpv,$tid2,'sta_catesub');
 
 //-------------
 $editlinkhere = $jumpv.'&file=edit&act=edit&pidname='.$pidname2;
 $editv=' &nbsp; &nbsp; &nbsp; <a class="but1" href="'.$editlinkhere.'"><i class="fa fa-pencil-square-o"></i> 修改 </a>';

//--------------

 $numnode = num_subnode(TABLE_NODE,'pid',$pidname2);
 
 $jsname = jsdelname($v2['name']);

 if($numnode==0 && !ifhasrecord(TABLE_CATE,$pidname2,'pid','')) {
  $del_text= " <a class=but2  href=javascript:del('delsubcate','$pidname2','$jumpv','$jsname') ><i class='fa fa-trash-o'></i> 删除 </a>";

}
else  $del_text='';

?>

 <tr  <?php echo $tr_hide;?>>
 <td align="center">
 &nbsp;&nbsp;&nbsp; ├  
 <input type="text" name="<?php echo $v2['id']?>" value="<?php echo $v2['pos']?>" size="5">
 </td> 
    <td align="left">
       &nbsp;&nbsp;&nbsp; ├   <?php echo $v2['name']?>
  </td>

  <td align="left">
       <?php echo $v2['pidname']?>
   
       <br /> <?php echo $url2?>
  </td>

  
    <td align="center">
   
<?php 
echo $editv;
echo $del_text;
?>

    </td>
    <td align="center">
    <?php echo $sta_visible?>
      
    </td>
    
  </tr>
<?php 

  }
       
  }

  ?>

  <?php 
     }
   
     ?>
 
</tbody></table>

 
<p style="color:red">提醒：只有当分类下面没有子分类，也没有文章，才会出现删除链接。</p>


<div style="padding-bottom:22px"><input class="mysubmit" type="submit" name="Submit" value="排序" />
<br />

<?php echo $sortid_asc?></div>
</form>

<?php 
 }
 echo '<p>暂无子分类</p>';
 ?>