fusion.php 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <?php
  2. /**
  3. * Fusion view.
  4. *
  5. * Contains the view layout and some code to present the data.
  6. *
  7. * @category View
  8. * @property_read Fusion_Page $page The page model.
  9. * @property_read int $UID Player ID.
  10. */
  11. namespace swdb;
  12. ?>
  13. <!DOCTYPE html>
  14. <html lang='en'>
  15. <head>
  16. <meta content='text/html; charset=utf-8' http-equiv='content-type'/>
  17. <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1'/>
  18. <title><?=$page->title?></title>
  19. <link rel='shortcut icon' href='<?=$page->favicon?>'/>
  20. <!-- CSS files -->
  21. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>ui.css'/>
  22. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>fusion.css'/>
  23. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
  24. <!-- Meta tags -->
  25. <link rel='canonical' href='<?=$page->canonical?>'/>
  26. <link rel='author' href='<?=$page->author?>'/>
  27. <link rel='publisher' href='<?=$page->author?>'/>
  28. <meta name='description' content='<?=$page->description?>'/>
  29. <meta property='og:title' content='<?=$page->title?>'/>
  30. <meta property='og:url' content='<?=$page->canonical?>'/>
  31. <meta property='og:description' content='<?=$page->description?>'/>
  32. <meta property='og:image' content='<?=$page->icon?>'/>
  33. <meta property='og:site_name' content='<?=$page->name?>'/>
  34. <meta property='og:type' content='website'/>
  35. <meta property='og:locale' content='en'/>
  36. <meta name='twitter:card' content='summary'/>
  37. <meta name='twitter:title' content='<?=$page->title?>'/>
  38. <meta name='twitter:description' content='<?=$page->description?>'/>
  39. <meta name='twitter:image' content='<?=$page->icon?>'/>
  40. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  41. <meta name='robots' content='index follow'/>
  42. <script>
  43. /**
  44. * Shows or hiddes the filters panel.
  45. */
  46. function toggleFilters(){
  47. var content = document.getElementById('filters_content');
  48. var slid = document.getElementById('filters_slid');
  49. if (content.style.maxHeight != '30em'){
  50. content.style.maxHeight = '30em';
  51. slid.style.transform = 'rotate(90deg)';
  52. }
  53. else{
  54. content.style.maxHeight = '0px';
  55. slid.style.transform = 'rotate(0deg)';
  56. }
  57. };
  58. </script>
  59. </head>
  60. <body>
  61. <?php
  62. include __DIR__ . "/inc/header.php";
  63. ?>
  64. <section class='filters'>
  65. <h2 id='filters_title' onClick='toggleFilters();'>
  66. <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
  67. Fusion filters
  68. </h2>
  69. <article id='filters_content'>
  70. <?php
  71. $filters = $page->filters;
  72. $custom_filters = $page->custom_filters;
  73. include __DIR__ . "/inc/filter_fusion.php";
  74. ?>
  75. </article>
  76. </section> <!-- #filters -->
  77. <?php
  78. foreach ($page->fusion as $fusion){
  79. ?>
  80. <section class='content'>
  81. <h2>
  82. <?=$fusion->product->title?>
  83. </h2>
  84. <article>
  85. <div class='f5'>
  86. <div class='product'>
  87. <a target='_blank' title='<?=$fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$fusion->product->id?>'>
  88. <div class='monster_panel'>
  89. <span class='stars'>
  90. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  91. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  92. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  93. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  94. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  95. </span>
  96. <img title='<?=$fusion->product->name?>' class='monster border_<?=$fusion->product->element_name?>' src='<?=$fusion->product->get_image()?>'/>
  97. <span class='level'>
  98. 1
  99. </span>
  100. </div><!-- .monster_panel -->
  101. </a>
  102. <div class='owned'>
  103. <span class='owned'>
  104. Collection:
  105. </span>
  106. <?php
  107. foreach ($fusion->product->owned as $owned){
  108. if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
  109. // No to, no from, silver monster.
  110. $star_class ="star_silver";
  111. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  112. }
  113. elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
  114. // Already awakened
  115. if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
  116. // Normal awaken.
  117. $star_class ="star_purple";
  118. }
  119. else{
  120. // Second awaken.
  121. $star_class ="star_red";
  122. }
  123. $mon_title = $owned->unit->name;
  124. }
  125. elseif ($owned->unit->awakens_to != ""){
  126. // Awakeable.
  127. $star_class ="star_gold";
  128. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  129. }
  130. $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
  131. ?>
  132. <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
  133. <div class='monster_panel'>
  134. <span class='stars'>
  135. <?php
  136. for ($i = 0; $i < $owned->stars; $i ++){
  137. ?>
  138. <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
  139. <?php
  140. }
  141. ?>
  142. </span>
  143. <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
  144. <span class='level'>
  145. <?=$owned->level?>
  146. </span>
  147. </div>
  148. </a>
  149. <?php
  150. }// foreach ($fusion->product->owned as $owned)
  151. ?>
  152. </div><!-- .owned -->
  153. </div><!-- .product --><div class='ingredients'><!-- No newline because CSS reads it as a whitespace -->
  154. <?php
  155. foreach ($fusion->fusion as $sub_fusion){
  156. ?>
  157. <div class='f4'>
  158. <div class='product'>
  159. <a target='_blank' title='<?=$sub_fusion->product_awaken->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product_awaken->id?>'>
  160. <div class='awakened monster_panel'>
  161. <span class='stars'>
  162. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  163. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  164. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  165. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  166. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  167. </span>
  168. <img title='<?=$sub_fusion->product_awaken->name?>' class='monster border_<?=$sub_fusion->product_awaken->element_name?>' src='<?=$sub_fusion->product_awaken->get_image()?>'/>
  169. <span class='level'>
  170. 35
  171. </span>
  172. </div><!-- .awakened .monster_panel -->
  173. </a>
  174. <a target='_blank' title='<?=$sub_fusion->product->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->product->id?>'>
  175. <div class='unawakened monster_panel'>
  176. <span class='stars'>
  177. <?php
  178. for ($i = 0; $i < $sub_fusion->product->base_stars; $i ++){
  179. ?>
  180. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  181. <?php
  182. }
  183. ?>
  184. </span>
  185. <img title='<?=$sub_fusion->product->name?>' class='monster border_<?=$sub_fusion->product->element_name?>' src='<?=$sub_fusion->product->get_image()?>'/>
  186. <span class='level'>
  187. 1
  188. </span>
  189. </div><!-- .unawakened .monster_panel -->
  190. </a>
  191. <div class='essences'>
  192. <?php
  193. foreach ($sub_fusion->product->essences as $essence){
  194. ?>
  195. <div class='essence border_<?=$essence["element"]?>'>
  196. <img alt='<?=$essence["grade"]?> <?=$essence["element"]?> essence' title='<?=$essence["amount"]?>x <?=$essence["grade"]?> <?=$essence["element"]?> essence' class='essence' src='<?=URL::IMG["ESSENCE"]?><?=$essence["element"]?>_<?=$essence["grade"]?>.png'/>
  197. <span>
  198. <?=$essence["amount"]?>
  199. </span>
  200. </div>
  201. <?php
  202. }
  203. ?>
  204. </div><!-- .essences -->
  205. <div class='owned'>
  206. <span class='owned'>
  207. Collection:
  208. </span>
  209. <?php
  210. foreach ($sub_fusion->product->owned as $owned){
  211. if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
  212. // No to, no from, silver monster.
  213. $star_class ="star_silver";
  214. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  215. }
  216. elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
  217. // Already awakened
  218. if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
  219. // Normal awaken.
  220. $star_class ="star_purple";
  221. }
  222. else{
  223. // Second awaken.
  224. $star_class ="star_red";
  225. }
  226. $mon_title = $owned->unit->name;
  227. }
  228. elseif ($owned->unit->awakens_to != ""){
  229. // Awakeable.
  230. $star_class ="star_gold";
  231. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  232. }
  233. $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
  234. ?>
  235. <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
  236. <div class='monster_panel'>
  237. <span class='stars'>
  238. <?php
  239. for ($i = 0; $i < $owned->stars; $i ++){
  240. ?>
  241. <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
  242. <?php
  243. }
  244. ?>
  245. </span>
  246. <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
  247. <span class='level'>
  248. <?=$owned->level?>
  249. </span>
  250. </div>
  251. </a>
  252. <?php
  253. }
  254. ?>
  255. </div><!-- .owned -->
  256. </div><!-- .product --><div class='ingredients'><!-- No newline because CSS reads it as a whitespace -->
  257. <?php
  258. $num = 0;
  259. foreach ($sub_fusion->ingredient as $sub_monster){
  260. ?>
  261. <div class='f3'>
  262. <div class='product'>
  263. <a target='_blank' title='<?=$sub_monster->name?>' href='/<?=$UID?>/catalog/<?=$sub_monster->id?>'>
  264. <div class='awakened monster_panel'>
  265. <span class='stars'>
  266. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  267. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  268. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  269. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  270. </span>
  271. <img title='<?=$sub_monster->name?>' class='monster border_<?=$sub_monster->element_name?>' src='<?=$sub_monster->get_image()?>'/>
  272. <span class='level'>
  273. 30
  274. </span>
  275. </div><!-- .awakened .monster_panel -->
  276. </a>
  277. <div class='essences'>
  278. <?php
  279. foreach ($sub_fusion->ingredient_unawaken[$num]->essences as $essence){
  280. ?>
  281. <div class='essence border_<?=$essence["element"]?>'>
  282. <img alt='<?=$essence["grade"]?> <?=$essence["element"]?> essence' title='<?=$essence["amount"]?>x <?=$essence["grade"]?> <?=$essence["element"]?> essence' class='essence' src='<?=URL::IMG["ESSENCE"]?><?=$essence["element"]?>_<?=$essence["grade"]?>.png'/>
  283. <span>
  284. <?=$essence["amount"]?>
  285. </span>
  286. </div>
  287. <?php
  288. }
  289. ?>
  290. </div><!-- .essences -->
  291. <a target='_blank' title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' href='/<?=$UID?>/catalog/<?=$sub_fusion->ingredient_unawaken[$num]->id?>'>
  292. <div class='unawakened monster_panel'>
  293. <span class='stars'>
  294. <?php
  295. for ($i = 0; $i < $sub_fusion->ingredient_unawaken[$num]->base_stars; $i ++){
  296. ?>
  297. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  298. <?php
  299. }
  300. ?>
  301. </span>
  302. <img title='<?=$sub_fusion->ingredient_unawaken[$num]->name?>' class='monster border_<?=$sub_fusion->ingredient_unawaken[$num]->element_name?>' src='<?=$sub_fusion->ingredient_unawaken[$num]->get_image()?>'/>
  303. <span class='level'>
  304. 1
  305. </span>
  306. </div><!-- .unawakened .monster_panel -->
  307. </a>
  308. <div class='owned'>
  309. <span class='owned'>
  310. Collection:
  311. </span>
  312. <?php
  313. foreach ($sub_monster->owned as $owned){
  314. if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
  315. // No to, no from, silver monster.
  316. $star_class ="star_silver";
  317. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  318. }
  319. elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
  320. // Already awakened
  321. if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
  322. // Normal awaken.
  323. $star_class ="star_purple";
  324. }
  325. else{
  326. // Second awaken.
  327. $star_class ="star_red";
  328. }
  329. $mon_title = $owned->unit->name;
  330. }
  331. elseif ($owned->unit->awakens_to != ""){
  332. // Awakeable.
  333. $star_class ="star_gold";
  334. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  335. }
  336. $mon_title = $mon_title . " - " . $owned->stars . "* - Lv." . $owned->level;
  337. ?>
  338. <a target="_blank" title='<?=$mon_title?>' href='/<?=$UID?>/monsters/<?=$owned->id?>'>
  339. <div class='monster_panel'>
  340. <span class='stars'>
  341. <?php
  342. for ($i = 0; $i < $owned->stars; $i ++){
  343. ?>
  344. <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
  345. <?php
  346. }
  347. ?>
  348. </span>
  349. <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
  350. <span class='level'>
  351. <?=$owned->level?>
  352. </span>
  353. </div>
  354. </a>
  355. <?php
  356. }
  357. ?>
  358. </div><!-- .owned -->
  359. </div><!-- product -->
  360. </div><!-- .f3 -->
  361. <?php
  362. $num ++;
  363. }
  364. ?>
  365. </div><!-- .ingredients -->
  366. </div><!-- .f4 -->
  367. <?php
  368. } // foreach ($fusion->product->owned as $owned)
  369. ?>
  370. <!-- Last ingredient, non fuseable -->
  371. <div class='f4 extra'>
  372. <div class='product'>
  373. <a target='_blank' title='<?=$fusion->ingredient[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient[0]->id?>'>
  374. <div class='awakened monster_panel'>
  375. <span class='stars'>
  376. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  377. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  378. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  379. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  380. <img class='star star_purple' src='<?=URL::IMG["ICON"]?>star.png'/>
  381. </span>
  382. <img title='<?=$fusion->ingredient[0]->name?>' class='monster border_<?=$fusion->ingredient[0]->element_name?>' src='<?=$fusion->ingredient[0]->get_image()?>'/>
  383. <span class='level'>
  384. 35
  385. </span>
  386. </div><!-- .awakened .monster_panel -->
  387. </a>
  388. <div class='essences'>
  389. <?php
  390. foreach ($fusion->ingredient_unawaken[0]->essences as $essence){
  391. ?>
  392. <div class='essence border_<?=$essence["element"]?>'>
  393. <img alt='<?=$essence["grade"]?> <?=$essence["element"]?> essence' title='<?=$essence["amount"]?>x <?=$essence["grade"]?> <?=$essence["element"]?> essence' class='essence' src='<?=URL::IMG["ESSENCE"]?><?=$essence["element"]?>_<?=$essence["grade"]?>.png'/>
  394. <span>
  395. <?=$essence["amount"]?>
  396. </span>
  397. </div>
  398. <?php
  399. }
  400. ?>
  401. </div><!-- .essences -->
  402. <a target='_blank' title='<?=$fusion->ingredient_unawaken[0]->name?>' href='/<?=$UID?>/catalog/<?=$fusion->ingredient_unawaken[0]->id?>'>
  403. <div class='unawakened monster_panel'>
  404. <span class='stars'>
  405. <?php
  406. for ($i = 0; $i < $fusion->ingredient[0]->base_stars; $i ++){
  407. ?>
  408. <img class='star star_gold' src='<?=URL::IMG["ICON"]?>star.png'/>
  409. <?php
  410. }
  411. ?>
  412. </span>
  413. <img title='<?=$fusion->ingredient_unawaken[0]->name?>' class='monster border_<?=$fusion->ingredient_unawaken[0]->element_name?>' src='<?=$fusion->ingredient_unawaken[0]->get_image()?>'/>
  414. <span class='level'>
  415. 1
  416. </span>
  417. </div><!-- .unawakened .monster_panel -->
  418. </a>
  419. <div class='owned'>
  420. <span class='owned'>
  421. Collection:
  422. </span>
  423. <?php
  424. foreach ($fusion->ingredient[0]->owned as $owned){
  425. ?>
  426. <div class='monster_panel'>
  427. <span class='stars'>
  428. <?php
  429. if ($owned->unit->awakens_from == "" && $owned->unit->awakens_to == ""){
  430. // No to, no from, silver monster.
  431. $star_class ="star_silver";
  432. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  433. }
  434. elseif ($owned->unit->awakens_from != "" && $owned->unit->awakens_to == ""){
  435. // Already awakened
  436. if ($owned->unit->base_stars - $owned->unit->natural_stars == 1){
  437. // Normal awaken.
  438. $star_class ="star_purple";
  439. }
  440. else{
  441. // Second awaken.
  442. $star_class ="star_red";
  443. }
  444. $mon_title = $owned->unit->name;
  445. }
  446. elseif ($owned->unit->awakens_to != ""){
  447. // Awakeable.
  448. $star_class ="star_gold";
  449. $mon_title = $owned->unit->element_name . " " . $owned->unit->name;
  450. }
  451. for ($i = 0; $i < $owned->stars; $i ++){
  452. ?>
  453. <img class='star <?=$star_class?>' src='<?=URL::IMG["ICON"]?>star.png'/>
  454. <?php
  455. }
  456. ?>
  457. </span>
  458. <img title='<?=$mon_title?>' class='monster border_<?=$owned->unit->element_name?>' src='<?=$owned->unit->get_image()?>'/>
  459. <span class='level'>
  460. <?=$owned->level?>
  461. </span>
  462. </div>
  463. <?php
  464. }
  465. ?>
  466. </div><!-- .owned -->
  467. </div><!-- .product -->
  468. </div><!-- .f4 -->
  469. </div><!-- .ingredients -->
  470. </div><!-- .f5 -->
  471. </article>
  472. </section>
  473. <?php
  474. } // foreach ($page->fusion as $fusion)
  475. include __DIR__ . "/inc/footer.php";
  476. ?>
  477. </body>
  478. </html>