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

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

if(!empty($options['4'])) $xoTheme->addStylesheet(XOOPS_URL.'/modules/neillibrary/js/AlertModule/CapCSS/banner.css');	 

$block['setting']=neil_modulessetting($modulesid="neothemesadmin"); 
//區塊寬度
$options['3']=$block['setting']['themefolder']=='computer' ? $options['3'] : $options['5']; 
//區塊高度 
$options['4']=$block['setting']['themefolder']=='computer' ? $options['4'] : $options['6']; 

$block['settings']=$options;

return $block;
}



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

//選擇示警項目
$blockvar['0']=radioinline($class="",$name="options[0]",$text=array(_MB_ALERTSNCDRTEXT04,_MB_ALERTSNCDRTEXT05),$checked=$options[0]); 


//電腦版區塊寬度
$blockvar['1']=inputtext($class="",$name="options[3]",$value="".$options[3]."",$placeholder="",$id="");	 	

//電腦版區塊高度
$blockvar['2']=inputtext($class="",$name="options[4]",$value="".$options[4]."",$placeholder="",$id="");	 

//手機版區塊寬度
$blockvar['3']=inputtext($class="",$name="options[5]",$value="".$options[5]."",$placeholder="",$id="");	 	

//手機版區塊高度
$blockvar['4']=inputtext($class="",$name="options[6]",$value="".$options[6]."",$placeholder="",$id="");

//選擇示警縣市
$Arr = array(); //建構陣列
$i=0;
$Arr[$i]['id']='63';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT020;
$i++;
$Arr[$i]['id']='64';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT029;
$i++;
$Arr[$i]['id']='65';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT021;
$i++;
$Arr[$i]['id']='66';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT022;
$i++;
$Arr[$i]['id']='67';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT023;
$i++;
$Arr[$i]['id']='68';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT024;
$i++;
$Arr[$i]['id']='09007';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT08;
$i++;
$Arr[$i]['id']='09020';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT09;
$i++;
$Arr[$i]['id']='10002';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT010;
$i++;
$Arr[$i]['id']='10004';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT026;
$i++;
$Arr[$i]['id']='10005';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT025;
$i++;
$Arr[$i]['id']='10007';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT011;
$i++;
$Arr[$i]['id']='10008';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT012;
$i++;
$Arr[$i]['id']='10009';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT013;
$i++;
$Arr[$i]['id']='10010';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT028;
$i++;
$Arr[$i]['id']='10013';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT014;
$i++;
$Arr[$i]['id']='10014';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT015;
$i++;
$Arr[$i]['id']='10015';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT016;
$i++;
$Arr[$i]['id']='10016';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT017;
$i++;
$Arr[$i]['id']='10017';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT018;
$i++;
$Arr[$i]['id']='10018';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT019;
$i++;
$Arr[$i]['id']='10020';  
$Arr[$i]['title']=_MB_ALERTSNCDRTEXT027;
$i++;


//下拉選單(呈現方式)
foreach($Arr as $key=> $val){
$blockvar['5'].=optionselect($dataid=$Arr[$key]['id'],$optionname=$Arr[$key]['title'],$oid="".$options[2]."",$value=$Arr[$key]['id']);
}

//選擇示警範圍
$blockvar['6']=radioinline($class="",$name="options[1]",$text=array(_MB_ALERTSNCDRTEXT06,_MB_ALERTSNCDRTEXT07),$checked=$options[1],$id="radiobox"); 


//選擇示警版本
$blockvar['7']=radioinline($class="",$name="options[7]",$text=array(_MB_ALERTSNCDRTEXT030,_MB_ALERTSNCDRTEXT031),$checked=$options[7]); 


$form = "{$option['js']}
  <table  class='table'>
  <tr><th>
  " ._MB_ALERTSNCDRTEXT01. "
  </th><td>
  ".$blockvar['0']."
  </td></tr> 	  
  	  
  <tr><th>
  " ._MB_ALERTSNCDRTEXT02. "
  </th><td>
  ".$blockvar['6']."
  </td></tr> 
  <tr id='sortidbox' style='display: none;'><th>
  " ._MB_ALERTSNCDRTEXT03."
  </th><td>
  <select class='form-control'  name='options[2]'>       
  ".$blockvar['5']."    	   	  	        							
  </select>
  </td></tr>  
  	  
   <tr><th>
  " . _MA_NEILRANDOMIDIOM_BLOCLS04. "
  </th><td>
".$blockvar['1']."
  </td></tr>	  
  	 
  	 
  <tr><th>
  " . _MA_NEILRANDOMIDIOM_BLOCLS05. "
  </th><td>
".$blockvar['2']."
  </td></tr>	  	 
 
   <tr><th>
  " . _MA_NEILRANDOMIDIOM_BLOCLS08. "
  </th><td>
".$blockvar['3']."
  </td></tr>
 
   <tr><th>
  " . _MA_NEILRANDOMIDIOM_BLOCLS09. "
  </th><td>
".$blockvar['4']."
  </td></tr> 
  	   
   <tr><th>
  " . _MB_ALERTSNCDRTEXT032. "
  </th><td>
".$blockvar['7']."
  </td></tr> 
  	   
  	   
  	   
  </table>
<script  src=".XOOPS_URL."/modules/neothemesadmin/js/customize.js></script>
<script>neothemesadmin_radioblocks();</script>      
";

    return $form;
}