<?php

/* ========================================================================
 * $Id: qrcode.view.php 1612 2018-02-12 02:53:04Z onez $
 * 
 * Email: www@onez.cn
 * QQ: 6200103
 * HomePage: http://www.onezphp.com
 * ========================================================================
 * Copyright 2016-2017 佳蓝科技.
 * 
 * ======================================================================== */

!defined('IN_ONEZ') && exit('Access Denied');
#名称：查看二维码
#标识：qrcode.view

class onezphp_qrcode_view extends onezphp{
  function __construct(){
    
  }
  function click($text,$title='查看二维码'){
    global $G;
    if($this->times(1)){
      $G['footer'].=<<<ONEZ
<div class="modal fade qrcode-view-frame" id="qrcode-view-win" style="display: none;z-index:1060">
  <div class="modal-dialog" style="width:280px">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><i class="glyphicon glyphicon-remove" style="font-size: 28px"></i></button>
        <button type="button" class="close btn-max hide"><i class="glyphicon glyphicon-resize-full" style="font-size: 20px;margin:3px"></i></button>
        <button type="button" class="close btn-small hide"><i class="glyphicon glyphicon-resize-small" style="font-size: 20px;margin:3px"></i></button>
        <h4 class="modal-title">查看二维码</h4>
      </div>
      <div class="modal-body"></div>
    </div>
  </div>
</div>
ONEZ;
      $G['footer-js'].=<<<ONEZ
onez.view_qrcode=function(text,title){
  if(title){
    $('#qrcode-view-win .modal-title').html(title);
  }
  $('#qrcode-view-win .modal-body').css({padding:'10px 0'}).html('<img src="/?_p=qrcode&_m=show&text='+encodeURIComponent(text)+'" height="256" style="margin:0 auto;display:block;background:#fff" />');
  
  var win=$("#qrcode-view-win").modal({backdrop: 'static', keyboard: false});
};

ONEZ;
    }
    return 'onez.view_qrcode('.var_export($text,1).','.var_export($title,1).')';
  }
}