<?php
include_once "tadtools_header.php";

class qrcode{

	//建構函數
	function qrcode(){

	}

	//產生語法
	function render($url){
    $jquery=get_jquery();
		$qrcode="
		$jquery
    <script type='text/javascript' src='".TADTOOLS_URL."/jquery.qrcode/jquery.qrcode.min.js'></script>
    <script type='text/javascript' src='".TADTOOLS_URL."/jquery.qrcode/jquery.browser.min.js'></script>
    <div id='qrcode' style='text-align:center;' onClick=\"location.href='http://{$_SERVER['HTTP_HOST']}{$url}'\"></div>
    <script>
      var rendermode;
      if ($.browser.name == 'msie'){
        rendermode='table';
      }else{
        rendermode='canvas';
      }

    	jQuery('#qrcode').qrcode({
    		render	: rendermode,
    		width: 128,
        height: 128,
    		text	:'http://{$_SERVER['HTTP_HOST']}{$url}'
    	});
    </script>";
    return $qrcode;
  }
}
?>
