<?php
/*
	欢迎使用DM企业建站系统，本系统由www.demososo.com开发。
*/

if(!defined('IN_DEMOSOSO')) {
	exit('this is wrong page,please back to homepage');
}

if(!dmlogin()){
  echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
	echo '提示：没有登录后台，或者后台取消了前台编辑功能';
    //fnoid();
	exit;
}
$seo1[0]  = '预览区块';
$bsfootermob = '';
// layoutcur('','page');

require_once  BLOCKROOT.'tpl/preview_meta.php';


?>
<script src="<?php echo STAPATH?>assets/vendor/clipboard-polyfill.promise.js"></script>

 <style>
.headershowblock{
 margin:50px 0 20px  0;line-height:30px;
 text-align:center;background:#37cde6;font-size:20px
}
.headershowblock span{font-size:14px;color:#666;}

.viewblocktab {height:30px;margin:10px 0;text-align: center}
.viewblocktab a{display: inline-block;margin-right: 16px;padding:5px;background: #e2e2e2}
.viewblocktab a.active{background: #12A7ED;color:#fff;}

 /*blocklist*/
.blocklist .h3here{background:#126393;color:#fff;padding:20px;font-size:14px;font-weight:bold; text-align: center;margin-top:30px; }
.blocklist .h3here a{ color:#fff;font-weight:normal;font-size:12px; }

.addblock{border-radius: 8px;background: #407dba;color:#fff;padding:3px 10px;font-size: 12px}
</style>

<?php

//require_once  BLOCKROOT.'tpl/header.php';


$banner='';$bannertitle='区块效果预览 ';
$bannereffect = 'banner_bg.php';
$bannertext = '';
$bannercssname =$bannertextstyle =$bannerbg='';
 
//require_once  BLOCKROOT.'tpl/banner.php';
?>
<div class="pagewrap">
<?php

$ppid=$preview_all_id;

$ppid4 = substr($ppid,0,4);
 // echo $ppid4;
  if($ppid4=='regi'){
       block($ppid);
  }

// elseif($ppid4=='dmre'){
  //    $file22 = REGIONROOT.$ppid.'/'.$ppid.'.php';

     // if(checkfile($file22)) require $file22;
  //}
 // elseif($ppid=='common' || $ppid=='vipblock' ||  $ppid4=='jtef' ||  $ppid4=='mbef' ||  $ppid4=='styl') {
  // elseif($ppid4=='jtbl') {
else{
      echo '<div class="blocklist">';

         $arr_block=array('bkcustom'=>'自定义区块',
                    'bknode'=>'内容区块',
              'bkblockdh'=>'效果区块',
                    );




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

//----------------
        $sql = "SELECT * from ".TABLE_BLOCK." where   pidstylebh='$ppid' and sta_visible='y' and pid='$type' and typecolumn<>'column' ". ANDLANGBH. " order by  pos desc,id desc"; //pos desc,id desc
  //echo $sql;
  $num_rows = getnum($sql);
  if($num_rows>0){

      echo '<h3 class="h3here">'.$v.$add.'33333</h3>';

  
    $res = getall($sql);


      foreach($res as $v){


        $pidname = $v['pidname'];
        $template = $v['template'];
        $type = $v['pid'];

//if($ppid=='common')  $filename =  'DM-block/'.$type.'/'.$template;
  //if($ppid4=='styl')  $filename =  'DMYI-template/'.HTMLDIR.'/selfblock/'.$type.'/'.$template;
  //if($ppid4=='dmre')  $filename = 'DM-region/'.$ppid.'/'.$type.'/'.$template;


   echo '<div class="headershowblock">'.$v['name'].'<br /><span>  [DMblockid]'.$pidname.'[/DMblockid] </span><i title="复制" style="font-style:normal;cursor:pointer" class="fa fa-files-o jscopyblockid" aria-hidden="true"></i>'.addtoblock($pidname).'</div>';


       if($_GET['full']=='y')  echo '<div class="dmyiblock" style="padding-bottom:50px">';
        else  echo '<div class="container dmyiblock" style="padding-bottom:50px">';


     block($v['pidname']);

     echo '</div>';
    echo '<div class="c"></div>';




      }//end foreach res


 
}



//----------------------------
      }//end foreach arr_block

      echo ' </div>';
    }
//} //end  ($ppid4=='dmre')
//else{
 // echo '<p style="padding:55px;text-align:center">type is error...</p>';
//}
?>



</div><!--end pagewrap-->

<?php


//require_once  BLOCKROOT.'tpl/footer.php';


function addtoblock($v){
    if(substr($v,0,6)<>'region') return  '<p><a class="addblock" href="'.BASEURL.ADMINDIR.'/mod_region/mod_region_addblock.php?pidname='.$v.'&lang='.LANG.'">添加到页面区域</a></p>';
}

?>

</body></html>
 