control.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <?php
  2. /**
  3. * The control file of branch of ZenTaoPMS.
  4. *
  5. * @copyright Copyright 2009-2024 禅道软件(青岛)有限公司(ZenTao Software (Qingdao) Co., Ltd. www.cnezsoft.com)
  6. * @license ZPL(http://zpl.pub/page/zplv12.html) or AGPL(https://www.gnu.org/licenses/agpl-3.0.en.html)
  7. * @author Chenxuan Song <songchenxuan@cnezsoft.com>
  8. * @package bi
  9. * @version $Id$
  10. * @link https://www.zentao.net
  11. */
  12. class bi extends control
  13. {
  14. /**
  15. * 使用 duckDB 生成最新的 parquet 文件。
  16. * Use duckDB gen lastest parquet.
  17. *
  18. * @access public
  19. * @return void
  20. */
  21. public function syncParquetFile()
  22. {
  23. $startTime = microtime(true);
  24. $result = $this->bi->generateParquetFile();
  25. $endTime = microtime(true);
  26. $runTime = $endTime - $startTime;
  27. echo "$runTime \n";
  28. if($result !== true)
  29. {
  30. echo $result;
  31. return;
  32. }
  33. echo 'success';
  34. }
  35. /**
  36. * Init parquet.
  37. *
  38. * @access public
  39. * @return void
  40. */
  41. public function initParquet()
  42. {
  43. $startTime = microtime(true);
  44. $this->bi->initParquet();
  45. $endTime = microtime(true);
  46. $runTime = $endTime - $startTime;
  47. echo "$runTime \n";
  48. echo 'success';
  49. }
  50. /**
  51. * Ajax: get object options.
  52. *
  53. * @access public
  54. * @return void
  55. */
  56. public function ajaxGetScopeOptions($type)
  57. {
  58. $scopeOptions = $this->bi->getScopeOptions($type);
  59. $items = array();
  60. foreach($scopeOptions as $key => $option) $items[] = array('text' => $option, 'value' => $key, 'keys' => $option);
  61. return print(json_encode($items));
  62. }
  63. /**
  64. * 安装DuckDB引擎。
  65. * AJAX: Install duckdb.
  66. *
  67. * @access public
  68. * @return void
  69. */
  70. public function ajaxInstallDuckdb()
  71. {
  72. ignore_user_abort(true);
  73. set_time_limit(0);
  74. session_write_close();
  75. $this->bi->downloadDuckdb();
  76. echo 'success';
  77. }
  78. /**
  79. * 检查duckdb文件是否下载完成。
  80. * AJAX: Check duckdb.
  81. *
  82. * @access public
  83. * @return void
  84. */
  85. public function ajaxCheckDuckdb()
  86. {
  87. $check = $this->bi->checkDuckdbInstall();
  88. echo(json_encode($check));
  89. }
  90. /**
  91. * AJAX: Get menu of table fields.
  92. *
  93. * @access public
  94. * @return void
  95. */
  96. public function ajaxGetTableFieldsMenu()
  97. {
  98. $menu = $this->bi->getTableFieldsMenu();
  99. echo json_encode($menu);
  100. }
  101. }