Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 13.59 KB | None | 0 0
  1. <?php
  2. if(!defined('RPG')) return;
  3. ?>
  4. <div class="col-md-13">
  5. <div class="card">
  6. <div class="card-body">
  7. <h4 class="card-title">All members from staff</h4>
  8. <!-- Nav tabs -->
  9. <div class="vtabs customvtab">
  10. <ul class="nav nav-tabs tabs-vertical" role="tablist">
  11. <li class="nav-item"> <a class="nav-link active" data-toggle="tab" href="#admins" role="tab"><span class="hidden-sm-up"><i class="ti-home"></i></span> <span class="hidden-xs-down">Admins</span> </a> </li>
  12. <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#helpers" role="tab"><span class="hidden-sm-up"><i class="ti-user"></i></span> <span class="hidden-xs-down">Helpers</span></a> </li>
  13. <li class="nav-item"> <a class="nav-link" data-toggle="tab" href="#leaders" role="tab"><span class="hidden-sm-up"><i class="ti-email"></i></span> <span class="hidden-xs-down">Leaders</span></a> </li>
  14. </ul>
  15. <!-- Tab panes -->
  16. <div class="tab-content">
  17. <div class="tab-pane p-20 active" id="admins" role="tabpanel">
  18. <div class = "table-responsive">
  19. <table class = "table" style = "color: white;">
  20. <?php
  21. $q = DB::prepare('SELECT * FROM `players` WHERE `AdminLevel` > 0 ORDER BY `AdminLevel` DESC');
  22. $q->execute();
  23. if(!$q->rowCount())
  24. {
  25. echo '<font color = "white">Nu sunt admini de afisat!</font>';
  26. }
  27. else
  28. {
  29. ?>
  30. <thead>
  31. <th>Avatar</th>
  32. <th>User name</th>
  33. <th>Admin level</th>
  34. <th>Status</th>
  35. <th>Last login</th>
  36. <?php if(User::isOwner(User::get())) { ?>
  37. <th>Action</th>
  38. <?php } ?>
  39. </thead>
  40. <tbody>
  41. <?php
  42. $a = DB::prepare('SELECT * FROM `players` WHERE `AdminLevel` > 0 AND `Status` = 1');
  43. $a->execute();
  44. echo '<font color = "white">'.$a->rowCount().'/'.$q->rowCount().' admins online</font>';
  45. while($row = $q->fetch(PDO::FETCH_OBJ))
  46. {
  47. ?>
  48. <tr>
  49. <td><img class = "nav-user-photo" src = "<?php echo Config::$data->url;?>assets/images/avatars/<?php echo User::getData($row->ID, "Skin");?>.png" alt = "user" /></td>
  50. <td><?php echo User::format($row->ID,$row->Name);?></td>
  51. <td><?php echo $row->AdminLevel;?></td>
  52. <td><span class = "label label-<?php echo ($row->Status == 0 ? "danger" : "success");?>"><?php echo ($row->Status ? 'Online' : 'Offline');?></span></td>
  53. <td><?php echo $row->LastLogin;?></td>
  54. <?php
  55. if(User::isOwner(User::get()) && User::get() != $row->ID && $row->Status == 0) { ?>
  56. <td><a class = "delete btn btn-danger" id="del_<?php echo $row->ID;?>">Delete</a></td>
  57. <?php } if(User::isOwner(User::get()) && User::get() == $row->ID) { ?>
  58. <td><i class = 'ti-close' title = 'Nu poti utiliza aceasta functie pe tine.' data-toggle = 'tooltip'></i></td>
  59. <?php } if($row->Status == 1 && $row->ID != User::get() && User::isOwner(User::get())) { ?>
  60. <td><i class = 'ti-close' title = 'Acest jucator este online' data-toggle = 'tooltip'></i></td>
  61. <?php } ?>
  62. </tr>
  63. <?php
  64. }
  65. ?>
  66. </tbody>
  67. <?php
  68. }
  69. ?>
  70. </table>
  71. </div>
  72. </div>
  73. <div class="tab-pane p-20" id="helpers" role="tabpanel">
  74. <div class = "table-responsive">
  75. <table class = "table" style = "color: white;">
  76. <?php
  77. $q = DB::prepare('SELECT * FROM `players` WHERE `HelperLevel` > 0 ORDER BY `HelperLevel` DESC');
  78. $q->execute();
  79. if(!$q->rowCount())
  80. {
  81. echo '<font color = "white">Nu sunt helperi de afisat!</font>';
  82. }
  83. else
  84. {
  85. ?>
  86. <thead>
  87. <th>Avatar</th>
  88. <th>User name</th>
  89. <th>Helper level</th>
  90. <th>Status</th>
  91. <th>Last login</th>
  92. <?php if(User::isOwner(User::get())) { ?>
  93. <th>Action</th>
  94. <?php } ?>
  95. </thead>
  96. <tbody>
  97. <?php
  98. $a = DB::prepare('SELECT * FROM `players` WHERE `HelperLevel` > 0 AND `Status` = 1');
  99. $a->execute();
  100. echo '<font color = "white">'.$a->rowCount().'/'.$q->rowCount().' helpers online</font>';
  101. while($row = $q->fetch(PDO::FETCH_OBJ))
  102. {
  103. ?>
  104. <tr>
  105. <td><img class = "nav-user-photo" src = "<?php echo Config::$data->url;?>assets/images/avatars/<?php echo User::getData($row->ID, "Skin");?>.png" alt = "user" /></td>
  106. <td><?php echo User::format($row->ID,$row->Name);?></td>
  107. <td><?php echo $row->HelperLevel;?></td>
  108. <td><span class = "label label-<?php echo ($row->Status == 0 ? "danger" : "success");?>"><?php echo ($row->Status ? 'Online' : 'Offline');?></span></td>
  109. <td><?php echo $row->LastLogin;?></td>
  110. <?php
  111. if(User::isOwner(User::get()) && User::get() != $row->ID && $row->Status == 0) { ?>
  112. <td><a class = "delete btn btn-danger" id="del_<?php echo $row->ID;?>">Delete</a></td>
  113. <?php } if(User::isOwner(User::get()) && User::get() == $row->ID) { ?>
  114. <td><i class = 'ti-close' title = 'Nu poti utiliza aceasta functie pe tine.' data-toggle = 'tooltip'></i></td>
  115. <?php } if($row->Status == 1 && $row->ID != User::get()) { ?>
  116. <td><i class = 'ti-close' title = 'Acest jucator este online' data-toggle = 'tooltip'></i></td>
  117. <?php } ?>
  118. </tr>
  119. <?php
  120. }
  121. ?>
  122. </tbody>
  123. <?php
  124. }
  125. ?>
  126. </tbody>
  127. </table>
  128. </div>
  129. </div>
  130. <div class="tab-pane p-20" id="leaders" role="tabpanel">
  131. <div class = "table-responsive">
  132. <table class = "table" style = "color: white; <?php echo (!User::isOwner(User::get()) ? '' : 'font-size: 13px');?>">
  133. <?php
  134. $q = DB::prepare('SELECT * FROM `players` WHERE `Leader` > 0 ORDER BY `Leader` ASC');
  135. $q->execute();
  136. if(!$q->rowCount())
  137. {
  138. echo '<font color = "white">Nu sunt lideri de afisat!</font>';
  139. }
  140. else
  141. {
  142. ?>
  143. <thead>
  144. <th>Avatar</th>
  145. <th>User name</th>
  146. <th>Faction</th>
  147. <th>Status</th>
  148. <th>Last login</th>
  149. <?php if(User::isOwner(User::get())) { ?>
  150. <th>Leader warn</th><th>Action</th>
  151. <?php } ?>
  152. </thead>
  153. <tbody>
  154. <?php
  155. $a = DB::prepare('SELECT * FROM `players` WHERE `Leader` > 0 AND `Status` = 1');
  156. $a->execute();
  157. echo '<font color = "white">'.$a->rowCount().'/'.$q->rowCount().' leaders online</font>';
  158. while($row = $q->fetch(PDO::FETCH_OBJ))
  159. {
  160. ?>
  161. <tr>
  162. <td><img class = "nav-user-photo" src = "<?php echo Config::$data->url;?>assets/images/avatars/<?php echo User::getData($row->ID, "Skin");?>.png" alt = "user" /></td>
  163. <td><?php echo User::format($row->ID,$row->Name);?></td>
  164. <td><?php echo Arrays::$_factions[$row->Leader];?></td>
  165. <td><span class = "label label-<?php echo ($row->Status == 0 ? "danger" : "success");?>"><?php echo ($row->Status ? 'Online' : 'Offline');?></span></td>
  166. <td><?php echo $row->LastLogin;?></td>
  167. <?php if(User::isOwner(User::get())) { ?>
  168. <td>
  169. <span class="warn-<?php echo $row->ID;?>"><?php echo $row->LWarns;?></span>/3
  170. <?php if($row->Status == 0) { ?>
  171. <a class="table-link danger lw" href="#" id="<?php echo $row->ID;?>" action="down">
  172. <span class="fa-stack">
  173. <i class="fa fa-square fa-stack-2x"></i>
  174. <i class="fa fa-arrow-down fa-stack-1x fa-inverse"></i>
  175. </span>
  176. </a>
  177. <a class="table-link lw" href="#" id="<?php echo $row->ID;?>" action="up">
  178. <span class="fa-stack">
  179. <i class="fa fa-square fa-stack-2x"></i>
  180. <i class="fa fa-arrow-up fa-stack-1x fa-inverse"></i>
  181. </span>
  182. </a>
  183. <?php } else { ?><i class = "ti-close" title = "Acest jucator este online" data-toggle = "tooltip"></i><?php } ?>
  184. </td>
  185. <td>
  186. <?php if($row->Status == 0) { ?>
  187. <button class = "delete_leader btn btn-danger" id="del_<?php echo $row->ID;?>">Delete</button>
  188. <?php } else { ?><i class = "ti-close" title = "Acest jucator este online" data-toggle = "tooltip"></i><?php } ?>
  189. </td>
  190. <?php } ?>
  191. </tr>
  192. <?php
  193. }
  194. ?>
  195. </tbody>
  196. <?php
  197. }
  198. ?>
  199. </table>
  200. </div>
  201. </div>
  202. </div>
  203. </div>
  204. </div>
  205. </div>
  206. </div>
  207. <script src="<?php echo Config::$data->url; ?>assets/plugins/bootbox/bootbox.min.js"></script>
  208. <?php if(User::isOwner(User::get())) { ?>
  209. <script>
  210. $('.delete').click(function()
  211. {
  212. var el = this;
  213. var id = this.id;
  214. var splitid = id.split("_");
  215.  
  216. var idd = splitid[1];
  217.  
  218. // Confirm box
  219. bootbox.dialog(
  220. {
  221. title: '<font color = "white" style = "float: left;">Remove from Staff</font>',
  222. message: '<form style = "color: white;" id = "message_form" method = "post">Reason<br><input class = "form-control" style = "color: white;" type = "text" name = "reason" /></form>',
  223.  
  224. buttons:
  225. {
  226. cancel:
  227. {
  228. className: 'btn btn-danger',
  229. label: 'Close'
  230. },
  231. success:
  232. {
  233. className: 'btn btn-warning',
  234. label: 'Ok',
  235. callback: function(b)
  236. {
  237. var a = $("#message_form");
  238. data = a.serialize();
  239. // AJAX Request
  240. $.ajax
  241. ({
  242. url: _PAGE_URL + 'action/removes',
  243. type: 'POST',
  244. data: { id: idd, data: data },
  245. success: function(response)
  246. {
  247. response = JSON.parse(response);
  248. $.gritter.add({
  249. title: response.title,
  250. text: response.text,
  251. class_name: "gritter-" + response.type + (!$("#gritter-light").get(0) ? " gritter-light" : "")
  252. });
  253. if(response.type === "success")
  254. {
  255. $(el).closest('tr').css('background','tomato');
  256. $(el).closest('tr').fadeOut(800, function(){
  257. $(this).remove();
  258. });
  259. }
  260. }
  261. });
  262. }
  263. }
  264. }
  265. });
  266. });
  267. $('.delete_leader').click(function()
  268. {
  269. var el = this;
  270. var id = this.id;
  271. var splitid = id.split("_");
  272.  
  273. // Delete id
  274. var deleteid = splitid[1];
  275.  
  276. // Confirm box
  277. bootbox.dialog(
  278. {
  279. title: '<font color = "white">Remove from leaders</font>',
  280. message: '<form style = "color: white;" id = "message_form" method = "post">Reason<br><input class = "form-control" style = "color: white;" type = "text" name = "reason" /><div class="form_group"><label class="control-label"> Faction punish</label><select class="form-control" style = "color: white;" name="fpunish" ><option>0</option><option>60</option></select></div></form>',
  281. buttons:
  282. {
  283. cancel:
  284. {
  285. className: 'btn btn-danger',
  286. label: 'Close'
  287. },
  288. success:
  289. {
  290. className: 'btn btn-warning',
  291. label: 'Ok',
  292. callback: function(b)
  293. {
  294. var a = $("#message_form");
  295. data = a.serialize();
  296. // AJAX Request
  297. $.ajax
  298. ({
  299. url: _PAGE_URL + 'action/remove',
  300. type: 'POST',
  301. data: { id: deleteid, data: data },
  302. success: function(response)
  303. {
  304. response = JSON.parse(response);
  305. $.gritter.add({
  306. title: response.title,
  307. text: response.text,
  308. class_name: "gritter-" + response.type + (!$("#gritter-light").get(0) ? " gritter-light" : "")
  309. });
  310. if(response.type === "success")
  311. {
  312. // Removing row from HTML Table
  313. $(el).closest('tr').css('background','tomato');
  314. $(el).closest('tr').fadeOut(800, function(){
  315. $(this).remove();
  316. });
  317. }
  318. }
  319. });
  320. }
  321. }
  322. }
  323. });
  324. });
  325. $('.lw').click(function()
  326. {
  327. var b = $(this).attr("id");
  328. var c = $(this).attr("action");
  329.  
  330. bootbox.dialog(
  331. {
  332. title: '<font color = "white">Leader Warn</font>',
  333. message: '<form style = "color: white;" id = "message_form" method = "post">Reason<br><input class = "form-control" style = "color: white;" type = "text" name = "reason" /></form>',
  334. buttons:
  335. {
  336. cancel:
  337. {
  338. className: 'btn btn-danger',
  339. label: 'Close'
  340. },
  341. success:
  342. {
  343. className: 'btn btn-warning',
  344. label: 'Ok',
  345. callback: function(x)
  346. {
  347. var a = $("#message_form");
  348. data = a.serialize();
  349. $.ajax({
  350. url: _PAGE_URL + "action/lw",
  351. type: "POST",
  352. data: {
  353. id: b,
  354. data: data,
  355. action: c
  356. },
  357. success: function(d) {
  358. d = JSON.parse(d);
  359. $.gritter.add({
  360. title: d.title,
  361. text: d.text,
  362. class_name: "gritter-" + d.type + (!$("#gritter-light").get(0) ? " gritter-light" : "")
  363. });
  364. if(d.type === 'success') {
  365. if(c === 'down') $('.warn-' + b).html(parseInt($('.warn-' + b).text())-1);
  366. if(c === 'up') $('.warn-' + b).html(parseInt($('.warn-' + b).text())+1);
  367. }
  368. if(d.type === 'warning')
  369. {
  370. $('.remove-' + b).fadeOut(300, function(){
  371. $(this).remove();
  372. });
  373. }
  374. }
  375. });
  376. }
  377. }
  378. }
  379. })
  380. });
  381. </script>
  382. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement