

<style>
 table.formtab { margin-bottom:0 }
 .blocknavspec li {height:25px;float:left;margin:3px 5px}
 .blocknavspec li a {padding:2px  !important;margin:0 !important;border:0 !important}
 .blocknavspec .active, .blocknavspec .active a{background:red  !important;color:#fff !important}
 ul.blocknavspec{overflow:hidden }
</style>



  <table class="formtab">


  <tr>
    <td class="tl" colspan="2" style="border:0">

<div class="" style="display:inline-block">

<ul  class="nav nav-tabs blocknav blocknavspec" >

<?php
$i=0;
$jtblockarr = getDir(BLOCKROOT.'jtblock/');
 //pre($jteffectarr);
 foreach($jtblockarr as $k=>$v){

  $num = numrecords(TABLE_BLOCK,$v,'pidstylebh');
  $numv = $num==0?'':' <span class="num">('.$num.')</span>';
  $v2 = $v;
  foreach($arr_blockfolder as $kk=>$vv){
      if($v == $kk) $v2= $vv;
  }

  
  ?>

    <li <?php if($i==0) echo 'class="active"';?>>
    <a href="#<?php echo $k?>" data-toggle="tab">
       <?php
          echo $v2.$numv;
       ?>
    </a>
  </li>

  <?php
  $i++;
}
?>


</ul>

</div></td></tr>

  <tr>
    <td class="tl" colspan="2" style="border:0">

<div   class="tab-content">


 <?php
$i=0;

//$jtblockarr = getDir(BLOCKROOT.'jtblock/');
 //pre($jteffectarr);
 foreach($jtblockarr as $k=>$v){
  $ppid = $v;
  ?>
 <div class="tab-pane fade <?php if($i==0) echo 'in active'?>" id="<?php echo $k;?>">

 <?php

foreach($arr_block as $k=>$v){
  $type=$k;



 $sql = "SELECT * from ".TABLE_BLOCK." where   $noandlangbh  and pidstylebh='$ppid' and pid='$type'   and typecolumn<>'column'  order by  pos desc,id desc"; //pos desc,id desc
 //echo $sql;

$num_rows = getnum($sql);
if($num_rows>0){

  echo '<h3>'.$v.'</h3>';

  $rowlist = getall($sql);

  echo '<ul>';

       foreach($rowlist as $v){


             $name = $v['name'];
             $pidname = $v['pidname'];
             $template = $v['template'];

             if(is_int(strpos($template,'mbblock/')))  $bgv ='style="background:#e2e2e2"';
             else $bgv='';

            echo '<li '.$bgv.'>'.admblockid($pidname).' '.adm_previewlink($pidname).$name.'</li>';

               }
      echo '</ul>';
   }

  }
?>

  </div> <!--end tab-pane-->
<?php
$i++;
}


?>

 </div>


 </td>
  </tr>
  </table>

