<?php
    global $AREA_TYPE;
?>
<form action='/<?=$UID?>/runs/' method='get' id='filter_runeupgrade' class='filter'>
    <table>
        <tr>
            <td class='filter filter_title'>
                <span>
                    Area
                </span>
            </td>
            <td class='filter'>
<?php
                $selected = [];
                $selected[$filters["area_type"]] = "selected";
?>
                <span>Region:</span>
                <select name='area_type' id='filter_area'>
                    <option value='0'>All</option>
                    <option value='<?=$AREA_TYPE["SCENARIO"]?>' <?=$selected[$AREA_TYPE["SCENARIO"]]?>>Scenario</option>
                    <option value='<?=$AREA_TYPE["CAIROS_DUNGEON"]?>' <?=$selected[$AREA_TYPE["CAIROS_DUNGEON"]]?>>Cairos Dungeon</option>
                    <option value='<?=$AREA_TYPE["RIFT_DUNGEON"]?>' <?=$selected[$AREA_TYPE["RIFT_DUNGEON"]]?>>Rift Beast</option>
                    <option value='<?=$AREA_TYPE["RIFT_RAID"]?>' <?=$selected[$AREA_TYPE["RIFT_RAID"]]?>>Rift Raid</option>
                    <option value='<?=$AREA_TYPE["DIMENSIONAL_HOLE"]?>' <?=$selected[$AREA_TYPE["DIMENSIONAL_HOLE"]]?>>Dimensional Hole</option>
                    <option value='<?=$AREA_TYPE["ARENA"]?>' <?=$selected[$AREA_TYPE["ARENA"]]?>>Arena</option>
                    <option value='<?=$AREA_TYPE["GUILD_WAR"]?>' <?=$selected[$AREA_TYPE["GUILD_WAR"]]?>>Guild War</option>
                    <option value='<?=$AREA_TYPE["GUILD_SIEGE"]?>' <?=$selected[$AREA_TYPE["GUILD_SIEGE"]]?>>Guild Siege</option>
                    <option value='<?=$AREA_TYPE["TARTARUS_LABYRINTH"]?>' <?=$selected[$AREA_TYPE["TARTARUS_LABYRINTH"]]?>>Tartarus Labyrinth</option>
                    <option value='<?=$AREA_TYPE["TRIAL_OF_ASCENSION"]?>' <?=$selected[$AREA_TYPE["TRIAL_OF_ASCENSION"]]?>>Trial of Ascension</option>
                    <option value='<?=$AREA_TYPE["WORLD_BOSS"]?>' <?=$selected[$AREA_TYPE["WORLD_BOSS"]]?>>World Boss</option>
                    <option value='<?=$AREA_TYPE["DIMENSIONAL_RIFT"]?>' <?=$selected[$AREA_TYPE["DIMENSIONAL_RIFT"]]?>>Dimensional Rift</option>
                </select>
            </td>
            <td class='filter'>
<?php
                $selected = [];
                $selected[$filters["area"]] = "selected";
?>
                <span>Area:</span>
                <select name='area_scenario'>
                    <option value='0'>All</option>
                    <option value='1' <?=$selected[1]?>>Garen Forest</option>
                    <option value='2' <?=$selected[2]?>>Mt. Siz</option>
                    <option value='3' <?=$selected[3]?>>Kabir Ruins</option>
                    <option value='4' <?=$selected[4]?>>Mt. White Ragon</option>
                    <option value='5' <?=$selected[5]?>>Telain Forest</option>
                    <option value='6' <?=$selected[6]?>>Hydeni Ruins</option>
                    <option value='7' <?=$selected[7]?>>Tamor Desert</option>
                    <option value='8' <?=$selected[8]?>>Vrofagus Ruins</option>
                    <option value='9' <?=$selected[9]?>>Faimon Volcano</option>
                    <option value='10' <?=$selected[10]?>>Aiden Forest</option>
                    <option value='11' <?=$selected[11]?>>Ferun Castle</option>
                    <option value='12' <?=$selected[12]?>>Mt. Runar</option>
                    <option value='13' <?=$selected[13]?>>Charuka Remains</option>
                </select>
                <select name='area_cairos'>
                    <option value='0'>All</option>
                    <option value='1001' <?=$selected[1001]?>>Hall of Dark</option>
                    <option value='2001' <?=$selected[2001]?>>Hall of Fire</option>
                    <option value='3001' <?=$selected[3001]?>>Hall of Water</option>
                    <option value='4001' <?=$selected[4001]?>>Hall of Wind</option>
                    <option value='5001' <?=$selected[5001]?>>Hall of Magic</option>
                    <option value='6001' <?=$selected[6001]?>>Necropolis</option>
                    <option value='7001' <?=$selected[7001]?>>Hall of Light</option>
                    <option value='8001' <?=$selected[8001]?>>Giant&#39;s Keep</option>
                    <option value='9001' <?=$selected[9001]?>>Dragon&#39;s Lair</option>
                </select>
            </td>
        </tr>
        <tr>
            <td class='filter filter_title filter_separator' rowspan='4'>
                <span>
                    Extra
                </span>
            </td>
            <td class='filter filter_separator' colspan='2'>
                <span>Date range:</span>
                <input type='date' name='date_min' id='date_min' value='<?=$filters["date_min"]?>'/>
                -
                <input type='date' name='date_max' id='date_max' value='<?=$filters["date_max"]?>'/>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["defeat"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='defeat' id='filter_defeat' <?=$checked?>/>
                <label for='filter_defeat'>Show defeats</label>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
<?php
                $checked = "";
                if ($filters["helper"]){
                    $checked = "checked";
                }
?>
                <input type='checkbox' name='helper' id='filter_helper' <?=$checked?>/>
                <label for='filter_helper'>Show runs with friends/mentors</label>
            </td>
        </tr>
        <tr>
            <td class='filter' colspan='2'>
                <input type='number' name='number' id='number' min='1' value='<?=$filters["number"]?>'/> runs per page
            </td>
        </tr>
    </table>
    <div id='filter_apply'>
        <input type='submit' value='Apply'/>
    </div>
</form>
