<?php
include_once XOOPS_ROOT_PATH . "/modules/neothemesadmin/function.php";
include_once XOOPS_ROOT_PATH."/modules/neillibrary/function/cityadminfunction.php"; //引入城市鄉鎮管理function

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


$dbneme="neil_address";  //資料表名稱
$where="  where  `enable` = '1'  order by btnsort  ASC   limit ".$options[0]."";		
$neil_addressArr=databasetablewhile($dbneme,$where); 

foreach($neil_addressArr as $key=> $val){
$neil_addressArr[$key]['address']=neillibrary_addresscombination($address=$neil_addressArr[$key]['address']);
$target=pagemethod($types=$neil_addressArr[$key]['target']);	
$neil_addressArr[$key]['target']=$target['way'];	
$neil_addressArr[$key]['fbtitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS06,$neil_addressArr[$key]['unit']);
$neil_addressArr[$key]['linetitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS07,$neil_addressArr[$key]['unit']);
$neil_addressArr[$key]['youtubetitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS08,$neil_addressArr[$key]['unit']);
$neil_addressArr[$key]['mapstitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS09,$neil_addressArr[$key]['unit']);
$neil_addressArr[$key]['mapstitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS09,$neil_addressArr[$key]['unit']);
$neil_addressArr[$key]['admintitle']=sprintf(_MA_NEILNEILADDRESS_BLOCLS10,$neil_addressArr[$key]['unit']);


}

$themefolder=neil_modulessetting($modulesid="neothemesadmin",$total="");
$block['themefolder']=$themefolder['themefolder'];   
 	
$block['addresscolmd']=(is_array($neil_addressArr) ? count($neil_addressArr) : 0 )=='1' ? 'col-md-12' : 'col-md-6'; // get TRUE

$block['blockList']['bid']=$thisvar->getVar('bid');

//echo $datevar->getVar('bid');


$block['neil_addressArr']=$neil_addressArr;
   
   

    return $block;
}

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

//模組區塊載入bootstrap3	
neillibrary_bootstrap3blockscss();	

 //取得變數
$op=isset($_REQUEST['op'])?$_REQUEST['op']:"";
$bid=isset($_REQUEST['bid'])?$_REQUEST['bid']:"";	
$bid=bidnamefunction($op=$op,$bid=$bid);	 

//顯示據點數量
$options_table_form['1']=inputtext($class="",$name="options[0]",$value="".$options[0]."",$placeholder="",$id="");	


  $form = "{$option['js']}
  <div class='alert alert-info' role='alert'>"._MS_SHARED216."</div>
  <table class='table table-striped'>  	  
  <tr><th>
  " . _MA_NEILNEILADDRESS_BLOCLS01. "
  </th><td>
".$options_table_form['1']."
  </td></tr>  
  </table>
  ";
    return $form;
}
