/player_kills.php

https://github.com/CinisterOne/Statistician_Web · PHP · 316 lines · 263 code · 50 blank · 3 comment · 55 complexity · f6a4ac4a79cead4abce7d96b3a79242f MD5 · raw file

  1. <?php
  2. $_player = $serverObj->getPlayer($_GET['uuid']);
  3. ?>
  4. <div id="subTitle"><?php echo($_player->getName()); ?> <?php echo(STRING_ALL_KILLS); ?>/<?php echo(STRING_ALL_DEATHS); ?></div>
  5. <a name="pvpKills">
  6. <div id="subCategory"><?php echo(STRING_ALL_PVP_KILLS); ?>/<?php echo(STRING_ALL_DEATHS); ?></div>
  7. </a>
  8. <table>
  9. <tr>
  10. <th></th></th><th><?php echo(STRING_ALL_KILLER); ?></th><th><?php echo(STRING_ALL_WEAPON); ?></th><th><?php echo(STRING_ALL_VICTIM); ?></th><th><?php echo(STRING_ALL_KILLTIME); ?></th>
  11. </tr>
  12. <?php
  13. $thisTablePNGet = 'pvpPN';
  14. $thisTablePNAN = 'pvpKills';
  15. $tableFull = $_player->getPlayerKillDeathTablePVP();
  16. $pageNumber = 1;
  17. if (isset($_GET[$thisTablePNGet])) {
  18. $pageNumber = $_GET[$thisTablePNGet];
  19. }
  20. $numPages = 1;
  21. $numPages = floor(count($tableFull) / 50);
  22. $rowNum = 50 * ($pageNumber - 1);
  23. $pvpTable = $_player->getPlayerKillDeathTablePVP(true,$rowNum,50);
  24. if ($pvpTable == null)
  25. $pvpTable = array();
  26. foreach ($pvpTable as $pvpRow) {
  27. $killer = $serverObj->getPlayer($pvpRow['killed_by_uuid']);
  28. $victim = $serverObj->getPlayer($pvpRow['killed_uuid']);
  29. $rowIDHash = "killRow";
  30. if ($killer->getUUID() == $_player->getUUID())
  31. $rowIDHash = "deathRow";
  32. $rowNum++;
  33. ?>
  34. <tr id="<?php echo($rowIDHash); ?>">
  35. <td><?php echo($rowNum); ?>.</td>
  36. <td><a href="?view=player&uuid=<?php echo($killer->getUUID()); ?>"><?php echo($killer->getName()); ?></a></td>
  37. <td><?php echo(QueryUtils::getResourceNameById($pvpRow['killed_using'])); ?></td>
  38. <td><a href="?view=player&uuid=<?php echo($victim->getUUID()); ?>"><?php echo($victim->getName()); ?></a></td>
  39. <td><?php echo(QueryUtils::formatDate($pvpRow['time'])); ?></td>
  40. </tr>
  41. <?php
  42. }
  43. ?>
  44. </table>
  45. <?php
  46. if ($numPages > 1) {
  47. // Allow User to Go To Next Page
  48. ?>
  49. <span id="pageSelector">
  50. <?php if ($pageNumber > 1) { ?> <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber - 1); ?>#<?php echo($thisTablePNAN); ?>"><< <?php echo(STRING_ALL_PREVIOUS); ?></a> <?php } ?>
  51. <?php if ($pageNumber > 1) {
  52. for ($x = 3; $x >= 1; --$x) {
  53. $jumpToPage = $pageNumber - $x;
  54. if ($jumpToPage >= 1) {
  55. ?>
  56. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  57. <?php
  58. }
  59. }
  60. }
  61. ?>
  62. <font id="pageSelector_CurrentPage"><?php echo($pageNumber); ?></font>
  63. <?php
  64. if ($pageNumber < $numPages) {
  65. for ($x = 1; $x <= 3; ++$x) {
  66. $jumpToPage = $pageNumber + $x;
  67. if ($jumpToPage <= $numPages) {
  68. ?>
  69. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  70. <?php
  71. }
  72. }
  73. }
  74. if ($pageNumber != $numPages) {
  75. ?>
  76. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber + 1); ?>#<?php echo($thisTablePNAN); ?>"><?php echo(STRING_ALL_NEXT); ?> >></a>
  77. <?php
  78. }
  79. ?>
  80. </span>
  81. <?php
  82. }
  83. ?>
  84. <a name="pveKills">
  85. <div id="subCategory"><?php echo(STRING_ALL_PVE_KILLS); ?>/<?php echo(STRING_ALL_DEATHS); ?></div>
  86. </a>
  87. <table>
  88. <tr>
  89. <th></th></th><th><?php echo(STRING_ALL_KILLER); ?></th><th><?php echo(STRING_ALL_WEAPON); ?></th><th><?php echo(STRING_ALL_VICTIM); ?></th><th><?php echo(STRING_ALL_KILLTIME); ?></th>
  90. </tr>
  91. <?php
  92. $tableFull = $_player->getPlayerKillDeathTablePVE();
  93. $thisTablePNGet = 'pvePN';
  94. $thisTablePNAN = 'pveKills';
  95. $pageNumber = 1;
  96. if (isset($_GET[$thisTablePNGet])) {
  97. $pageNumber = $_GET[$thisTablePNGet];
  98. }
  99. $numPages = 1;
  100. $numPages += floor(count($tableFull) / 50);
  101. $rowNum = 50 * ($pageNumber - 1);
  102. $table = $_player->getPlayerKillDeathTablePVE(true, $rowNum ,50);
  103. if ($table == null)
  104. $table = array();
  105. $playerID = QueryUtils::getCreatureIdByName("Player");
  106. foreach ($table as $row) {
  107. $rowIDHash = "killRow";
  108. if ($row['killed_by'] == $playerID) {
  109. $killer = $serverObj->getPlayer($row['killed_by_uuid']);
  110. if ($killer->getUUID() == $_player->getUUID())
  111. $rowIDHash = "deathRow";
  112. } else {
  113. $killer = QueryUtils::getCreatureNameById($row['killed_by']);
  114. }
  115. if ($row['killed'] == $playerID) {
  116. $victim = $serverObj->getPlayer($row['killed_uuid']);
  117. } else {
  118. $victim = QueryUtils::getCreatureNameById($row['killed']);
  119. }
  120. $rowNum++;
  121. ?>
  122. <tr id="<?php echo($rowIDHash); ?>">
  123. <td><?php echo($rowNum); ?>.</td>
  124. <?php
  125. if (@get_class($killer) == "PLAYER") {
  126. ?>
  127. <td><a href="?view=player&uuid=<?php echo($killer->getUUID()); ?>"><?php echo($killer->getName()); ?></a></td>
  128. <?php
  129. } else {
  130. ?>
  131. <td><?php echo($killer); ?></td>
  132. <?php
  133. }
  134. ?>
  135. <td><?php echo(QueryUtils::getResourceNameById($row['killed_using'])); ?></td>
  136. <?php
  137. if (@get_class($victim) == "PLAYER") {
  138. ?>
  139. <td><a href="?view=player&uuid=<?php echo($victim->getUUID()); ?>"><?php echo($victim->getName()); ?></a></td>
  140. <?php
  141. } else {
  142. ?>
  143. <td><?php echo($victim); ?></td>
  144. <?php
  145. }
  146. ?>
  147. <td><?php echo(QueryUtils::formatDate($row['time'])); ?></td>
  148. </tr>
  149. <?php
  150. }
  151. ?>
  152. </table>
  153. <?php
  154. if ($numPages > 1) {
  155. // Allow User to Go To Next Page
  156. ?>
  157. <span id="pageSelector">
  158. <?php if ($pageNumber > 1) { ?> <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber - 1); ?>#<?php echo($thisTablePNAN); ?>"><< <?php echo(STRING_ALL_PREVIOUS); ?></a> <?php } ?>
  159. <?php if ($pageNumber > 1) {
  160. for ($x = 3; $x >= 1; --$x) {
  161. $jumpToPage = $pageNumber - $x;
  162. if ($jumpToPage >= 1) {
  163. ?>
  164. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  165. <?php
  166. }
  167. }
  168. }
  169. ?>
  170. <font id="pageSelector_CurrentPage"><?php echo($pageNumber); ?></font>
  171. <?php
  172. if ($pageNumber < $numPages) {
  173. for ($x = 1; $x <= 3; ++$x) {
  174. $jumpToPage = $pageNumber + $x;
  175. if ($jumpToPage <= $numPages) {
  176. ?>
  177. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  178. <?php
  179. }
  180. }
  181. }
  182. if ($pageNumber != $numPages) {
  183. ?>
  184. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber + 1); ?>#<?php echo($thisTablePNAN); ?>"><?php echo(STRING_ALL_NEXT); ?> >></a>
  185. <?php
  186. }
  187. ?>
  188. </span>
  189. <?php
  190. }
  191. ?>
  192. <a name="otherDeaths">
  193. <div id="subCategory"><?php echo(STRING_ALL_OTHER_DEATHS); ?></div>
  194. </a>
  195. <table>
  196. <tr>
  197. <th></th></th><th><?php echo(STRING_ALL_VICTIM); ?></th><th><?php echo(STRING_ALL_REASON); ?></th><th><?php echo(STRING_ALL_KILLTIME); ?></th>
  198. </tr>
  199. <?php
  200. $thisTablePNGet = 'otherPN';
  201. $thisTablePNAN = 'otherDeaths';
  202. $tableFull = $_player->getPlayerDeathTableOther();
  203. $pageNumber = 1;
  204. if (isset($_GET[$thisTablePNGet])) {
  205. $pageNumber = $_GET[$thisTablePNGet];
  206. }
  207. $numPages = 1;
  208. $numPages = floor(count($tableFull) / 50);
  209. $rowNum = 50 * ($pageNumber - 1);
  210. $table = $_player->getPlayerDeathTableOther(true,$rowNum,50);
  211. if ($table == null)
  212. $table = array();
  213. foreach ($table as $row) {
  214. $victim = $serverObj->getPlayer($row['killed_uuid']);
  215. $deathType = QueryUtils::getKillTypeNameById($row['kill_type']);
  216. $rowNum++;
  217. ?>
  218. <tr>
  219. <td><?php echo($rowNum); ?>.</td>
  220. <td><a href="?view=player&uuid=<?php echo($victim->getUUID()); ?>"><?php echo($victim->getName()); ?></a></td>
  221. <td><?php echo($deathType); ?></td>
  222. <td><?php echo(QueryUtils::formatDate($row['time'])); ?></td>
  223. </tr>
  224. <?php
  225. }
  226. ?>
  227. </table>
  228. <?php
  229. if ($numPages > 1) {
  230. // Allow User to Go To Next Page
  231. ?>
  232. <span id="pageSelector">
  233. <?php if ($pageNumber > 1) { ?> <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber - 1); ?>#<?php echo($thisTablePNAN); ?>"><< <?php echo(STRING_ALL_PREVIOUS); ?></a> <?php } ?>
  234. <?php if ($pageNumber > 1) {
  235. for ($x = 3; $x >= 1; --$x) {
  236. $jumpToPage = $pageNumber - $x;
  237. if ($jumpToPage >= 1) {
  238. ?>
  239. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  240. <?php
  241. }
  242. }
  243. }
  244. ?>
  245. <font id="pageSelector_CurrentPage"><?php echo($pageNumber); ?></font>
  246. <?php
  247. if ($pageNumber < $numPages) {
  248. for ($x = 1; $x <= 3; ++$x) {
  249. $jumpToPage = $pageNumber + $x;
  250. if ($jumpToPage <= $numPages) {
  251. ?>
  252. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($jumpToPage); ?>#<?php echo($thisTablePNAN); ?>"><?php echo($jumpToPage); ?></a>
  253. <?php
  254. }
  255. }
  256. }
  257. if ($pageNumber != $numPages) {
  258. ?>
  259. <a href="./?view=playerKills&uuid=<?php echo($_player->getUUID()); ?>&<?php echo($thisTablePNGet); ?>=<?php echo($pageNumber + 1); ?>#<?php echo($thisTablePNAN); ?>"><?php echo(STRING_ALL_NEXT); ?> >></a>
  260. <?php
  261. }
  262. ?>
  263. </span>
  264. <?php
  265. }
  266. ?>