guild.php 14 KB

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