export.html.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace zin;
  3. unset($lang->exportFileTypeList);
  4. if(is_dir($this->app->getCoreLibRoot() . 'word')) $lang->exportFileTypeList['word'] = 'word';
  5. $lang->exportFileTypeList['html'] = 'html';
  6. set::title($lang->export);
  7. formPanel
  8. (
  9. on::submit('setDownloading'),
  10. css('#fileType{width: 80px;}'),
  11. formGroup
  12. (
  13. set::label($lang->setFileName),
  14. inputGroup
  15. (
  16. input(set::name('fileName')),
  17. picker
  18. (
  19. set::id('fileType'),
  20. set::name('fileType'),
  21. set::required(true),
  22. set::items($lang->exportFileTypeList)
  23. )
  24. )
  25. )
  26. );
  27. h::js
  28. (
  29. <<<JAVASCRIPT
  30. window.setDownloading = function(event)
  31. {
  32. /* Doesn't support Opera, omit it. */
  33. if(navigator.userAgent.toLowerCase().indexOf("opera") > -1) return true;
  34. $.cookie.set('downloading', 0, {expires:config.cookieLife, path:config.webRoot});
  35. var time = setInterval(function()
  36. {
  37. if($.cookie.get('downloading') == 1)
  38. {
  39. const modal = zui.Modal.query(event.target);
  40. if(modal) modal.hide();
  41. $.cookie.set('downloading', null, {expires:config.cookieLife, path:config.webRoot});
  42. clearInterval(time);
  43. }
  44. }, 300);
  45. return true;
  46. }
  47. $(document).ready(function()
  48. {
  49. $('#tabReport').addClass('block opacity-0');
  50. $('#mainContent .nav.nav-tabs').trigger('show', [{}, '#tabReport']);
  51. setTimeout(function()
  52. {
  53. $('#tabReport div[id^="chart"]').each(function()
  54. {
  55. if(echarts.getInstanceByDom(this).getWidth() == '100')
  56. {
  57. echarts.getInstanceByDom($(this)[0]).resize({width: 580});
  58. echarts.getInstanceByDom($(this)[0]).on('finished', function(){
  59. chartImgData = $(this._dom).find('canvas').get(0).toDataURL("image/png");
  60. chartID = $(this._dom).attr('id');
  61. $('#fileName').after("<input type='hidden' name='" + chartID +"' id='" + chartID + "' />");
  62. $('.modal-dialog #' + chartID).val(chartImgData);
  63. });
  64. }
  65. else
  66. {
  67. chartImgData = $(this).find('canvas').get(0).toDataURL("image/png");
  68. chartID = $(this).attr('id');
  69. $('#fileName').after("<input type='hidden' name='" + chartID +"' id='" + chartID + "' />");
  70. $('.modal-dialog #' + chartID).val(chartImgData);
  71. }
  72. });
  73. $('#tabReport').removeClass('block opacity-0');
  74. }, 200);
  75. });
  76. JAVASCRIPT
  77. );
  78. render();