PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/application/views/monotony/monotony_data.php

https://bitbucket.org/nando123/unj-iamperform
PHP | 349 lines | 330 code | 12 blank | 7 comment | 2 complexity | 4c86eb1c0f860b1148d3295c37edeea9 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. $data = "";
  3. $dayList = array(
  4. 'Sun' => 'Minggu',
  5. 'Mon' => 'Senin',
  6. 'Tue' => 'Selasa',
  7. 'Wed' => 'Rabu',
  8. 'Thu' => 'Kamis',
  9. 'Fri' => 'Jumat',
  10. 'Sat' => 'Sabtu'
  11. );
  12. if($table){
  13. $tmpdata = 0;
  14. $count = count($table);
  15. $Details = $cell["value"];
  16. foreach($table as $num => $row){
  17. $mdldate[$num] = $row->detail_date;
  18. $sessType[$num] = $row->detail_session;
  19. $detIntensity[$num] = $row->detail_intensity;
  20. $detVolume[$num] = $row->detail_volume;
  21. $day[$num] = date("D",strtotime($mdldate[$num]));
  22. $hari = $day[$num];
  23. $dayHari = $dayList[$hari];
  24. $totalVolume[$num] = $detIntensity[$num]*$detVolume[$num];
  25. if( isset($Details[$mdldate[$num]]) ) {
  26. $TrainingLoad = '<td rowspan="'.$Details[$mdldate[$num]]['count'].'">
  27. '.$Details[$mdldate[$num]]['trainingday'].'</td>';
  28. unset($Details[$mdldate[$num]]);
  29. }else {
  30. $TrainingLoad = "";
  31. }
  32. $RIGHT = ($num==0)?'[TrainingMonotoryLeft][TrainingMonotoryRight][TrainingStrainLeft][TrainingStrainRight]':'';
  33. $data .="<tr><td>$dayHari - ".($num+1)."</td><td>".date("d M Y", strtotime($mdldate[$num]))."</td>"
  34. ."<td>$sessType[$num]</td><td class='text-center'>$detIntensity[$num]</td>"
  35. ."<td class='text-center'>$detVolume[$num]</td>"
  36. ."<td class='text-center'>$totalVolume[$num]</td>".$TrainingLoad."".$RIGHT;
  37. }
  38. $TrainingMonotory['left'] = '<td class="text-center" rowspan="'.$count.'">'.$variation.'</td>';
  39. $TrainingMonotory['right'] = '<td class="text-center" rowspan="'.$count.'">'.$target.'</td>';
  40. $TrainingStrain['left'] = '<td class="text-center" rowspan="'.$count.'">'.$desc.'</td>';
  41. $TrainingStrain['right'] = '<td class="text-center" rowspan="'.$count.'">'.$load.'</td>';
  42. $data = str_replace("[TrainingMonotoryLeft]", $TrainingMonotory['left'] , $data);
  43. $data = str_replace("[TrainingMonotoryRight]", $TrainingMonotory['right'] , $data);
  44. $data = str_replace("[TrainingStrainLeft]", $TrainingStrain['left'] , $data);
  45. $data = str_replace("[TrainingStrainRight]", $TrainingStrain['right'] , $data);
  46. $data .= '<tr><td colspan="3" rowspan="3"></td>'
  47. .'<td rowspan="3"></td>'
  48. .'<td class="text-center">Weakly TL</td>'
  49. .'<td class="text-center" style="font-weight: bold;">'.$total.'</td>'
  50. .'<td colspan="2" class="text-center">Last Week : '.number_format($last, 2, ".", "").'</td>
  51. </tr>
  52. <tr>
  53. <td class="text-center">Av daily load</td>
  54. <td class="text-center" style="font-weight: bold;">'.$average.'</td>
  55. <td colspan="2" rowspan="2" class="numeric text-center" style="font-weight: bold;"></td>
  56. </tr>
  57. <tr>
  58. <td class="numeric text-center">SD</td>
  59. <td class="numeric text-center" style="font-weight: bold;">'.$stdev.'</td>
  60. </tr>
  61. ';
  62. }
  63. ?>
  64. <section id="content">
  65. <!--start container-->
  66. <div class="container">
  67. <div class="col s12 m12 l6">
  68. <div id="flight-card" class="card">
  69. <div class="card-header sea-games">
  70. <div class="card-title">
  71. <div class="col s5 m5 l5 center-align">
  72. <img src="<?php echo $gambar_atl?>" width="100px" height="100px" class="circle z-depth-1 responsive-img activator">
  73. </div>
  74. <div class="col s5 m5 l5 center-align">
  75. <h5 class="flight-card-title black-text" style="text-shadow: 1px 1px 1px #ffffff;"><b><?php echo $nama_user?></b></h5>
  76. <p class="flight-card-date black-text" style="text-shadow: 1px 1px 1px #ffffff;"><?php echo $group_name ?> - <?php echo $no_event ?></p>
  77. <p class="flight-card-date black-text" style="text-shadow: 1px 1px 1px #ffffff;">Training Load</p>
  78. </div>
  79. </div>
  80. <div class="col s12 m12 l5 center-align">
  81. <a href="#" onClick="showGrafik('<?php echo $monotony_id?>')" class="btn-flat blue white-text">Grafik Sessi</a> &nbsp&nbsp
  82. <a href="#" onClick="showGrafikDay('<?php echo $monotony_id?>')" class="btn-flat blue white-text">Grafik Hari</a>
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. <div class="col s12 m12 l6 card">
  88. <div id="responsive-table">
  89. <div class="row">
  90. <div class="col s12 m12 16" id="DataMonotony">
  91. <table class="responsive-table striped">
  92. <thead>
  93. <tr>
  94. <td class="indigo white-text">Hari</td>
  95. <td class="indigo white-text">TGL</td>
  96. <td class="indigo white-text">SESSION</td>
  97. <td class="indigo white-text">INTENSITAS</td>
  98. <td class="indigo white-text">VOLUME</td>
  99. <td class="indigo white-text" colspan="2">TRAINING LOAD</td>
  100. <td class="indigo white-text" colspan="2">TRAINING MONOTORY</td>
  101. <td class="indigo white-text" colspan="2">TRAINING STRAIN</td>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. <tr>
  106. <td class="text-center">Sesi latihan</td>
  107. <td class="text-center">Week starting</td>
  108. <td class="text-center">Session Type</td>
  109. <td class="text-center">Effort scale 1 to 10 - RPE</td>
  110. <td class="text-center">Duration of actual session workout in minutes</td>
  111. <td class="text-center" colspan="2">Intensity X volume</td>
  112. <td class="text-center" >Daily Variation</td>
  113. <td class="text-center" >Target 1.5</td>
  114. <td class="text-center" >Total Impact on Athlete</td>
  115. <td class="text-center" >Load X Monotony</td>
  116. </tr>
  117. <?php echo $data ?>
  118. </tbody>
  119. </table>
  120. </div>
  121. </div>
  122. </div>
  123. </div>
  124. </div>
  125. <!--end container-->
  126. </section>
  127. <script>
  128. function showGrafik(monotony_id){
  129. $("#DataMonotony").html("<div class='progress'><div class='indeterminate'></div></div>");
  130. var optionsSession = {
  131. chart: {
  132. renderTo: 'DataMonotony',
  133. },
  134. plotOptions: {
  135. spline: {
  136. dataLabels: {
  137. enabled: true,
  138. color: '#000000',
  139. style: {
  140. fontWeight: 'bold'
  141. }
  142. }
  143. },
  144. column: {
  145. dataLabels: {
  146. enabled: true,
  147. color: '#000000',
  148. style: {
  149. fontWeight: 'bold'
  150. }
  151. }
  152. },
  153. },
  154. title: {
  155. text: 'Training Load Per Session Chart'
  156. },
  157. navigation: {
  158. buttonOptions: {
  159. align: "right",
  160. enabled: false,
  161. },
  162. },
  163. xAxis: {
  164. categories: [],
  165. labels: {
  166. rotation: -90,
  167. align: 'right',
  168. style: {
  169. fontSize: '13px',
  170. fontFamily: 'Verdana, sans-serif'
  171. }
  172. }
  173. },
  174. yAxis: [
  175. {
  176. min:0,
  177. max:10,
  178. },
  179. {
  180. min:0,
  181. max:1000,
  182. },
  183. ],
  184. legend: {
  185. enabled: true,
  186. },
  187. series: [
  188. {
  189. yAxis:0,
  190. type: 'column',
  191. name: 'Goal',
  192. data: [{}],
  193. color:"#009688"
  194. },
  195. {
  196. yAxis:0,
  197. type: 'column',
  198. name: 'Actual',
  199. data: [{}],
  200. color:"#F44336"
  201. },
  202. {
  203. yAxis:1,
  204. type: 'spline',
  205. name: 'Training Load',
  206. data: [{}],
  207. color:"#76FF03"
  208. },
  209. ]
  210. };
  211. $.ajax({
  212. type : 'POST',
  213. url : '<?php echo base_url();?>index.php/monotony/viewGrafik',
  214. data : {monotony_id:monotony_id},
  215. dataType: "json",
  216. success: function(data){
  217. // $("#DataMonotony").html(data);
  218. // alert(data);
  219. // return;
  220. optionsSession.xAxis.categories = data.categories;
  221. optionsSession.series[2].data = data.load;
  222. // options.series[1].data = data.score;
  223. optionsSession.series[0].data = data.rpe;
  224. optionsSession.series[1].data = data.actual;
  225. var chart = new Highcharts.Chart(optionsSession);
  226. },error: function(xhr, ajaxOptions, thrownError){
  227. alert(xhr.responseText);
  228. }
  229. });
  230. }
  231. function showGrafikDay(monotony_id){
  232. $("#DataMonotony").html("<div class='progress'><div class='indeterminate'></div></div>");
  233. var options = {
  234. chart: {
  235. renderTo: 'DataMonotony',
  236. },
  237. plotOptions: {
  238. spline: {
  239. dataLabels: {
  240. enabled: true,
  241. color: '#000000',
  242. style: {
  243. fontWeight: 'bold'
  244. }
  245. }
  246. },
  247. column: {
  248. dataLabels: {
  249. enabled: true,
  250. color: '#000000',
  251. style: {
  252. fontWeight: 'bold'
  253. }
  254. }
  255. },
  256. },
  257. title: {
  258. text: 'Training Load Per Day Chart'
  259. },
  260. navigation: {
  261. buttonOptions: {
  262. align: "right",
  263. enabled: true,
  264. },
  265. },
  266. xAxis: {
  267. categories: [],
  268. labels: {
  269. rotation: -90,
  270. align: 'right',
  271. style: {
  272. fontSize: '13px',
  273. fontFamily: 'Verdana, sans-serif'
  274. }
  275. }
  276. },
  277. yAxis: [
  278. {
  279. allowDecimals: false,
  280. title: {
  281. text: ''
  282. }
  283. },
  284. {
  285. min: 0,
  286. max: 20,
  287. allowDecimals: false,
  288. title: {
  289. text: ''
  290. }
  291. }
  292. ],
  293. legend: {
  294. enabled: true,
  295. },
  296. series: [
  297. {
  298. type: 'spline',
  299. name: 'Training Load',
  300. data: [{}],
  301. },
  302. {
  303. type: 'column',
  304. name: 'Goal',
  305. data: [{}],
  306. yAxis:1,
  307. color:"#009688",
  308. },
  309. {
  310. type: 'column',
  311. name: 'Actual',
  312. data: [{}],
  313. yAxis:1,
  314. color:"#F44336",
  315. },
  316. ]
  317. };
  318. $.ajax({
  319. type : 'POST',
  320. url : '<?php echo base_url();?>index.php/monotony/viewGrafikDay',
  321. data : {monotony_id:monotony_id},
  322. dataType: "json",
  323. success: function(data){
  324. // $("#DataMonotony").html(data);
  325. // alert(data);
  326. // return;
  327. options.xAxis.categories = data.categories;
  328. options.series[0].data = data.load;
  329. options.series[1].data = data.rpe;
  330. options.series[2].data = data.actual;
  331. var chart = new Highcharts.Chart(options);
  332. },error: function(xhr, ajaxOptions, thrownError){
  333. alert(xhr.responseText);
  334. }
  335. });
  336. }
  337. </script>