foot_step.php 5.5 KB

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