foot_step.php 5.6 KB

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