<?php
if(!defined('ABSPATH')){
    exit; // Exit if accessed directly
}
?>

<form method="post" action="options.php" id="" class="egps_options_form">

    <?php settings_fields( 'egps_site_design' ); ?>
    <?php do_settings_sections( 'egps_site_design' ); ?>


    <h3>Frontend design settings</h3>
    <p></p>


    <?php

    $options = get_option('egps_sitedesign');

    if( !$options ){
        $options = array();

        $options['egps_photoPerPage'] = "";
        $options['egps_photoPerPageAdmin'] = "";
    }

    ?>


    <table class="form-table" role="presentation">
        <tbody>

        <tr>
            <th scope="row">Show EGPS albums</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="egps_sidebar_on" 
                        name="egps_sitedesign[egps_sidebar_on]"
                        <?php 
                            $egps_slidebar_on = (isset($options['egps_sidebar_on']) && $options['egps_sidebar_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_slidebar_on);
                        ?>
                        >
                    <label class="custom-control-label" for="egps_sidebar_on">
                        Names of the photo albums will be listed on the right side of the photoalbum page.
                    </label>
                </div>
            </td>
        </tr>

        <tr>
            <th scope="row">Show EGPS Camera cloud</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="egps_cameracloud_on" 
                        name="egps_sitedesign[egps_cameracloud_on]"
                        <?php 
                            $egps_cameracloud_on = (isset($options['egps_cameracloud_on']) && $options['egps_cameracloud_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_cameracloud_on);
                        ?>
                        >
                    <label class="custom-control-label" for="egps_cameracloud_on">
                        EGPS camera cloud will be listed on the right side of the photoalbum page.
                    </label>
                </div>
            </td>
        </tr>

        <tr>
            <th scope="row">Show EGPS tag cloud</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="egps_tagcloud_on" 
                        name="egps_sitedesign[egps_tagcloud_on]"
                        <?php 
                            $egps_tagcloud_on = (isset($options['egps_tagcloud_on']) && $options['egps_tagcloud_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_tagcloud_on);
                        ?>
                        >
                    <label class="custom-control-label" for="egps_tagcloud_on">
                        EGPS tag cloud will be listed on the right side of the photoalbum page.
                    </label>
                </div>
            </td>
        </tr>


        <tr>
            <th scope="row">Show WP sidebar</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="wp_sidebar_on" 
                        name="egps_sitedesign[wp_sidebar_on]"
                        <?php 
                            $egps_sidebar_on = (isset($options['wp_sidebar_on']) && $options['wp_sidebar_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_sidebar_on);
                        ?>
                        >
                    <label class="custom-control-label" for="wp_sidebar_on">
                    If ON the default theme's sidebar will be visible on the right side of the page with the selected widgets.
                    </label>
                </div>
        </tr>


        <tr>
            <th scope="row">Random album covers</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="wp_randomalbumcovers_on" 
                        name="egps_sitedesign[wp_randomalbumcovers_on]"
                        <?php 
                            $egps_random_cover_on = (isset($options['wp_randomalbumcovers_on']) && $options['wp_randomalbumcovers_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_random_cover_on);
                        ?>
                        >
                    <label class="custom-control-label" for="wp_randomalbumcovers_on">
                        Showing a random photos for album cover.
                    </label>
                </div>
        </tr>

        <tr>
            <th scope="row">Back to Top button</th>
            <td>
                <div class="custom-control custom-switch">
                    <input 
                        type="checkbox" 
                        class="custom-control-input" 
                        id="wp_backtotopbutton_on" 
                        name="egps_sitedesign[wp_backtotopbutton_on]"
                        <?php 
                            $egps_backtotop_on = (isset($options['wp_backtotopbutton_on']) && $options['wp_backtotopbutton_on'] == 'on') ? ' checked ' : '';  
                            echo esc_html($egps_backtotop_on);
                        ?>
                        >
                    <label class="custom-control-label" for="wp_backtotopbutton_on">
                        Showing "scroll back to top" button on pages.
                    </label>
                </div>
        </tr>

        <tr>
            <th scope="row">Photos per page</th>
            <td><div class="">
                    <input type="text" name="egps_sitedesign[egps_photoPerPage]" value="<?php echo esc_html($options['egps_photoPerPage']); ?>">
                    The default value is 40 photos per page, if you leave the field empty.
                </div>
            </td>
        </tr>

        <tr>
            <th scope="row">Photos per page (admin page)</th>
            <td><div class="">
                    <input type="text" name="egps_sitedesign[egps_photoPerPageAdmin]" value="<?php echo esc_html($options['egps_photoPerPageAdmin']); ?>">
                    The default value is 40 photos per page, if you leave the field empty.
                </div>
            </td>
        </tr>

        </tbody>
    </table>

    <?php submit_button(); ?>

</form>


