report_rune_enchantment.php 24 KB

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