teams.php.txt 37 KB

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