teams.php 38 KB

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