teams.php 40 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. <?php
  2. /**
  3. * Teamss view.
  4. *
  5. * Contains the view layout and ome code to present the data.
  6. *
  7. * @category View
  8. * @property_read Teams_Page $page The page model.
  9. * @property_read int $page Player 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?>teams.css'/>
  22. <link rel='stylesheet' type='text/css' href='<?=URL::CSS?>filters.css'/>
  23. <!-- Meta tags -->
  24. <link rel='canonical' href='<?=$page->canonical?>'/>
  25. <link rel='author' href='<?=$page->author?>'/>
  26. <link rel='publisher' href='<?=$page->author?>'/>
  27. <meta name='description' content='<?=$page->description?>'/>
  28. <meta property='og:title' content='<?=$page->title?>'/>
  29. <meta property='og:url' content='<?=$page->canonical?>'/>
  30. <meta property='og:description' content='<?=$page->description?>'/>
  31. <meta property='og:image' content='<?=$page->icon?>'/>
  32. <meta property='og:site_name' content='<?=$page->name?>'/>
  33. <meta property='og:type' content='website'/>
  34. <meta property='og:locale' content='en'/>
  35. <meta name='twitter:card' content='summary'/>
  36. <meta name='twitter:title' content='<?=$page->title?>'/>
  37. <meta name='twitter:description' content='<?=$page->description?>'/>
  38. <meta name='twitter:image' content='<?=$page->icon?>'/>
  39. <meta name='twitter:url' content='<?=$page->canonical?>'/>
  40. <meta name='robots' content='index follow'/>
  41. <script>
  42. units = [];
  43. max_units = 0;
  44. selected_units = 0;
  45. selected_ids = [];
  46. <?php
  47. foreach ($page->units as $unit){
  48. ?>
  49. units.push(
  50. {
  51. id: <?=$unit->id?>,
  52. name: "<?=$unit->title?>",
  53. stars: <?=$unit->stars?>,
  54. level: <?=$unit->level?>,
  55. image: '<?=$unit->unit->get_image()?>',
  56. awakens_from: '<?=$unit->unit->awakens_from?>',
  57. awakens_to: '<?=$unit->unit->awakens_to?>',
  58. element: '<?=$unit->unit->element_name?>'
  59. }
  60. );
  61. <?php
  62. }
  63. ?>
  64. /**
  65. * Shows or hiddes the new team panel.
  66. *
  67. * @param show True to show, false to hide.
  68. */
  69. function showNewTeam(show){
  70. if (show === true){
  71. document.getElementById('new_team').style.display = 'block';
  72. }
  73. else{
  74. document.getElementById('new_team').style.display = 'none';
  75. }
  76. }
  77. function saveTeam(){
  78. if (selected_units > max_units){
  79. alert('Too many units selected.');
  80. return;
  81. }
  82. var name = document.getElementById('new_team_name').value;
  83. var description = document.getElementById('new_team_description').value;
  84. var area_type = document.getElementById('new_area_type').options[document.getElementById('new_area_type').selectedIndex].value;
  85. var area = null;
  86. var difficulty = null;
  87. var stage = null;
  88. switch (area_type){
  89. case '<?=AREA_TYPE_ID::SCENARIO?>':
  90. area = document.getElementById('new_area_scenario').options[document.getElementById('new_area_scenario').selectedIndex].value;
  91. difficulty = document.getElementById('new_area_difficulty').options[document.getElementById('new_area_difficulty').selectedIndex].value;
  92. stage = document.getElementById('new_area_stage').options[document.getElementById('new_area_stage').selectedIndex].value;
  93. break;
  94. case '<?=AREA_TYPE_ID::CAIROS_DUNGEON?>':
  95. area = document.getElementById('new_area_cairos_dungeon').options[document.getElementById('new_area_cairos_dungeon').selectedIndex].value;
  96. stage = document.getElementById('new_area_stage').options[document.getElementById('new_area_stage').selectedIndex].value;
  97. break;
  98. case '<?=AREA_TYPE_ID::RIFT_DUNGEON?>':
  99. area = document.getElementById('new_area_rift_dungeon').options[document.getElementById('new_area_rift_dungeon').selectedIndex].value;
  100. break;
  101. case '<?=AREA_TYPE_ID::RIFT_RAID?>':
  102. //area = document.getElementById('new_area_rift_raid').options[document.getElementById('new_area_rift_raid').selectedIndex].value;
  103. stage = document.getElementById('new_area_stage').options[document.getElementById('new_area_stage').selectedIndex].value;
  104. area = stage;
  105. break;
  106. case '<?=AREA_TYPE_ID::ARENA?>':
  107. break;
  108. case '<?=AREA_TYPE_ID::GUILD_WAR?>':
  109. break;
  110. case '<?=AREA_TYPE_ID::GUILD_SIEGE?>':
  111. break;
  112. case '<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>':
  113. area = <?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>;
  114. difficulty = document.getElementById('new_area_difficulty').options[document.getElementById('new_area_difficulty').selectedIndex].value;
  115. stage = document.getElementById('new_area_tartarus_labyrinth').options[document.getElementById('new_area_tartarus_labyrinth').selectedIndex].value;
  116. break;
  117. case '<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>':
  118. area = <?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>;
  119. difficulty = document.getElementById('new_area_difficulty').options[document.getElementById('new_area_difficulty').selectedIndex].value;
  120. break;
  121. case '<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>':
  122. area = document.getElementById('new_area_dimensional_hole').options[document.getElementById('new_area_dimensional_hole').selectedIndex].value;
  123. stage = document.getElementById('new_area_stage').options[document.getElementById('new_area_stage').selectedIndex].value;
  124. break;
  125. case '<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>':
  126. difficulty = document.getElementById('new_area_difficulty').options[document.getElementById('new_area_difficulty').selectedIndex].value;
  127. break;
  128. default:
  129. alert('Unknown Area');
  130. return;
  131. }
  132. if (!Number.isInteger(parseInt(area))){
  133. area = 0;
  134. }
  135. if (!Number.isInteger(parseInt(stage))){
  136. stage = 0;
  137. }
  138. if (!Number.isInteger(parseInt(difficulty))){
  139. difficulty = 0;
  140. }
  141. var ids = selected_ids.join(',');
  142. var xhttp = new XMLHttpRequest();
  143. xhttp.onreadystatechange = function() {
  144. if (this.readyState == 4){
  145. if (this.status == 200){
  146. location.reload();
  147. }
  148. else{
  149. showError('Error saving team. HTTP status ' + this.status)
  150. }
  151. }
  152. };
  153. xhttp.open("POST", "/action/new_team/", true);
  154. xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  155. xhttp.send('uid=<?=$UID?>&ids=' + ids + '&area_type=' + area_type + '&area=' + area + '&difficulty=' + difficulty + '&stage=' + stage + '&name=' + encodeURI(name) + '&description=' + encodeURI(description));
  156. }
  157. /**
  158. * Searches a unit with the pattern entered in the 'new_unit_id'
  159. * field. Shows a clickable list of matching units.
  160. */
  161. function searchUnit(){
  162. key = document.getElementById('new_unit_id').value;
  163. var autocomplete = document.getElementById('new_unit_autocomplete');
  164. while (autocomplete.firstChild) {
  165. autocomplete.removeChild(autocomplete.firstChild);
  166. }
  167. if (key.length == 0){
  168. autocomplete.style.display = 'none';
  169. }
  170. for (var i = 0; i < units.length; i++) {
  171. if (units[i].name.toUpperCase().includes(key.toUpperCase())){
  172. autocomplete.style.display = 'block';
  173. var line = document.createElement('div');
  174. var img = document.createElement('img');
  175. img.setAttribute('src', units[i].image);
  176. var nam = document.createElement('span');
  177. var tex = document.createTextNode(units[i].name + '(' + units[i].stars + '*, Lv. ' + units[i].level + ')');
  178. nam.appendChild(tex);
  179. line.appendChild(img);
  180. line.appendChild(nam);
  181. sid = units[i].id;
  182. line.setAttribute('onclick', 'selectUnit(' + sid + ');');
  183. autocomplete.appendChild(line);
  184. }
  185. }
  186. }
  187. /**
  188. * Selects a unit from the list and adds it to the new team.
  189. * The search list is hidden afterwards.
  190. *
  191. * @param id Unit id.
  192. */
  193. function selectUnit(id){
  194. var name = null;
  195. var stars = null;
  196. var level = null;
  197. var image = null;
  198. var element = null;
  199. var awakens_from = null;
  200. var awakens_to = null;
  201. for (var i = 0; i < units.length; i ++) {
  202. if (units[i].id == id){
  203. name = units[i].name;
  204. stars = units[i].stars;
  205. level = units[i].level;
  206. image = units[i].image;
  207. element = units[i].element;
  208. break;
  209. }
  210. }
  211. if (name != null){
  212. var monsterPanel = document.createElement('div');
  213. monsterPanel.setAttribute('class', 'monster_panel');
  214. monsterPanel.setAttribute('id', 'monster_panel_' + id);
  215. monsterPanel.setAttribute('onclick', 'deleteUnit(' + id + ')');
  216. var monsterStars = document.createElement('span');
  217. monsterStars.setAttribute('class', 'stars');
  218. for (var i = 0; i < stars; i ++){
  219. var star = document.createElement('img');
  220. // TODO: Handle star color.
  221. star.setAttribute('class', 'star star_purple');
  222. star.setAttribute('src', '<?=URL::IMG["ICON"]?>star.png');
  223. monsterStars.appendChild(star);
  224. }
  225. var monsterImage = document.createElement('img');
  226. monsterImage.setAttribute('class', 'monster border_' + element);
  227. monsterImage.setAttribute('src', image);
  228. var monsterLevel = document.createElement('span');
  229. monsterLevel.setAttribute('class', 'level');
  230. monsterLevel.appendChild(document.createTextNode(level));
  231. monsterPanel.appendChild(monsterStars);
  232. monsterPanel.appendChild(monsterImage);
  233. monsterPanel.appendChild(monsterLevel);
  234. var teamPanel = document.getElementById('new_team_units');
  235. teamPanel.appendChild(monsterPanel);
  236. // Hide the selector
  237. var autocomplete = document.getElementById('new_unit_autocomplete');
  238. while (autocomplete.firstChild) {
  239. autocomplete.removeChild(autocomplete.firstChild);
  240. }
  241. autocomplete.style.display = 'none';
  242. document.getElementById('new_unit_id').value = '';
  243. selected_units ++;
  244. if (selected_units >= max_units){
  245. document.getElementById('new_unit').style.display = 'none';
  246. }
  247. else{
  248. document.getElementById('new_unit').style.display = 'block';
  249. }
  250. selected_ids.push(id);
  251. }
  252. }
  253. /**
  254. * Deletes a unit from the new team form.
  255. *
  256. * @param id Unit id.
  257. */
  258. function deleteUnit(id){
  259. var position = -1;
  260. for (var i = 0; i < units.length; i ++) {
  261. if (units[i].id == id){
  262. position = i;
  263. break;
  264. }
  265. }
  266. if (position >= 0 && position < units.length){
  267. units.splice(position, 1);
  268. document.getElementById('new_team_units').removeChild(document.getElementById('monster_panel_' + id));
  269. selected_units --;
  270. if (selected_units >= max_units){
  271. document.getElementById('new_unit').style.display = 'none';
  272. }
  273. else{
  274. document.getElementById('new_unit').style.display = 'block';
  275. }
  276. }
  277. }
  278. /**
  279. * Shows the stage selector in the new team panel.
  280. *
  281. * @param total The number of stages to show.
  282. */
  283. function populateStage(total){
  284. var sel = document.getElementById('new_area_stage');
  285. while (sel.firstChild) {
  286. sel.removeChild(sel.firstChild);
  287. }
  288. var opt;
  289. var att;
  290. // Empty
  291. opt = document.createElement('option');
  292. tex = document.createTextNode('');
  293. opt.appendChild(tex);
  294. sel.appendChild(opt);
  295. for (var i = 1; i <= total; i ++){
  296. opt = document.createElement('option');
  297. tex = document.createTextNode('Stage ' + i);
  298. att = document.createAttribute('value');
  299. att.value = i;
  300. opt.setAttributeNode(att);
  301. opt.appendChild(tex);
  302. sel.appendChild(opt);
  303. }
  304. }
  305. /**
  306. * Shows the difficulty selector in the new team panel.
  307. *
  308. * @param labyrinth Indicates if the area type is the Tartarus
  309. * labyrinth. If so, it includes 'Easy'.
  310. * @param toa Indicates if the area type is the Tower of
  311. * Ascension. If so, it excludes 'Hell'.
  312. */
  313. function populateDifficulty(labyrinth = false, toa = false){
  314. var sel = document.getElementById('new_area_difficulty');
  315. while (sel.firstChild) {
  316. sel.removeChild(sel.firstChild);
  317. }
  318. var opt;
  319. var att;
  320. var tex;
  321. // Empty
  322. opt = document.createElement('option');
  323. tex = document.createTextNode('');
  324. opt.appendChild(tex);
  325. sel.appendChild(opt);
  326. // Easy (Labyrinth only)
  327. if (labyrinth){
  328. opt = document.createElement('option');
  329. tex = document.createTextNode('Easy difficulty');
  330. att = document.createAttribute('value');
  331. att.value = '<?=DIFFICULTY_ID::EASY?>';
  332. opt.setAttributeNode(att);
  333. opt.appendChild(tex);
  334. sel.appendChild(opt);
  335. }
  336. // Normal
  337. opt = document.createElement('option');
  338. tex = document.createTextNode('Normal difficulty');
  339. att = document.createAttribute('value');
  340. att.value = '<?=DIFFICULTY_ID::NORMAL?>';
  341. opt.setAttributeNode(att);
  342. opt.appendChild(tex);
  343. sel.appendChild(opt);
  344. // Hard
  345. opt = document.createElement('option');
  346. tex = document.createTextNode('Hard difficulty');
  347. att = document.createAttribute('value');
  348. att.value = '<?=DIFFICULTY_ID::HARD?>';
  349. opt.setAttributeNode(att);
  350. opt.appendChild(tex);
  351. sel.appendChild(opt);
  352. // Hell
  353. if (!toa){
  354. opt = document.createElement('option');
  355. tex = document.createTextNode('Hell difficulty');
  356. att = document.createAttribute('value');
  357. att.value = '<?=DIFFICULTY_ID::HELL?>';
  358. opt.setAttributeNode(att);
  359. opt.appendChild(tex);
  360. sel.appendChild(opt);
  361. }
  362. }
  363. /**
  364. * Shows the appropiate area selector when the area type is
  365. * selected in the new team panel.
  366. */
  367. function selectNewAreaType(){
  368. var type = document.getElementById('new_area_type').options[document.getElementById('new_area_type').selectedIndex].value;
  369. document.getElementById('new_area_scenario').style.display = 'none';
  370. document.getElementById('new_area_scenario').selectedIndex = 0;
  371. document.getElementById('new_area_cairos_dungeon').style.display = 'none';
  372. document.getElementById('new_area_cairos_dungeon').selectedIndex = 0;
  373. document.getElementById('new_area_rift_dungeon').style.display = 'none';
  374. document.getElementById('new_area_rift_dungeon').selectedIndex = 0;
  375. document.getElementById('new_area_tartarus_labyrinth').style.display = 'none';
  376. document.getElementById('new_area_tartarus_labyrinth').selectedIndex = 0;
  377. document.getElementById('new_area_dimensional_hole').style.display = 'none';
  378. document.getElementById('new_area_dimensional_hole').selectedIndex = 0;
  379. document.getElementById('new_area_difficulty').style.display = 'none';
  380. document.getElementById('new_area_difficulty').selectedIndex = 0;
  381. document.getElementById('new_area_stage').style.display = 'none';
  382. document.getElementById('new_area_stage').selectedIndex = 0;
  383. switch (type){
  384. case '<?=AREA_TYPE_ID::SCENARIO?>':
  385. document.getElementById('new_area_scenario').style.display = 'inline';
  386. max_units = 4;
  387. break;
  388. case '<?=AREA_TYPE_ID::CAIROS_DUNGEON?>':
  389. document.getElementById('new_area_cairos_dungeon').style.display = 'inline';
  390. max_units = 5;
  391. break;
  392. case '<?=AREA_TYPE_ID::RIFT_DUNGEON?>':
  393. document.getElementById('new_area_rift_dungeon').style.display = 'inline';
  394. max_units = 6;
  395. break;
  396. case '<?=AREA_TYPE_ID::RIFT_RAID?>':
  397. //document.getElementById('new_area_rift_raid').style.display = 'inline';
  398. populateStage(5);
  399. document.getElementById('new_area_stage').style.display = 'inline';
  400. max_units = 6
  401. break;
  402. case '<?=AREA_TYPE_ID::ARENA?>':
  403. max_units = 4;
  404. //document.getElementById('new_area_arena').style.display = 'inline';
  405. break;
  406. case '<?=AREA_TYPE_ID::GUILD_WAR?>':
  407. max_units = 3;
  408. document.getElementById('new_area_guild_war').style.display = 'inline';
  409. break;
  410. case '<?=AREA_TYPE_ID::GUILD_SIEGE?>':
  411. max_units = 3;
  412. document.getElementById('new_area_guild_siege').style.display = 'inline';
  413. break;
  414. case '<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>':
  415. max_units = 5;
  416. document.getElementById('new_area_tartarus_labyrinth').style.display = 'inline';
  417. break;
  418. case '<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>':
  419. max_units = 5;
  420. document.getElementById('new_area_difficulty').style.display = 'inline';
  421. populateDifficulty(false, true);
  422. break;
  423. case '<?=AREA_TYPE_ID::WORLD_BOSS?>':
  424. //max_units = 5;
  425. //document.getElementById('new_area_world_boss').style.display = 'inline';
  426. break;
  427. case '<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>':
  428. max_units = 4;
  429. document.getElementById('new_area_dimensional_hole').style.display = 'inline';
  430. break;
  431. case '<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>':
  432. max_units = 5;
  433. //document.getElementById('new_area_dimensional_rift').style.display = 'inline';
  434. break;
  435. }
  436. if (selected_units >= max_units || type == ''){
  437. document.getElementById('new_unit').style.display = 'none';
  438. }
  439. else{
  440. document.getElementById('new_unit').style.display = 'block';
  441. }
  442. }
  443. /**
  444. * Populates the difficulty and stage selectors when an area is
  445. * selected in the new team panel.
  446. */
  447. function selectNewArea(){
  448. var type = document.getElementById('new_area_type').options[document.getElementById('new_area_type').selectedIndex].value;
  449. document.getElementById('new_area_stage').selectedIndex = 0;
  450. document.getElementById('new_area_difficulty').selectedIndex = 0;
  451. document.getElementById('new_area_stage').style.display = 'none';
  452. document.getElementById('new_area_difficulty').style.display = 'none';
  453. switch (type){
  454. case '<?=AREA_TYPE_ID::SCENARIO?>':
  455. document.getElementById('new_area_stage').style.display = 'inline';
  456. document.getElementById('new_area_difficulty').style.display = 'inline';
  457. populateStage(7);
  458. populateDifficulty();
  459. break;
  460. case '<?=AREA_TYPE_ID::CAIROS_DUNGEON?>':
  461. document.getElementById('new_area_stage').style.display = 'inline';
  462. populateStage(10);
  463. populateDifficulty();
  464. break;
  465. case '<?=AREA_TYPE_ID::RIFT_DUNGEON?>':
  466. break;
  467. case '<?=AREA_TYPE_ID::RIFT_RAID?>':
  468. document.getElementById('new_area_stage').style.display = 'inline';
  469. populateStage(5);
  470. break;
  471. case '<?=AREA_TYPE_ID::ARENA?>':
  472. break;
  473. case '<?=AREA_TYPE_ID::GUILD_WAR?>':
  474. break;
  475. case '<?=AREA_TYPE_ID::GUILD_SIEGE?>':
  476. break;
  477. case '<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>':
  478. document.getElementById('new_area_difficulty').style.display = 'inline';
  479. populateDifficulty(true, false);
  480. break;
  481. case '<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>':
  482. document.getElementById('new_area_difficulty').style.display = 'inline';
  483. populateDifficulty(false, true);
  484. break;
  485. case '<?=AREA_TYPE_ID::WORLD_BOSS?>':
  486. break;
  487. case '<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>':
  488. document.getElementById('new_area_stage').style.display = 'inline';
  489. populateStage(5);
  490. break;
  491. case '<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>':
  492. break;
  493. }
  494. }
  495. /**
  496. * Shows or hiddes the filters panel.
  497. */
  498. function toggleFilters(){
  499. var content = document.getElementById('filters_content');
  500. var slid = document.getElementById('filters_slid');
  501. if (content.style.maxHeight != '30em'){
  502. content.style.maxHeight = '30em';
  503. slid.style.transform = 'rotate(90deg)';
  504. }
  505. else{
  506. content.style.maxHeight = '0px';
  507. slid.style.transform = 'rotate(0deg)';
  508. }
  509. };
  510. /**
  511. * Closes the error dialog.
  512. */
  513. function closeError(){
  514. document.getElementById('error').style.display = 'none';
  515. }
  516. /**
  517. * Opens the error dialog with theselected text.
  518. */
  519. function showError(text){
  520. document.getElementById('error_msg').innerHTML = text;
  521. document.getElementById('error').style.display = 'block';
  522. }
  523. </script>
  524. </head>
  525. <body>
  526. <?php
  527. include __DIR__ . "/inc/header.php";
  528. ?>
  529. <section class='filters'>
  530. <h2 id='filters_title' onClick='toggleFilters();'>
  531. <img id='filters_slid' id='filters_slid' alt=' ' src='<?=URL::IMG["ICON"]?>slid.png'/>
  532. Team filters
  533. </h2>
  534. <article id='filters_content'>
  535. <?php
  536. $filters = $page->filters;
  537. include __DIR__ . "/inc/filter_teams.php";
  538. ?>
  539. </article>
  540. </section> <!-- #filters -->
  541. <section class='list'>
  542. <h2>
  543. Teams
  544. </h2>
  545. <article>
  546. <table id='teams'>
  547. <tr>
  548. <th>
  549. Team
  550. </th>
  551. <th>
  552. Description
  553. </th>
  554. <th>
  555. Units
  556. </th>
  557. </tr>
  558. <?php
  559. $odd = "odd";
  560. foreach ($page->teams as $team){
  561. ?>
  562. <tr>
  563. <td class='team <?=$odd?>'>
  564. <h4>
  565. <img title='<?=$team->area->name?>' class='area' src='<?=$team->area->get_image($team->stage)?>'/>
  566. <?php
  567. if ($team->stage > 0 && $team->area->type != AREA_TYPE_ID::TARTARUS_LABYRINTH){
  568. ?>
  569. <span class='stage'><?=$team->stage?></span>
  570. <?php
  571. }
  572. ?>
  573. <span class='team_name'><?=$team->name?></span>
  574. </h4>
  575. </td>
  576. <td class='description <?=$odd?>'>
  577. <?=$team->description?>
  578. </td>
  579. <td class='units <?=$odd?>'>
  580. <?php
  581. $prev_front = false;
  582. $front = "undefined";
  583. foreach ($team->unit as $unit){
  584. $front = in_array($unit->id, $team->frontline);
  585. if ($front != "undefined" && $prev_front != $front){
  586. ?>
  587. <hr class='frontline'/>
  588. <?php
  589. }
  590. ?>
  591. <a href='/<?=$UID?>/monsters/<?=$unit->id?>'>
  592. <div class='monster_panel'>
  593. <?=HTML::unit_panel($unit)?>
  594. <?php
  595. if ($unit->id == $team->leader){
  596. ?>
  597. <img alt='Leader' class='leader' src='<?=URL::IMG["ICON"]?>leader.png'/>
  598. <?php
  599. }
  600. ?>
  601. </div>
  602. </a>
  603. <?php
  604. $prev_front = $front;
  605. }
  606. ?>
  607. </td>
  608. </tr>
  609. <?php
  610. if ($odd == ""){
  611. $odd = "odd";
  612. }
  613. else{
  614. $odd = "";
  615. }
  616. }
  617. ?>
  618. </table>
  619. <input type='button' onClick='showNewTeam(true);' value='New Team'/>
  620. </article>
  621. </section> <!-- .list -->
  622. <?php
  623. include __DIR__ . "/inc/footer.php";
  624. ?>
  625. <section id='new_team' class='content'>
  626. <h2>
  627. New team
  628. </h2>
  629. <article>
  630. <table>
  631. <tr>
  632. <td class='new_title'>
  633. Area
  634. </td>
  635. <td class='new_values' id='new_values_area'>
  636. <select id='new_area_type' name='new_area_type' onChange='selectNewAreaType();'>
  637. <option value=''> </option>
  638. <option value='<?=AREA_TYPE_ID::SCENARIO?>'>Scenario</option>
  639. <option value='<?=AREA_TYPE_ID::CAIROS_DUNGEON?>'>Cairos Dungeon</option>
  640. <option value='<?=AREA_TYPE_ID::RIFT_DUNGEON?>'>Rift Dungeon</option>
  641. <option value='<?=AREA_TYPE_ID::RIFT_RAID?>'>Rift Raid</option>
  642. <option value='<?=AREA_TYPE_ID::DIMENSIONAL_HOLE?>'>Dimensional Hole</option>
  643. <option value='<?=AREA_TYPE_ID::ARENA?>'>Arena</option>
  644. <option value='<?=AREA_TYPE_ID::GUILD_WAR?>'>Guild War</option>
  645. <option value='<?=AREA_TYPE_ID::GUILD_SIEGE?>'>Guild Siege</option>
  646. <option value='<?=AREA_TYPE_ID::TARTARUS_LABYRINTH?>'>Tartarus Labyrinth</option>
  647. <option value='<?=AREA_TYPE_ID::TRIAL_OF_ASCENSION?>'>Trial of Ascension</option>
  648. <!--<option value='<?=AREA_TYPE_ID::WORLD_BOSS?>'>World Boss</option>-->
  649. <option value='<?=AREA_TYPE_ID::DIMENSIONAL_RIFT?>'>Dimensinal Rift</option>
  650. </select>
  651. <select id='new_area_scenario' class='new_area' onChange='selectNewArea();'>
  652. <option value=''> </option>
  653. <option value='<?=SCENARIO_ID::GAREN_FOREST?>'>Garen Forest</option>
  654. <option value='<?=SCENARIO_ID::MT_SIZ?>'>Mt. Siz</option>
  655. <option value='<?=SCENARIO_ID::KABIR_RUINS?>'>Kabir Ruins</option>
  656. <option value='<?=SCENARIO_ID::MT_WHITE_RAGON?>'>Mt. White Ragon</option>
  657. <option value='<?=SCENARIO_ID::TELAIN_FOREST?>'>Telain Forest</option>
  658. <option value='<?=SCENARIO_ID::HYDENI_RUINS?>'>Hydeni Ruins</option>
  659. <option value='<?=SCENARIO_ID::TAMOR_DESERT?>'>Tamor Desert</option>
  660. <option value='<?=SCENARIO_ID::VROFAGUS_RUINS?>'>Vrofagus Ruins</option>
  661. <option value='<?=SCENARIO_ID::FAIMON_VOLCANO?>'>Faimon Volcano</option>
  662. <option value='<?=SCENARIO_ID::AIDEN_FOREST?>'>Aiden Forest</option>
  663. <option value='<?=SCENARIO_ID::FERUN_CASTLE?>'>Ferun Castle</option>
  664. <option value='<?=SCENARIO_ID::MT_RUNAR?>'>Mt. Runar</option>
  665. <option value='<?=SCENARIO_ID::CHIRUKA_REMAINS?>'>Charuca Remains</option>
  666. </select>
  667. <select id='new_area_cairos_dungeon' class='new_area' onChange='selectNewArea();'>
  668. <option value=''> </option>
  669. <option value='<?=DUNGEON_ID::GIANTS_KEEP?>'>Giant&#39;s Keep</option>
  670. <option value='<?=DUNGEON_ID::DRAGONS_LAIR?>'>Dragon&#39;s Lair</option>
  671. <option value='<?=DUNGEON_ID::NECROPOLIS?>'>Necropolis</option>
  672. <option value='<?=DUNGEON_ID::HALL_OF_MAGIC?>'>Hall of Magic</option>
  673. <option value='<?=DUNGEON_ID::HALL_OF_FIRE?>'>Hall of Fire</option>
  674. <option value='<?=DUNGEON_ID::HALL_OF_WATER?>'>Hall of Water</option>
  675. <option value='<?=DUNGEON_ID::HALL_OF_WIND?>'>Hall of Wind</option>
  676. <option value='<?=DUNGEON_ID::HALL_OF_LIGHT?>'>Hall of Light</option>
  677. <option value='<?=DUNGEON_ID::HALL_OF_DARK?>'>Hall of Dark</option>
  678. </select>
  679. <select id='new_area_rift_dungeon' class='new_area' onChange='selectNewArea();'>
  680. <option value=''> </option>
  681. <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::FIRE_BEAST?>'>Fire Beast</option>
  682. <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::ICE_BEAST?>'>Ice Beast</option>
  683. <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::WIND_BEAST?>'>Wind Beast</option>
  684. <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::LIGHT_BEAST?>'>Light Beast</option>
  685. <option value='<?=ELEMENTAL_RIFT_DUNGEON_ID::DARK_BEAST?>'>Dark Beast</option>
  686. </select>
  687. <select id='new_area_dimensional_hole' class='new_area' onChange='selectNewArea();'>
  688. <option value=''> </option>
  689. <option value='<?=DUNGEON_ID::FOREST_OF_ROARING_BEASTS?>'>Forest or Roaring Beasts</option>
  690. <option value='<?=DUNGEON_ID::KARZHAN_REMAINS_WARBEAR?>'>Karzhan Remains (Warbear)</option>
  691. <option value='<?=DUNGEON_ID::KARZHAN_REMAINS_WARBEAR?>'>Karzhan Remains (Inugami)</option>
  692. <option value='<?=DUNGEON_ID::SANCTUARY_OF_DREAMING_FAIRIES?>'>Sanctuary of Dreaming Fairies</option>
  693. <option value='<?=DUNGEON_ID::ELLUNIA_REMAINS_FAIRY?>'>Ellunia Remains (Fairy)</option>
  694. <option value='<?=DUNGEON_ID::ELLUNIA_REMAINS_PIXIE?>'>Ellunia Remains (Pixie)</option>
  695. <option value='<?=DUNGEON_ID::CLIFF_OF_TOUGH_BEASTS_MEN?>'>cliff of Tough Beasts Men</option>
  696. <option value='<?=DUNGEON_ID::LUMEL_REMAINS_WEREWOLF?>'>Lumel Remains (Werewolf)</option>
  697. <option value='<?=DUNGEON_ID::LUMEL_REMAINS_MARTIAL_CAT?>'>Lumel Remains (Martial Cat)</option>
  698. </select>
  699. <select id='new_area_tartarus_labyrinth' class='new_area' onChange='selectNewArea();'>
  700. <option value=''> </option>
  701. <option value='<?=LABYRINTH_STAGES_ID::TARTARUS?>'>Tartarus</option>
  702. <option value='<?=LABYRINTH_STAGES_ID::KOTTOS?>'>Kottos</option>
  703. <option value='<?=LABYRINTH_STAGES_ID::LEOS?>'>Leos</option>
  704. <option value='<?=LABYRINTH_STAGES_ID::AQUILES?>'>Aquiles</option>
  705. <option value='<?=LABYRINTH_STAGES_ID::NORMAL?>'>Normal Stage</option>
  706. <option value='<?=LABYRINTH_STAGES_ID::RESCUE?>'>Rescue Stage</option>
  707. <option value='<?=LABYRINTH_STAGES_ID::EXPLODE?>'>Explode Stage</option>
  708. <option value='<?=LABYRINTH_STAGES_ID::COOL_TIME?>'>Cool Time Stage</option>
  709. <option value='<?=LABYRINTH_STAGES_ID::SPEED_LIMIT?>'>Speed Limit Stage</option>
  710. <option value='<?=LABYRINTH_STAGES_ID::TIME_LIMIT?>'>Time Limit Stage</option>
  711. </select>
  712. <select id='new_area_difficulty'>
  713. </select>
  714. <select id='new_area_stage'>
  715. </select>
  716. </td>
  717. </tr>
  718. <tr>
  719. <td class='new_title'>
  720. Name
  721. </td>
  722. <td class='new_values'>
  723. <input type='text' id='new_team_name' name='name'/>
  724. </td>
  725. </tr>
  726. <tr>
  727. <td class='new_title'>
  728. Description
  729. </td>
  730. <td class='new_values'>
  731. <textarea id='new_team_description' name='description'></textarea>
  732. </td>
  733. </tr>
  734. <tr>
  735. <td class='new_title'>
  736. Units:
  737. <div class='new_unit' id='new_unit'>
  738. <input id='new_unit_id' onInput='searchUnit();'/>
  739. <div id='new_unit_autocomplete' class='new_unit_autocomplete'>
  740. </div>
  741. </td>
  742. <td class='new_values'>
  743. <div id='new_team_units'>
  744. </div>
  745. </td>
  746. </tr>
  747. <tr>
  748. <td colspan='2'>
  749. <input type='button' value='Save' onClick='saveTeam();'/>
  750. <input type='button' value='Close' onClick='showNewTeam(false);'/>
  751. </td>
  752. </tr>
  753. </table>
  754. </article>
  755. </section>
  756. <section id='error'>
  757. <h2>
  758. Teams
  759. </h2>
  760. <article>
  761. <p id='error_msg'>
  762. </p>
  763. <input type='button' onclick='closeError();'>
  764. </article>
  765. </section>
  766. </body>
  767. </html>