<?php
include_once XOOPS_ROOT_PATH . "/modules/neothemesadmin/function.php";
include_once XOOPS_ROOT_PATH . "/modules/neillibrary/function/blocksfunction.php";	

function neilcustom_block_show($options,$thisvar){
global $xoopsDB,$xoTheme,$xoopsModule;


$block['setting']=neil_modulessetting($modulesid="neothemesadmin");	
$block['bid']=$thisvar->getVar('bid');
$block['options']=$options;
$block['content_block']=$thisvar->getVar('content', '');


//顯示裝置判斷
foreach(explode(',', $options[0]) as  $val){
if($val=='1' && $block['setting']['themefolder']=='computer'){
return $block;
}
if($val=='2' && $block['setting']['themefolder']=='phone'){
return $block;
}
}
if(empty($options[0])){
return $block;
}
}



//區塊編輯函式
function neilcustom_block_edit($options,$thisvar){
global $xoopsDB, $xoTheme;  
	
neillibrary_bootstrap3blockscss($typevar="3");	

$blockvar['0']=inputtextarea($class="",$name="content_block",$id="content_block",$rows="6",$cols="80",$value="".htmlspecialchars(htmlspecialchars_decode($thisvar->getVar('content', 'e'), ENT_QUOTES)).""); 
//顯示裝置
$blockvar['1']=neillibrary_displaydevice($oval=$options[0],$nameval="options[0][]");


$form = "{$option['js']}
  <table  class='table'>
  <tr><th>
  " ._MA_NEIL_CUSTOM_BLOCKK01. "
  </th><td>
  <div class='col-sm-12'>	  
  ".$blockvar['0']."
  </div>	  
  </td></tr> 
  <tr><th>
  " ._MS_SHARED248. "
  </th><td>
  <div class='col-sm-12'>	  
  ".$blockvar['1']."
  </div>	  
  </td></tr>
  </table>
<script src='".XOOPS_URL."/modules/neillibrary/js/ckeditor/ckeditor.js'></script>
<script>
var myToolbar = [
            { name: 'bar1', items: ['Source'] },
            { name: 'bar2', items: ['Cut', 'Copy', 'Undo', 'Redo'] },
         // { name: 'bar3', items: ['Image', 'EqnEditor', 'Table', 'HorizontalRule', 'Smiley', 'Link', 'Unlink'] },
            { name: 'bar4', items: ['NumberedList', 'BulletedList', 'RemoveFormat', 'Syntaxhighlight', 'CodeSnippet'] },      
         // { name: 'bar5', items: ['Blockquote', 'CreateDiv'] },
            { name: 'bar6', items: ['PageBreak', 'WidgetTemplateMenu', 'Uploadcare'] },
         // { name: 'bar7', items: ['Styles', 'Format', 'Font', 'FontSize'] },
            { name: 'bar7', items: ['Styles', 'Format',  'FontSize'] },
            { name: 'bar7-1', items: ['TextColor', 'BGColor', 'Bold', 'Italic', 'Underline', 'Strike'] },
            { name: 'bar8', items: ['Outdent', 'Indent'] },
            { name: 'bar9', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'] },
         // { name: 'bar10', items: ['Find', 'Replace', 'SelectAll', 'FontAwesome'] }

];	
CKEDITOR.replace('content_block' , {
toolbar : 'my' ,
skin: 'moono',	
toolbar_my: myToolbar	
	    });
</script>
";

return $form;
}