report_rune_enchantment.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <?php
  2. /**
  3. * Rune Enchantment report view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @property_read Report_Rune_Enchantment_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?>report_rune_enchantment.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. <script>
  40. /**
  41. * Hack to treat all grindstone stat selects as one.
  42. *
  43. * @param clicked Numeric order of the select clicked.
  44. * @param event onMouseDown event.
  45. */
  46. function fixGrindStatSelect(clicked, event){
  47. if (!event.ctrlKey){
  48. console.log("NO CTRL: " + clicked);
  49. // If controll was not being held, clean all other selects
  50. if (clicked == 0){
  51. document.getElementById("filter_grind_stat_1").selectedIndex = -1;
  52. }
  53. else if (clicked == 1){
  54. document.getElementById("filter_grind_stat_0").selectedIndex = -1;
  55. }
  56. }
  57. }
  58. /**
  59. * Hack to treat all enchant stat from selects as one.
  60. *
  61. * @param clicked Numeric order of the select clicked.
  62. * @param event onMouseDown event.
  63. */
  64. function fixEnchantStatFromSelect(clicked, event){
  65. if (!event.ctrlKey){
  66. // If controll was not being held, clean all other selects
  67. if (clicked == 0){
  68. document.getElementById("filter_gem_stat_from_1").selectedIndex = -1;
  69. }
  70. else if (clicked == 1){
  71. document.getElementById("filter_gem_stat_from_0").selectedIndex = -1;
  72. }
  73. }
  74. }
  75. /**
  76. * Hack to treat all enchant stat to selects as one.
  77. *
  78. * @param clicked Numeric order of the select clicked.
  79. * @param event onMouseDown event.
  80. */
  81. function fixEnchantStatToSelect(clicked, event){
  82. if (!event.ctrlKey){
  83. // If controll was not being held, clean all other selects
  84. if (clicked == 0){
  85. document.getElementById("filter_gem_stat_to_1").selectedIndex = -1;
  86. }
  87. else if (clicked == 1){
  88. document.getElementById("filter_gem_stat_to_0").selectedIndex = -1;
  89. }
  90. }
  91. }
  92. </script>
  93. </head>
  94. <body>
  95. <?php
  96. include __DIR__ . "/inc/header.php";
  97. ?>
  98. <aside>
  99. <h2>
  100. Report filters
  101. </h2>
  102. <form action='/<?=$UID?>/report/runeenchantment/' method='get' id='filter_runeenchantment' class='filter'>
  103. <table>
  104. <tr>
  105. <td colspan='2' class='header'>
  106. Monster
  107. </td>
  108. </tr>
  109. <tr>
  110. <td class='label'>
  111. Name:
  112. <div class='help_tooltip'>
  113. <p>
  114. Units whose name contains this (case insensitive).
  115. </p>
  116. </div>
  117. </td>
  118. <td>
  119. <input type='text' name='monster_name' id='filter_name' value='<?=$page->filters["MONSTER_NAME"]?>'/>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td class='label'>
  124. Stars:
  125. </td>
  126. <td>
  127. <input type='number' name='monster_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["MONSTER_MIN_STARS"]?>'/>
  128. -
  129. <input type='number' name='monster_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["MONSTER_MAX_STARS"]?>'/>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td class='label'>
  134. Show units:
  135. </td>
  136. <td>
  137. <?php
  138. $selected = Array("", "", "", "", "");
  139. $selected[$page->filters["TEAM"]] = "selected";
  140. ?>
  141. <select name='unit'>
  142. <option value='0' <?=$selected[0]?>>All</option>
  143. <option value='1' <?=$selected[1]?>>In teams</option>
  144. <option value='2' <?=$selected[2]?>>In teams (score > 0)</option>
  145. </select>
  146. </td>
  147. </tr>
  148. <tr>
  149. <td class='label' colspan='2'>
  150. <?php
  151. $checked = "";
  152. if ($page->filters["MONSTER_IN_STORAGE"]){
  153. $checked = "checked";
  154. }
  155. ?>
  156. <input type='checkbox' name='monster_in_storage' id='filter_monster_in_storage' <?=$checked?>/>
  157. <label for='filter_monster_in_storage'>Show monsters in storage</label>
  158. </td>
  159. </tr>
  160. <tr>
  161. <td colspan='2' class='header'>
  162. Runes
  163. </td>
  164. </tr>
  165. <tr>
  166. <td class='label'>
  167. Stars:
  168. </td>
  169. <td>
  170. <input type='number' name='rune_min_stars' id='filter_stars_min' min='1' max='6' value='<?=$page->filters["RUNE_MIN_STARS"]?>'/>
  171. -
  172. <input type='number' name='rune_max_stars' id='filter_stars_max' min='1' max='6' value='<?=$page->filters["RUNE_MAX_STARS"]?>'/>
  173. </td>
  174. </tr>
  175. <tr>
  176. <td class='label'>
  177. Level:
  178. </td>
  179. <td>
  180. <input type='number' name='rune_min_level' id='filter_level_min' min='0' max='15' value='<?=$page->filters["RUNE_MIN_LEVEL"]?>'/>
  181. -
  182. <input type='number' name='rune_max_level' id='filter_level_max' min='0' max='15' value='<?=$page->filters["RUNE_MAX_LEVEL"]?>'/>
  183. </td>
  184. </tr>
  185. <tr>
  186. <td class='label'>
  187. Quality:
  188. </td>
  189. <td>
  190. <?php
  191. $selected = Array("", "", "", "", "");
  192. $selected[$page->filters["RUNE_MIN_QUALITY"] - 1] = "selected";
  193. ?>
  194. <select name='rune_min_quality' id='filter_quality_min'>
  195. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  196. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  197. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  198. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  199. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  200. </select>
  201. -
  202. <?php
  203. $selected = Array("", "", "", "", "");
  204. $selected[$page->filters["RUNE_MAX_QUALITY"] - 1] = "selected";
  205. ?>
  206. <select name='rune_max_quality' id='filter_quality_max'>
  207. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  208. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  209. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  210. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  211. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  212. </select>
  213. </td>
  214. </tr>
  215. <tr>
  216. <td class='label'>
  217. O. quality:
  218. </td>
  219. <td>
  220. <?php
  221. $selected = Array("", "", "", "", "");
  222. $selected[$page->filters["RUNE_MIN_ORIGINAL_QUALITY"] - 1] = "selected";
  223. ?>
  224. <select name='rune_min_original_quality' id='filter_original_quality_min'>
  225. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  226. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  227. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  228. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  229. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  230. </select>
  231. -
  232. <?php
  233. $selected = Array("", "", "", "", "");
  234. $selected[$page->filters["RUNE_MAX_ORIGINAL_QUALITY"] - 1] = "selected";
  235. ?>
  236. <select name='rune_max_original_quality' id='filter_original_quality_max'>
  237. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  238. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  239. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  240. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  241. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  242. </select>
  243. </td>
  244. </tr>
  245. <tr>
  246. <td class='label'>
  247. Efficiency:
  248. </td>
  249. <td>
  250. <input type='number' name='rune_min_efficiency' id='filter_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_EFFICIENCY"]?>'/>%
  251. -
  252. <input type='number' name='rune_max_efficiency' id='filter_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_EFFICIENCY"]?>'/>%
  253. </td>
  254. </tr>
  255. <tr>
  256. <td class='label'>
  257. Max. eff.:
  258. </td>
  259. <td>
  260. <input type='number' name='rune_min_max_efficiency' id='filter_max_efficiency_min' min='0' max='100' value='<?=$page->filters["RUNE_MIN_MAX_EFFICIENCY"]?>'/>%
  261. -
  262. <input type='number' name='rune_max_max_efficiency' id='filter_max_efficiency_max' min='0' max='100' value='<?=$page->filters["RUNE_MAX_MAX_EFFICIENCY"]?>'/>%
  263. </td>
  264. </tr>
  265. <tr>
  266. <td class='slot label'>
  267. Slot:
  268. </td>
  269. <td class='slot'>
  270. <select multiple name='rune_slot[]' id='filter_slot'>
  271. <?php
  272. for ($i = 1; $i <= 6; $i ++){
  273. if (in_array($i, $page->filters["RUNE_SLOT"])){
  274. $selected = "selected='selected'";
  275. }
  276. else{
  277. $selected = "";
  278. }
  279. ?>
  280. <option value='<?=$i?>' <?=$selected?>><?=$i?></option>
  281. <?php
  282. }
  283. ?>
  284. </select>
  285. </td>
  286. </tr>
  287. <tr>
  288. <td colspan='2' class='header'>
  289. <?php
  290. $checked = "";
  291. if ($page->filters["GRIND"]){
  292. $checked = "checked";
  293. }
  294. ?>
  295. <input type='checkbox' name='grind' id='filter_grind' <?=$checked?>/>
  296. <label for='filter_grind'>Grindstones</label>
  297. </td>
  298. </tr>
  299. <tr>
  300. <td class='label'>
  301. Min. quality:
  302. </td>
  303. <td>
  304. <?php
  305. $selected = Array("", "", "", "", "");
  306. $selected[$page->filters["GRIND_MIN_QUALITY"] - 1] = "selected";
  307. ?>
  308. <select name='grind_min_quality'>
  309. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  310. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  311. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  312. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  313. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  314. </select>
  315. </td>
  316. </tr>
  317. <tr>
  318. <td class='stats label'>
  319. Stats:
  320. </td>
  321. <td class='stats'>
  322. <div>
  323. <select multiple name='grind_stat[]' id='filter_grind_stat_0' onMouseDown='fixGrindStatSelect(0, event);'>
  324. <?php
  325. $reflect = new ReflectionClass("RUNE_STAT_ID");
  326. $count = 1;
  327. $i = 0;
  328. foreach($reflect->getConstants() as $name => $id){
  329. $selected = "";
  330. if (in_array($id, $page->filters["GRIND_STAT"])){
  331. $selected = "selected='selected'";
  332. }
  333. $name_format = ucwords(str_replace("_P", "%", $name));
  334. ?>
  335. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  336. <?php
  337. if (($i + 1) % 2 == 0){
  338. ?>
  339. </select><select multiple name='grind_stat[]' id='filter_grind_stat_<?=$count?>' onMouseDown='fixGrindStatSelect(<?=$count?>, event);'>
  340. <?php
  341. $count ++;
  342. }
  343. $i ++;
  344. }
  345. ?>
  346. </select>
  347. </div>
  348. </td>
  349. </tr>
  350. <tr>
  351. <td colspan='2' class='header'>
  352. <?php
  353. $checked = "";
  354. if ($page->filters["GEM"]){
  355. $checked = "checked";
  356. }
  357. ?>
  358. <input type='checkbox' name='gem' id='filter_gem' <?=$checked?>/>
  359. <label for='filter_gem'>Gems</label>
  360. </td>
  361. </tr>
  362. <tr>
  363. <td class='label'>
  364. Min. quality:
  365. </td>
  366. <td>
  367. <?php
  368. $selected = Array("", "", "", "", "");
  369. $selected[$page->filters["GEM_MIN_QUALITY"] - 1] = "selected";
  370. ?>
  371. <select name='gem_min_quality'>
  372. <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
  373. <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
  374. <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
  375. <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
  376. <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
  377. </select>
  378. </td>
  379. </tr>
  380. <tr>
  381. <td class='stats label'>
  382. Replace...
  383. </td>
  384. <td class='stats'>
  385. <div>
  386. <select multiple name='gem_stat_from[]' id='filter_gem_stat_from_0' onMouseDown='fixEnchantStatFromSelect(0, event);'>
  387. <?php
  388. $reflect = new ReflectionClass("RUNE_STAT_ID");
  389. $count = 1;
  390. $i = 0;
  391. foreach($reflect->getConstants() as $name => $id){
  392. $selected = "";
  393. if (in_array($id, $page->filters["GEM_STAT_FROM"])){
  394. $selected = "selected='selected'";
  395. }
  396. $name_format = ucwords(str_replace("_P", "%", $name));
  397. ?>
  398. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  399. <?php
  400. if (($i + 1) % 2 == 0){
  401. ?>
  402. </select><select multiple name='gem_stat_from[]' id='filter_gem_stat_from_<?=$count?>' onMouseDown='fixEnchantStatFromSelect(<?=$count?>, event);'>
  403. <?php
  404. $count ++;
  405. }
  406. $i ++;
  407. }
  408. ?>
  409. </select>
  410. </div>
  411. </td>
  412. </tr>
  413. <tr>
  414. <td class='stats label'>
  415. ...with:
  416. </td>
  417. <td class='stats'>
  418. <div>
  419. <select multiple name='gem_stat_from[]' id='filter_gem_stat_to_0' onMouseDown='fixEnchantStatToSelect(0, event);'>
  420. <?php
  421. $reflect = new ReflectionClass("RUNE_STAT_ID");
  422. $count = 1;
  423. $i = 0;
  424. foreach($reflect->getConstants() as $name => $id){
  425. $selected = "";
  426. if (in_array($id, $page->filters["GEM_STAT_TO"])){
  427. $selected = "selected='selected'";
  428. }
  429. $name_format = ucwords(str_replace("_P", "%", $name));
  430. ?>
  431. <option value='<?=$id?>' <?=$selected?>><?=$name_format?></option>
  432. <?php
  433. if (($i + 1) % 2 == 0){
  434. ?>
  435. </select><select multiple name='gem_stat_to[]' id='filter_gem_stat_to_<?=$count?>' onMouseDown='fixEnchantStatToSelect(<?=$count?>, event);'>
  436. <?php
  437. $count ++;
  438. }
  439. $i ++;
  440. }
  441. ?>
  442. </select>
  443. </td>
  444. </td>
  445. </tr>
  446. </table>
  447. <input type='submit' value='Apply'/>
  448. </form>
  449. </aside>
  450. <main>
  451. <section id='results' class='content'>
  452. <h2>
  453. <span>
  454. <?=$upgrade["unit"]->title?>
  455. </span>
  456. </h2>
  457. <table id='results'>
  458. <?php
  459. foreach ($page->upgrades as $upgrade){
  460. ?>
  461. <tr>
  462. <td class='header' colspan='2'>
  463. <a href='/<?=$UID?>/monsters/<?=$unit->id?>/' target='_blank'>
  464. <div class='monster_panel'>
  465. <?=HTML::unit_panel($upgrade["unit"])?>
  466. </div>
  467. </a>
  468. <h4>
  469. <?=$upgrade["unit"]->title?>
  470. </h4>
  471. </td>
  472. </tr>
  473. <?php
  474. foreach ($upgrade["upgrade"] as $rupgrade){
  475. ?>
  476. <tr>
  477. <td class='rune'>
  478. <?=HTML::rune_table($rupgrade["rune"])?>
  479. </td>
  480. <td class='upgrades'>
  481. <?php
  482. foreach ($rupgrade["enchantment"] as $enchantment){
  483. ?>
  484. <?=HTML::enchantment_panel($enchantment)?>
  485. <?php
  486. }
  487. ?>
  488. </td>
  489. </tr>
  490. <?php
  491. }
  492. }
  493. ?>
  494. </table>
  495. </section>
  496. </main>
  497. <?php
  498. include __DIR__ . "/inc/footer.php";
  499. ?>
  500. </body>
  501. </html>