<?php include("../db.php");?>
<?php include("./x.php");?>


<?php
    $user2_sql = "SELECT * FROM user2 WHERE u_id = '$x' ";
    $user2_run = mysqli_query($con, $user2_sql);
    $user2_rows = mysqli_fetch_assoc($user2_run);
?>
<?php
    $user_sql = "SELECT * FROM users WHERE uid = '$x' ";
    $user_run = mysqli_query($con, $user_sql);
    $user_rows = mysqli_fetch_assoc($user_run);
?>
<?php 
    if(isset($_GET["class"])){
        $class = $_GET["class"];

        $class_sql = "SELECT * FROM data_table WHERE up_by = $x && page_type = 'cource' && recycle = '1' && title = '$class'";
        $class_run = mysqli_query($con, $class_sql);
        $c = '1';
        if ($class_row = mysqli_fetch_assoc($class_run)) {
        }
    }
?>

<!DOCTYPE html>
<html lang="en">

<head>
    <!-- meta tags -->
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="<?php echo $user_rows['uname'];?> | class | <?= $class; ?> ">
    <meta name="keywords" content="">

    <!-- title -->
    <title><?php echo $user_rows['uname'];?> | class | <?= $class; ?> </title>

    <!-- favicon -->
    <link rel="icon" type="image/x-icon" href="assets/img/logo/macaw.png">

    <?php include("include/css.php");?>

</head>

<body>


    <!-- header area -->
    <?php include("include/header.php");?>
    <!-- header area end -->


    <main class="main">

        <!-- breadcrumb -->
        <div class="site-breadcrumb" style="background: url(./login/upload/<?php echo $class_row['image_one']?>)">
            <div class="container">
                <h2 class="breadcrumb-title"><?= $class; ?></h2>
                <ul class="breadcrumb-menu">
                    <li><a href="index.html">Home</a></li>
                    <li class="active">Class Details</li>
                </ul>
            </div>
        </div>
        <!-- breadcrumb end -->


        <!-- course-single -->
        <div class="course-single-area py-120">
            <div class="container">
                <div class="course-single-wrapper">
                    <div class="row">
                        <div class="col-xl-8 col-lg-8">
                            <div class="course-details">
                                <div class="course-details-img mb-30">
                                    <img src="./login/upload/<?php echo $class_row['image_one']?>" alt="thumb">
                                </div>
                                <div class="course-details">
                                    <h3 class="mb-20"><?= $class_row["title"];?></h3>
                                    <p class="mb-20">
                                        <?= $class_row["short_des"];?>
                                    </p>
                                    <div class="ck-editor">
                                        <?= $class_row["long_des"];?>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="col-xl-4 col-lg-4">
                            <div class="course-single-sidebar">
                                <div class="widget">
                                    <h4 class="widget-title">All Classes</h4>
                                    <div class="course-feature-list">
                                        <?php
                                            $cources_sql = "SELECT * FROM data_table WHERE up_by = $x && page_type = 'course' && recycle = '1' ORDER BY id DESC";
                                            $cources_run = mysqli_query($con, $cources_sql);
                                            while ($cources_row = mysqli_fetch_assoc($cources_run)) {
                                                $isHovered = "";    
                                                if($class == $cources_row["title"] ){
                                                    $isHovered = "active";
                                                }
                                        ?>
                                        <a class="<?= $isHovered?>"
                                            href="class-details.php?class=<?= $cources_row["title"];?>"><?= $cources_row["title"];?></a>
                                        <?php } ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- course-single end-->

    </main>



    <!-- footer area -->
    <?php include("include/footer.php");?>
    <!-- footer area end -->


    <!-- js -->
    <?php include("include/js.php");?>

</body>

</html>