<?php 
/**
 * type: views
 * name: ApiKeys
 */

defined( 'ABSPATH' ) || exit;
$pro_quiz_lms_metakey = 'st_proqyz-lms-api-key';
$pro_quiz_lms_enable  = 'st_proqyz-lms';

$current_tab = "general";
if(isset($_GET['tab']) && !empty($_GET['tab'])) {
    if(in_array($_GET['tab'], ['general','addons'])) {
        $current_tab = $_GET['tab'];
    }
}


if(isset($_POST['proQuiz_LMS_config']) && !empty($_POST['proQuiz_LMS_config'])) {
    if($_POST['proQuiz_LMS_config'] == 1) {
        
        $api_key = $_POST['pro-quiz-lms-api-key'];
        $api_enable = isset($_POST['pro-quiz-lms-enable'])? $_POST['pro-quiz-lms-enable'] : 0;

        update_option($pro_quiz_lms_metakey, $api_key);
        update_option($pro_quiz_lms_enable, $api_enable);
    
    }
}




$site_unique_token = "";
$proQuiz_LMS_api_key = "";
$proQuiz_LMS_enable  = 0;

if($current_tab == "general") {
    $option_key = 'st_site-unique-identity';
    // Get the value of the option
    $option_value = get_option($option_key, false);
    if( $option_value !== false ) {
        $site_unique_token = $option_value;
    }

    $pro_quiz_lms_metavalue = get_option($pro_quiz_lms_metakey, false);
    if( $pro_quiz_lms_metavalue !== false ) {
        $proQuiz_LMS_api_key = $pro_quiz_lms_metavalue;
    }

    $pro_quiz_lms_enable_metavalue = get_option($pro_quiz_lms_enable, 0);
    if( $pro_quiz_lms_enable_metavalue !== 0 ) {
        $proQuiz_LMS_enable = $pro_quiz_lms_enable_metavalue;
    }

}


?>


<div class="wrap" style="margin:0;">
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="#">
                    Pro Qyz.
                </a>
            </div>
        </div>
    </nav>
</div>
<div class="wrap" style="margin: 0 20px;">

    
        <!--nav class="nav-tab-wrapper woo-nav-tab-wrapper ">
            <a href="/wp-admin/admin.php?page=st-api-keys&tab=general" class="nav-tab <?php echo ($current_tab =='general')? 'nav-tab-active' : ''; ?>">
                General
            </a>
            <a href="/wp-admin/admin.php?page=st-api-keys&tab=addons" class="nav-tab <?php echo ($current_tab =='addons')? 'nav-tab-active' : ''; ?>">
                Addons
            </a>		
        </nav-->

        <div class="tabpanel">
            <?php if($current_tab == "general"){ ?>
                
            <?php } ?>    
        </div>


    


</div>

