<?php 
    global $ST_OPTION_st_proqyz__IELTS_LMS, $ST_OPTION_st_proqyz__GOV_LMS;
    $enable_ielts_lms = 0;
    $enable_gov_lms   = 0;

    if(isset($_POST['st_proqyz-access']) && !empty($_POST['st_proqyz-access'])){
        if($_POST['st_proqyz-access'] == "1"){
            
            $enable_ielts_lms       = isset($_POST[$ST_OPTION_st_proqyz__IELTS_LMS])? $_POST[$ST_OPTION_st_proqyz__IELTS_LMS] : $enable_ielts_lms;
            $enable_gov_lms         = isset($_POST[$ST_OPTION_st_proqyz__GOV_LMS])? $_POST[$ST_OPTION_st_proqyz__GOV_LMS] : $enable_gov_lms;
        
            update_option($ST_OPTION_st_proqyz__IELTS_LMS,$enable_ielts_lms);
            update_option($ST_OPTION_st_proqyz__GOV_LMS,$enable_gov_lms);
        }
    }

    $enable_ielts_lms = get_option($ST_OPTION_st_proqyz__IELTS_LMS,$enable_ielts_lms);
    $enable_gov_lms = get_option($ST_OPTION_st_proqyz__GOV_LMS,$enable_gov_lms);

?>
<h2>ProQyz Access Settings </h2>
<form method="POST">
        <table class="form-table">
            <tbody>
                <tr class="">
                    <th scope="row" class="titledesc">Enable IELTS LMS</th>
                    <td class="forminp forminp-checkbox ">
                        <fieldset>
                            <legend class="screen-reader-text">
                                <span>Enable IELTS LMS</span>
                            </legend>
                            <label for="<?php echo $ST_OPTION_st_proqyz__IELTS_LMS; ?>">
                                <input 
                                    name="<?php echo $ST_OPTION_st_proqyz__IELTS_LMS; ?>" 
                                    id="<?php echo $ST_OPTION_st_proqyz__IELTS_LMS; ?>" 
                                    type="checkbox" 
                                    class="" 
                                    value="1" 
                                    <?php echo ($enable_ielts_lms == '1')? 'checked' : ''; ?>
                                />					
                            </label> 
                            <p class="description">
                                Enabling this option will make the IELTS Learning Management System (LMS) visible on the following interfaces: [PROGRESS DASHBOARD, COURSE].
                            </p>																
                        </fieldset>
                    </td>
                </tr>

                <tr class="">
                    <th scope="row" class="titledesc">Enable Competitive Exams</th>
                    <td class="forminp forminp-checkbox ">
                        <fieldset>
                            <legend class="screen-reader-text">
                                <span>Enable Competitive Exams</span>
                            </legend>
                            <label for="<?php echo $ST_OPTION_st_proqyz__GOV_LMS; ?>">
                                <input 
                                    name="<?php echo $ST_OPTION_st_proqyz__GOV_LMS; ?>" 
                                    id="<?php echo $ST_OPTION_st_proqyz__GOV_LMS; ?>" 
                                    type="checkbox" 
                                    class="" 
                                    value="1" 
                                    <?php echo ($enable_gov_lms == '1')? 'checked' : ''; ?>
                                />					
                            </label> 
                            <p class="description">
                                Enabling this option will make the Competitive Exams (LMS) visible on the following interfaces: [PROGRESS DASHBOARD, COURSE].
                            </p>																
                        </fieldset>
                    </td>
                </tr>
            </tbody>
        </table>

        <p class="submit">
            <button name="save" class="button-primary woocommerce-save-button" type="submit" value="Save changes">
                Save changes
            </button>
            <input 
                type="hidden" 
                id="st_proqyz-access" 
                name="st_proqyz-access" 
                value="1" 
            />		
        </p>
</form>