foot_step.php 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <?php
  2. if(isset($_GET["userid"])){
  3. $foot_set_userid = $_GET["userid"];
  4. }
  5. else if(isset($_COOKIE["userid"])){
  6. $foot_set_userid = $_COOKIE["userid"];
  7. }
  8. else{
  9. echo "no user id";
  10. exit;
  11. }
  12. include "../pcdl/html_head.php";
  13. ?>
  14. <body>
  15. <?php
  16. require_once "../config.php";
  17. require_once "../public/_pdo.php";
  18. require_once '../public/function.php';
  19. require_once '../ucenter/function.php';
  20. require_once "../pcdl/head_bar.php";
  21. $currChannal = "foot-step";
  22. require_once "../uhome/head.php";
  23. ?>
  24. <link href='../lib/fullcalendar/main.css' rel='stylesheet' />
  25. <script src='../lib/fullcalendar/main.js'></script>
  26. <script src="../../node_modules/highcharts/highstock.js"></script>
  27. <script src="../../node_modules/highcharts/modules/data.js"></script>
  28. <script src="../../node_modules/highcharts/modules/exporting.js"></script>
  29. <script src="https://code.highcharts.com/stock/highstock.js"></script>
  30. <script src="https://code.highcharts.com/stock/modules/data.js"></script>
  31. <script src="https://code.highcharts.com/stock/modules/exporting.js"></script>
  32. <div class='section_inner'>
  33. <div id="container" style="height: 400px; min-width: 310px"></div>
  34. </div>
  35. <script>
  36. document.addEventListener('DOMContentLoaded', function() {
  37. var calendarEl = document.getElementById('calendar');
  38. var calendar = new FullCalendar.Calendar(calendarEl, {
  39. headerToolbar: {
  40. left: 'prev,next today',
  41. center: 'title',
  42. right: 'dayGridMonth,timeGridWeek,timeGridDay,listWeek'
  43. },
  44. locale: getCookie("language"),
  45. editable: false,
  46. navLinks: true, // can click day/week names to navigate views
  47. dayMaxEvents: true, // allow "more" link when too many events
  48. events: {
  49. url: 'foot_step_data.php?userid=<?php echo $foot_set_userid;?>',
  50. failure: function() {
  51. document.getElementById('script-warning').style.display = 'block'
  52. }
  53. },
  54. loading: function(bool) {
  55. document.getElementById('loading').style.display =
  56. bool ? 'block' : 'none';
  57. }
  58. });
  59. calendar.render();
  60. });
  61. Highcharts.setOptions({
  62. lang: {
  63. weekdays: [
  64. gLocal.gui.ravi, gLocal.gui.canda, gLocal.gui.bhumma, gLocal.gui.budha,
  65. gLocal.gui.guru, gLocal.gui.sukka, gLocal.gui.sora
  66. ],
  67. shortMonths:[
  68. gLocal.gui.Jan, gLocal.gui.Feb, gLocal.gui.Mar, gLocal.gui.Apr, gLocal.gui.May, gLocal.gui.Jun, gLocal.gui.Jul, gLocal.gui.Aug, gLocal.gui.Sep, gLocal.gui.Oct, gLocal.gui.Nov, gLocal.gui.Dec
  69. ]
  70. }
  71. });
  72. Highcharts.getJSON('../ucenter/active_get.php', function (data) {
  73. var ohlc = [],
  74. volume = [],
  75. dataLength = data.length,
  76. // set the allowed units for data grouping
  77. groupingUnits = [[
  78. 'week', // unit name
  79. [1] // allowed multiples
  80. ], [
  81. 'month',
  82. [1, 2, 3, 4, 6]
  83. ]],
  84. i = 0;
  85. for (i; i < dataLength; i += 1) {
  86. ohlc.push([
  87. data[i][0], // the date
  88. data[i][1], // open
  89. data[i][2], // high
  90. data[i][3], // low
  91. data[i][4] // close
  92. ]);
  93. volume.push([
  94. data[i][0], // the date
  95. data[i][5] // the volume
  96. ]);
  97. }
  98. // create the chart
  99. Highcharts.stockChart('container', {
  100. rangeSelector: {
  101. selected: 2
  102. },
  103. title: {
  104. text: gLocal.gui.progress_curve
  105. },
  106. yAxis: [{
  107. labels: {
  108. align: 'right',
  109. x: -3
  110. },
  111. title: {
  112. text: gLocal.gui.EXP
  113. },
  114. height: '60%',
  115. lineWidth: 2,
  116. resize: {
  117. enabled: true
  118. }
  119. }, {
  120. labels: {
  121. align: 'right',
  122. x: -3
  123. },
  124. title: {
  125. text: gLocal.gui.action
  126. },
  127. top: '65%',
  128. height: '35%',
  129. offset: 0,
  130. lineWidth: 2
  131. }],
  132. tooltip: {
  133. shared: false,
  134. useHTML: true,
  135. pointFormatter: function() {
  136. if(this.high){
  137. return '<b><a href="../">'+this.series.name + ' : ' + this.high + '&nbsp;' +gLocal.gui.h+ '</a><br><a href="../">' +gLocal.gui.day_EXP + ' : ' + Math.round((this.high - this.low)*100)/100 + '&nbsp;' +gLocal.gui.h+'</a></b><br/>';
  138. }
  139. else{
  140. return '<b><a href="../">'+this.series.name + ' : ' + this.y + '&nbsp;' +gLocal.gui.times+'</a><span style="display:none;">'+this.x+'</span></b>';
  141. }
  142. },
  143. valueDecimals: 2,//保留两位小數
  144. split: true
  145. },
  146. series: [{
  147. type: 'ohlc',
  148. name: gLocal.gui.EXP_in_total,
  149. data: ohlc,
  150. dataGrouping: {
  151. units: [[
  152. 'week', // unit name
  153. [1] // allowed multiples
  154. ], [
  155. 'month',
  156. [1, 2, 3, 4, 6]
  157. ]]
  158. }
  159. }, {
  160. type: 'column',
  161. name: gLocal.gui.day_action,
  162. data: volume,
  163. yAxis: 1,
  164. dataGrouping: {
  165. units: groupingUnits
  166. }
  167. }]
  168. });
  169. });
  170. </script>
  171. <style>
  172. #script-warning {
  173. display: none;
  174. background: #eee;
  175. border-bottom: 1px solid #ddd;
  176. padding: 0 10px;
  177. line-height: 40px;
  178. text-align: center;
  179. font-weight: bold;
  180. font-size: 12px;
  181. color: red;
  182. }
  183. #loading {
  184. display: none;
  185. position: absolute;
  186. top: 10px;
  187. right: 10px;
  188. }
  189. #calendar {
  190. max-width: 1100px;
  191. margin: 40px auto;
  192. padding: 0 10px;
  193. }
  194. </style>
  195. <div class='section_inner'>
  196. <div id='script-warning'>
  197. <code>php/get-events.php</code> must be running.
  198. </div>
  199. <div id='loading'>loading...</div>
  200. <div id='calendar'></div>
  201. </div>
  202. <?php
  203. include "../pcdl/html_foot.php";
  204. ?>