| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296 |
- <?php
- /**
- * Artifacts view.
- *
- * Contains the view layout and code to present the data.
- *
- * @author Iñigo Valentin <i@inigovalentin.com>
- * @license https://www.gnu.org/licenses/gpl-3.0.en.html GNU General Public License V3
- * @package SWDB
- * @category View
- * @property Artifacts_Page $page The page model.
- * @var Artifacts_Page $page The page model.
- */
- ?>
- <!DOCTYPE html>
- <html lang='en'>
- <head>
- <?=$page->generate_head()?>
- </head>
- <body>
- <header>
- <?php
- include __DIR__ . "/inc/header_app.php";
- include __DIR__ . "/inc/header_player.php";
- ?>
- </header>
- <aside class='filters'>
- <h2>
- Artifacts
- </h2>
- <p>
- Manage your enchantments
- </p>
- <form action='/player/<?=get_context()->get_player()->get_id()?>/artifacts/' method='get' id='filter_artifacts' class='filter'>
- <table>
- <tr>
- <td class='label'>
- Element:
- </td>
- <td>
- <select multiple name='element[]' id='filter_element'>
- <?php
- $reflect = new ReflectionClass("ELEMENT_ID");
- foreach($reflect->getConstants() as $name => $id){
- if ($id != ELEMENT_ID::PURE){
- $selected = "";
- if (in_array($id, $page->get_filter("ELEMENT"))){
- $selected = "selected='selected'";
- }
- ?>
- <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
- <?php
- }
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td class='label'>
- Type:
- </td>
- <td>
- <select multiple name='archetype[]' id='filter_archetype'>
- <?php
- $reflect = new ReflectionClass("ARCHETYPE_ID");
- foreach($reflect->getConstants() as $name => $id){
- if ($id != ARCHETYPE_ID::NONE && $id != ARCHETYPE_ID::MATERIAL){
- $selected = "";
- if (in_array($id, $page->get_filter("ARCHETYPE"))){
- $selected = "selected='selected'";
- }
- ?>
- <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
- <?php
- }
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td class='label'>
- Main stat:
- </td>
- <td>
- <select multiple name='main_stat[]' id='filter_main_stat'>
- <?php
- $reflect = new ReflectionClass("ARTIFACT_STAT_ID");
- foreach($reflect->getConstants() as $name => $id){
- $selected = "";
- if (in_array($id, $page->get_filter("MAIN"))){
- $selected = "selected='selected'";
- }
- ?>
- <option value='<?=$id?>' <?=$selected?>><?=$name?></option>
- <?php
- }
- ?>
- </select>
- </td>
- </tr>
- <tr>
- <td class='label'>
- Level:
- </td>
- <td>
- <input type='number' name='min_level' id='filter_level_min' min='0' max='15' value='<?=$page->get_filter("MIN_LEVEL")?>'/>
- -
- <input type='number' name='max_level' id='filter_level_max' min='0' max='15' value='<?=$page->get_filter("MAX_LEVEL")?>'/>
- </td>
- </tr>
- <tr>
- <td class='label'>
- Quality:
- </td>
- <td>
- <?php
- $selected = Array("", "", "", "", "");
- $selected[$page->get_filter("MIN_QUALITY") - 1] = "selected";
- ?>
- <select name='min_quality' id='filter_quality_min'>
- <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
- <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
- <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
- <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
- <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
- </select>
- -
- <?php
- $selected = Array("", "", "", "", "");
- $selected[$page->get_filter("MAX_QUALITY") - 1] = "selected";
- ?>
- <select name='max_quality' id='filter_quality_max'>
- <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
- <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
- <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
- <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
- <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class='label'>
- O. quality:
- </td>
- <td>
- <?php
- $selected = Array("", "", "", "", "");
- $selected[$page->get_filter("MIN_ORIGINAL_QUALITY") - 1] = "selected";
- ?>
- <select name='min_original_quality' id='filter_original_quality_min'>
- <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
- <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
- <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
- <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
- <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
- </select>
- -
- <?php
- $selected = Array("", "", "", "", "");
- $selected[$page->get_filter("MAX_ORIGINAL_QUALITY") - 1] = "selected";
- ?>
- <select name='max_original_quality' id='filter_original_quality_max'>
- <option value='<?=QUALITY_ID::NORMAL?>' <?=$selected[0]?>>Normal</option>
- <option value='<?=QUALITY_ID::MAGIC?>' <?=$selected[1]?>>Magic</option>
- <option value='<?=QUALITY_ID::RARE?>' <?=$selected[2]?>>Rare</option>
- <option value='<?=QUALITY_ID::HERO?>' <?=$selected[3]?>>Hero</option>
- <option value='<?=QUALITY_ID::LEGEND?>' <?=$selected[4]?>>Legend</option>
- </select>
- </td>
- </tr>
- <tr>
- <td class='label'>
- Assigned:
- </td>
- <td>
- <?php
- $selected = Array("", "", "", "", "");
- $selected[$page->get_filter("ASSIGNED")] = "selected";
- ?>
- <select name='assigned' id='filter_assigned'>
- <option value='0' <?=$selected[0]?>>All</option>
- <option value='1' <?=$selected[1]?>>Assigned</option>
- <option value='2' <?=$selected[2]?>>Unassigned</option>
- <option value='3' <?=$selected[3]?>>All (no storage)</option>
- <option value='4' <?=$selected[4]?>>Assigned (no storage)</option>
- </select>
- </td>
- </tr>
- </table>
- <div id='filter_apply'>
- <input type='submit' value='Apply'/>
- </div>
- </form>
- </aside> <!-- #filters -->
- <main>
- <section class='content' id='artifacts'>
- <h2>
- Artifacts
- </h2>
- <table>
- <?php
- $prev_group = "";
- $group = "";
- $group_title = "";
- $group_image = "";
- foreach ($page->get_artifacts() as $artifact){
- $group = $artifact->get_type() . "-" . $artifact->get_element() . "-" . $artifact->get_archetype();
- if ($prev_group != $group){
- switch ($artifact->get_type()){
- case ARTIFACT_TYPE::ELEMENT:
- switch ($artifact->get_element()){
- case ELEMENT_ID::WATER:
- $group_title = "Water";
- $group_image = URL::IMG["ARTIFACT"] . "element_water.png";
- break;
- case ELEMENT_ID::FIRE:
- $group_title = "Fire";
- $group_image = URL::IMG["ARTIFACT"] . "element_fire.png";
- break;
- case ELEMENT_ID::WIND:
- $group_title = "Wind";
- $group_image = URL::IMG["ARTIFACT"] . "element_wind.png";
- break;
- case ELEMENT_ID::LIGHT:
- $group_title = "Light";
- $group_image = URL::IMG["ARTIFACT"] . "element_light.png";
- break;
- case ELEMENT_ID::DARK:
- $group_title = "Dark";
- $group_image = URL::IMG["ARTIFACT"] . "element_dark.png";
- break;
- }
- break;
- case ARTIFACT_TYPE::ARCHETYPE:
- switch ($artifact->get_archetype()){
- case ARCHETYPE_ID::ATTACK:
- $group_title = "Attack";
- $group_image = URL::IMG["ARTIFACT"] . "type_attack.png";
- break;
- case ARCHETYPE_ID::DEFENSE:
- $group_title = "Defense";
- $group_image = URL::IMG["ARTIFACT"] . "type_defense.png";
- break;
- case ARCHETYPE_ID::SUPPORT:
- $group_title = "Support";
- $group_image = URL::IMG["ARTIFACT"] . "type_support.png";
- break;
- case ARCHETYPE_ID::HP:
- $group_title = "HP";
- $group_image = URL::IMG["ARTIFACT"] . "type_hp.png";
- break;
- }
- }
- if ($prev_group == ""){
- ?>
- <tr>
- <td class='header'>
- <?php
- }
- else{
- ?>
- </td>
- </tr>
- <tr>
- <td class='header'>
- <?php
- }
- $prev_group = $group;
- ?>
- <img class='group_image_<?=$group?>' alt='<?=$group_title?>' src='<?=$group_image?>'>
- <span>
- <?=$group_title?>
- </span>
- </td>
- </tr>
- <tr>
- <td>
- <?php
- }
- ?>
- <?=HTML::artifact_table($artifact, $artifact->get_unit())?>
- <?php
- }
- ?>
- </td> <!-- Close last group -->
- </tr>
- </table>
- </section>
- </main>
- <?php
- include __DIR__ . "/inc/footer.php";
- ?>
- </body>
- </html>
|