guild.php 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327
  1. <?php
  2. /**
  3. * Guild view.
  4. *
  5. * Contains the view layout and some code to present the data.
  6. *
  7. * @category View
  8. * @var Guild_Page $page The page model.
  9. * @var int get_context()->get_game_mode() Game mode.
  10. */
  11. ?>
  12. <!DOCTYPE html>
  13. <html lang='en'>
  14. <head>
  15. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  16. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  17. <title><?=$page->title?></title>
  18. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  19. <!-- CSS files -->
  20. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  21. <?php
  22. if (get_context()->get_game_mode() == GAME_MODE_ID::RTA){
  23. ?>
  24. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui-rta.css'/>
  25. <?php
  26. }
  27. ?>
  28. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>guild.css'/>
  29. <!-- Meta tags -->
  30. <link rel='canonical' href='<?=$page->canonical?>'/>
  31. <link rel='author' href='<?=$page->author?>'/>
  32. <link rel='publisher' href='<?=$page->author?>'/>
  33. <meta name='description' content='<?=$page->description?>'/>
  34. <meta property='og:title' content='<?=$page->title?>'/>
  35. <meta property='og:url' content='<?=$page->canonical?>'/>
  36. <meta property='og:description' content='<?=$page->description?>'/>
  37. <meta property='og:image' content='<?=$page->icon?>'/>
  38. <meta property='og:site_name' content='<?=$page->name?>'/>
  39. <meta property='og:type' content='website'/>
  40. <meta property='og:locale' content='en'/>
  41. <meta name='twitter:card' content='summary'/>
  42. <meta name='twitter:title' content='<?=$page->title?>'/>
  43. <meta name='twitter:description' content='<?=$page->description?>'/>
  44. <meta name='twitter:image' content='<?=$page->icon?>'/>
  45. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  46. <meta name='robots' content='index follow'/>
  47. </head>
  48. <body>
  49. <?php
  50. include __DIR__ . "/inc/header.php";
  51. ?>
  52. <aside>
  53. <?php
  54. if (!isset($page->guild)){
  55. ?>
  56. <h2>
  57. Guild
  58. </h2>
  59. <p>
  60. You are not currently in a guild.
  61. </p>
  62. <?php
  63. }
  64. else{
  65. ?>
  66. <h2>
  67. <?=$page->guild->name?>
  68. </h2>
  69. <span id='guild_level'>
  70. Lv. <?=$page->guild->level?>
  71. </span>
  72. <span id='guild_experience'>
  73. (Exp: <?=$page->guild->experience?>)
  74. </span>
  75. <p id='guild_comment'>
  76. <?=$page->guild->comment?>
  77. </p>
  78. <p id='guild_notice'>
  79. <?=$page->guild->notice?>
  80. </p>
  81. <?php
  82. }
  83. ?>
  84. </aside>
  85. <main>
  86. <?php
  87. if (!isset($page->guild)){
  88. ?>
  89. <section id='no_guild'>
  90. <h2>
  91. Guild
  92. </h2>
  93. You are not currently in a guild.
  94. </section>
  95. <?php
  96. }
  97. else{
  98. ?>
  99. <section id='guild_info' class='content'>
  100. <h2>
  101. <?=$page->guild->name?>
  102. </h2>
  103. <div id='guild_details'>
  104. <div id='guild_skills'>
  105. <?php
  106. foreach ($page->skill_groups as $group){
  107. ?>
  108. <div class='skill_group'>
  109. <span class='skill_group_title'>
  110. <?=$group->name?>
  111. </span>
  112. <img class='skill_group_image' alt='<?=$group->name?>' src='<?=$group->get_image()?>'/>
  113. <div class='skill_group_content'>
  114. <span class='description'>
  115. <?=$group->description?>
  116. </span>
  117. <ul>
  118. <?php
  119. foreach ($group->skills as $skill){
  120. if ($skill->level > $page->guild->level){
  121. $unavailable = "unavailable";
  122. }
  123. else{
  124. $unavailable = "";
  125. }
  126. ?>
  127. <li class='<?=$unavailable?>'>
  128. Lv. <?=$skill->level?>: <?=$skill->effect?>
  129. </li>
  130. <?php
  131. }
  132. ?>
  133. </ul>
  134. </div>
  135. </div>
  136. <?php
  137. }
  138. ?>
  139. </div>
  140. </div>
  141. <table id='guild_members'>
  142. <tr>
  143. <th>
  144. &nbsp;
  145. </th>
  146. <th>
  147. Name
  148. </th>
  149. <th>
  150. Lv.
  151. </th>
  152. <th colspan='2'>
  153. Arena
  154. </th>
  155. <th>
  156. War
  157. </th>
  158. <th>
  159. Def
  160. </th>
  161. <th>
  162. Login
  163. </th>
  164. </tr>
  165. <?php
  166. $odd = "";
  167. foreach ($page->guild->members as $member){
  168. ?>
  169. <tr>
  170. <td class='grade <?=$odd?>'>
  171. <?php
  172. if ($member->grade == GUILD_MEMBER_GRADE_ID::LEADER){
  173. ?>
  174. <img alt='yes' src='<?=URL::IMG["ICON"] . "leader.png"?>'/>
  175. <?php
  176. }
  177. elseif ($member->grade == GUILD_MEMBER_GRADE_ID::VICELEADER){
  178. ?>
  179. <img alt='yes' src='<?=URL::IMG["ICON"] . "viceleader.png"?>'/>
  180. <?php
  181. }
  182. ?>
  183. </td>
  184. <td class='name <?=$odd?>'>
  185. <?=$member->name?>
  186. </td>
  187. <td class='level <?=$odd?>'>
  188. <?=$member->level?>
  189. </td>
  190. <td class='score <?=$odd?>'>
  191. <?=$member->arena_score?>
  192. </td>
  193. <td class='score_icon <?=$odd?>'>
  194. <?php
  195. if ($member->arena_score >= ARENA_RANKING_POINTS::BEGINER && (ARENA_RANKING_RANK::BEGINER == null || $member->rating <= ARENA_RANKING_RANK::BEGINER)){
  196. $src = URL::IMG["RANK"] . "0900.png";
  197. $tit = "Beginer";
  198. }
  199. if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_1 && (ARENA_RANKING_RANK::CHALLENGER_1 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_1)){
  200. $src = URL::IMG["RANK"] . "1001.png";
  201. $tit = "Challenger 1";
  202. }
  203. if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_2 && (ARENA_RANKING_RANK::CHALLENGER_2 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_2)){
  204. $src = URL::IMG["RANK"] . "1002.png";
  205. $tit = "Challenger 2";
  206. }
  207. if ($member->arena_score >= ARENA_RANKING_POINTS::CHALLENGER_3 && (ARENA_RANKING_RANK::CHALLENGER_3 == null || $member->rating <= ARENA_RANKING_RANK::CHALLENGER_3)){
  208. $src = URL::IMG["RANK"] . "1003.png";
  209. $tit = "Challenger 3";
  210. }
  211. if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_1 && (ARENA_RANKING_RANK::FIGHTER_1 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_1)){
  212. $src = URL::IMG["RANK"] . "2001.png";
  213. $tit = "Fighter 1";
  214. }
  215. if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_2 && (ARENA_RANKING_RANK::FIGHTER_2 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_2)){
  216. $src = URL::IMG["RANK"] . "2002.png";
  217. $tit = "Fighter 2";
  218. }
  219. if ($member->arena_score >= ARENA_RANKING_POINTS::FIGHTER_3 && (ARENA_RANKING_RANK::FIGHTER_3 == null || $member->rating <= ARENA_RANKING_RANK::FIGHTER_3)){
  220. $src = URL::IMG["RANK"] . "2003.png";
  221. $tit = "Fighter 3";
  222. }
  223. if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_1 && (ARENA_RANKING_RANK::CONQUEROR_1 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_1)){
  224. $src = URL::IMG["RANK"] . "3001.png";
  225. $tit = "Conqueror 1";
  226. }
  227. if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_2 && (ARENA_RANKING_RANK::CONQUEROR_2 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_2)){
  228. $src = URL::IMG["RANK"] . "3002.png";
  229. $tit = "Conqueror 2";
  230. }
  231. if ($member->arena_score >= ARENA_RANKING_POINTS::CONQUEROR_3 && (ARENA_RANKING_RANK::CONQUEROR_3 == null || $member->rating <= ARENA_RANKING_RANK::CONQUEROR_3)){
  232. $src = URL::IMG["RANK"] . "3003.png";
  233. $tit = "Conqueror 3";
  234. }
  235. if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_1 && (ARENA_RANKING_RANK::GUARDIAN_1 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_1)){
  236. $src = URL::IMG["RANK"] . "4001.png";
  237. $tit = "Guardian 1";
  238. }
  239. if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_2 && (ARENA_RANKING_RANK::GUARDIAN_2 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_2)){
  240. $src = URL::IMG["RANK"] . "4002.png";
  241. $tit = "Guardian 2";
  242. }
  243. if ($member->arena_score >= ARENA_RANKING_POINTS::GUARDIAN_3 && (ARENA_RANKING_RANK::GUARDIAN_3 == null || $member->rating <= ARENA_RANKING_RANK::GUARDIAN_3)){
  244. $src = URL::IMG["RANK"] . "4003.png";
  245. $tit = "Guardian 3";
  246. }
  247. if ($member->arena_score >= ARENA_RANKING_POINTS::LEGEND && (ARENA_RANKING_RANK::LEGEND == null || $member->rating <= ARENA_RANKING_RANK::LEGEND)){
  248. $src = URL::IMG["RANK"] . "5001.png";
  249. $tit = "Legend";
  250. }
  251. ?>
  252. <img alt='<?=$tit?>' src='<?=$src?>'/>
  253. </td>
  254. <td class='war <?=$odd?>'>
  255. <?php
  256. if ($member->in_war){
  257. ?>
  258. <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
  259. <?php
  260. }
  261. ?>
  262. </td>
  263. <td class='defense <?=$odd?>'>
  264. <?php
  265. if ($member->has_defense){
  266. ?>
  267. <img alt='yes' src='<?=URL::IMG["ICON"] . "ok.png"?>'/>
  268. <?php
  269. }
  270. ?>
  271. </td>
  272. <?php
  273. $now = time();
  274. $date = (new DateTime("@$member->last_login"))->format('Y-m-d H:i:s');
  275. $days = $now - strtotime($date);
  276. $days = floor($days / (60 * 60 * 24));
  277. if ($days == 0){
  278. $hours = floor($days / (60 * 60));
  279. if ($hours == 0){
  280. $last_login = "Online";
  281. }
  282. else if ($hours == 1){
  283. $last_login = "1 hour";
  284. }
  285. else{
  286. $last_login = floor($days / (60 * 60)) . " hours";
  287. }
  288. $warning = "";
  289. }
  290. else{
  291. $last_login = "$days days";
  292. if ($days < 2){
  293. $last_login = "$days day";
  294. $warning = "";
  295. }
  296. elseif ($days < 5){
  297. $warning = "warning";
  298. }
  299. else{
  300. $warning = "danger";
  301. }
  302. }
  303. ?>
  304. <td class='last_login <?=$odd?> <?=$warning?>'>
  305. <?=$last_login?>
  306. </td>
  307. </tr>
  308. <?php
  309. if ($odd == ""){
  310. $odd = "odd";
  311. }
  312. else{
  313. $odd = "";
  314. }
  315. }
  316. ?>
  317. </table>
  318. </section>
  319. <?php
  320. }
  321. ?>
  322. </main>
  323. <?php
  324. include __DIR__ . "/inc/footer.php";
  325. ?>
  326. </body>
  327. </html>