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


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

//開啟newblocks資料表
$configList=moduledb($dbneme="neothemesconfig",$where=" where `nsn` = '1'");

//姓名
$block['blockvar']['name_user']=inputtext($class="",$name="name_user",$value="",$placeholder=""._MB_SHOWTHENUMBER8.""._MB_SHOWTHENUMBER7."",$id="blockname_user");

//手機
$block['blockvar']['tel_user']=inputtext($class="",$name="tel_user",$value="",$placeholder=""._MB_SHOWTHENUMBER8.""._MB_SHOWTHENUMBER11."",$id="blocktel_user");
 
//郵件
$block['blockvar']['email_user']=inputtext($class="",$name="email_user",$value="",$placeholder=""._MB_SHOWTHENUMBER8.""._MB_SHOWTHENUMBER10."",$id="blockemail_user");
 
//訊息
//事項說明
$block['blockvar']['texe_user']=inputtextarea($class="",$name="texe_user",$id="blocktexe_user",$rows="7",$cols="80",$value="",$placeholder=""._MB_SHOWTHENUMBER8.""._MB_SHOWTHENUMBER12.""); 	

   
//不是機器人
//$block['blockvar']['mycheck']=checkbox($dataid=true,$name="mycheck",$value="1",$optionname=""._MB_SHOWTHENUMBER13."",$oid="",$i,$class="blocktcheckboxinput");     


//驗證資料
//$block['blockvar']['verification']=defenserobot($var=timedate($datevar="Y-m-d H:i:s"),$type=1);

//聯絡資訊
$block['blockvar']['information']=base64_decode($configList['contactustext']);

if(!empty($options[0])){
$block['blockvar']['title']=str_replace ("[nobox]","",$thisvar->getVar('title')); 
}
$block['cat_id']=$thisvar->getVar('bid');   
$block['setting']=neil_modulessetting($modulesid="neothemesadmin");


     return $block; 
}




//區塊編輯函式
function onlineconsultation_block_edit($options)
{
  global $xoopsDB, $xoTheme;

	
neillibrary_bootstrap3blockscss($typevar="3");	

$configList=moduledb($dbneme="neothemesconfig",$where=" where `nsn` = '1'");


$blockvar['1']=inputtextarea($class="",$name="contactustext",$id="contactustext",$rows="6",$cols="80",$value="".htmlspecialchars(base64_decode($configList['contactustext'])).""); 

$blockvar['2']=radioinline($class="",$name="options[0]",$text=array(_MS_SHARED131,_MS_SHARED130),$checked=$options[0],$id=""); 
  	


$form = "{$option['js']}
  <table  class='table'>
   <tr><th  style='width: 10%;'>
  " . _MB_SHOWTHENUMBER6. "
  </th><td>
".$blockvar['1']."
  </td></tr>
  	  
   <tr><th>
  " . _MB_SHOWTHENUMBER25. "
  </th><td>
".$blockvar['2']."
  </td></tr>
  
  </table>
<script src='".XOOPS_URL."/modules/neillibrary/js/ckeditor/ckeditor.js'></script>
<script>
CKEDITOR.replace('contactustext' , {
toolbar : 'my' ,
skin: 'moono'		
	    });
</script>  
		  
<script>var xoopsjsurl='".XOOPS_URL."';</script>		  
<script src='".XOOPS_URL."/modules/neothemesadmin/js/ajaxjs.js'></script>	  
<script>contactustextbtn();</script>
		
  ";
    return $form;
}
