<?php
//  ------------------------------------------------------------------------ //
// 本模組由 tad 製作
// 製作日期：2007-11-04
// $Id: tadgallery_page.php,v 1.1 2008/06/25 06:36:34 tad Exp $
// ------------------------------------------------------------------------- //

//區塊主函式 (QR Code)
function tadgallery_qrcode_show($options){
  if(preg_match("/tadgallery\/index.php\?csn=/i", $_SERVER['REQUEST_URI'])){
    $url=str_replace("index.php","pda.php",$_SERVER['REQUEST_URI']);
  }elseif(preg_match("/tadgallery\/view.php\?sn=/i", $_SERVER['REQUEST_URI'])){
    $url=str_replace("view.php","pda.php",$_SERVER['REQUEST_URI']);
  }else{
    return ;
  }

  $jquery=get_jquery();
  $block="
  $jquery
  <script type='text/javascript' src='".XOOPS_URL."/modules/tadgallery/class/jquery.qrcode.min.js'></script>
  <script type='text/javascript' src='".XOOPS_URL."/modules/tadgallery/class/jquery.browser.min.js'></script>
  <div id='qrcode' style='text-align:center;' onClick=\"location.href='".XOOPS_URL."{$url}'\"></div>
  <script>
    var rendermode;
    if ($.browser.name == 'msie'){
      rendermode='table';
    }else{
      rendermode='canvas';
    }
    
  	jQuery('#qrcode').qrcode({
  		render	: rendermode,
  		width: 128,
      height: 128,
  		text	:'".XOOPS_URL."{$url}'
  	});
  </script>
  ";
	return $block;
}
?>
