<?php
$current_url = admin_url().'admin.php?page=woo2app/woo2app_design/woo2app_show_design.php&tab=chideman&sub_page=banner';
$ban_type = 'ban1';
if(isset($_GET['ban_type'])){
	$ban_type = $_GET['ban_type'];
}
?>
<table class="form-table float-left"  style="margin-top: 10px">
    <tr>
        <th> نوع بنر </th>
        <td>
            <select class="regular-text" onchange="changeBannerPage(this)" name="ban_type">
                <option value="ban1" <?= selected('ban1' , $ban_type )?> > بنر تکی </option>
                <option value="ban2" <?= selected('ban2' , $ban_type )?>> بنر 2 تایی </option>
                <option value="ban3R" <?= selected('ban3R' , $ban_type )?>> بنر 3 تایی | راست </option>
                <option value="ban3L" <?= selected('ban3L' , $ban_type )?>> بنر 3 تایی | چپ </option>
                <option value="ban4" <?= selected('ban4' , $ban_type )?>> بنر 4 تایی </option>
            </select>
        </td>
    </tr>
</table>
<?php

if($ban_type  == 'ban1'){
    require_once 'woo2app_banner.php';
}
elseif($ban_type  == 'ban2'){
	require_once 'woo2app_banner2.php';
}
elseif($ban_type  == 'ban3R'){
	require_once 'woo2app_banner3.php';
}
elseif($ban_type  == 'ban3L'){
	require_once 'woo2app_left_banner3.php';
}
elseif($ban_type  == 'ban4'){
	require_once 'woo2app_banner4.php';
}
?>
<script>
    function changeBannerPage(e) {
        if(e.value == 'ban1'){
            location.href = '<?= $current_url . "&ban_type=ban1"?>';
        }
        else if(e.value == 'ban2'){
            location.href = '<?= $current_url . "&ban_type=ban2"?>';
        }
        else if(e.value == 'ban3R'){
            location.href = '<?= $current_url . "&ban_type=ban3R"?>';
        }
        else if(e.value == 'ban3L'){
            location.href = '<?= $current_url . "&ban_type=ban3L"?>';
        }
        else if(e.value == 'ban4'){
            location.href = '<?= $current_url . "&ban_type=ban4"?>';
        }

    }
</script>
