<?php session_start();?>
<?php include'includes/header.php'; ?>
<?php include'includes/sidebar.php';?>
<?php include'includes/functions.php';?>
<?php include'includes/navbar.php'; ?>

<!-- Handle Add Slider -->
<style>
    td span{
        padding: 10px; border-radius: 6px;
        font-size: 13px;
    }
    .success_stutus{
        background: #E8FCEF; color: #4ECA74;
    }
    .error_status{
        background: #F8D7DA; color: #90151C;
    }
    .info-box{
        width: 100%;
        padding: 8px;
        border:2px solid #ddd;
    }
    .info-box h4{
        font-size: 16px;
        font-weight: bold;
    }
.iconside{
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.iconside i{
    font-size: 200px;
    color: #ccc;
}
</style>
<?php

if (isset($_GET['class'])) {
    $class = $_GET['class'];

    // Determine how many subject this person teaches
    $detms = "SELECT subject FROM teacher_assignments WHERE staffId = ? AND class = ?";
    $detmspdo = $pdo->prepare($detms);
    $detmspdo->execute([$staffId, $class]);
    $determ = $detmspdo->rowCount();
    if ($determ < 2) {
        // get the only subject this person teaches
        $datarow    = $detmspdo->fetch(PDO::FETCH_ASSOC);
        $sub        = $datarow['subject'];
        header("Location:disp-std.php?class=$class*$sub");
    }else{




?>

<div id="notification-containers" class="notification-containers"></div>
<div class="insider">
    <div class="container">
        <div class="cat-pag">
            <!-- <div class="cat-page-header d-flex justify-content-between align-items-center">
                <h5>All Students</h5>
                <div>
                    <a href="test_score.php?class=<?=$class?>" class="btn info text-white">Add Test Scores <i class="fa fa-plus-circle"></i></a>

                    <a href="exam_score.php?class=<?=$class?>" class="btn invoice text-white">Add Exam Score <i class="fa fa-pen"></i></a>
                </div>
            </div> -->
            <div class="card-body" style="margin-top: 10px">
                <div class="info-box">
                    <h4>Which Subject do you want to grade?</h4>
                </div>
                <div class="all-cards">
                    <div class="row">
                        <?php
                        
                        $srn = 0;
                        while ($subrow = $detmspdo->fetch(PDO::FETCH_ASSOC)) {
                            $sub = $subrow['subject'];
                            $srn = $srn + 1;
                            
                            if ($srn == 1) {
                                $bg = "notifications";
                            }else if ($srn == 2) {
                                $bg = "invoice";
                            }else{
                                $bg = "info";
                            };

                        ?>
                        <div class="col-lg-4 mt-3">
                            <a href="disp-std.php?class=<?php echo $class.'*'.$sub;?>">
                                <div class="single-card <?php echo $bg;?>">
                                    <div class="content-card">
                                        <h4><?= $class?></h4>
                                        <span><?= $sub;?> </span>
                                    </div>
                                    <div class="icon-card">
                                        <!-- <label>$</label> -->
                                        <i class="fa fa-users"></i>
                                    </div>
                                </div>
                            </a>
                        </div>
                        <?php } ?>
                    </div>
                    <!-- <div class="iconside">
                        <i class="fa fa-users"></i>
                    </div> -->
                </div>
            </div>            
        </div>
   
    </div>
</div>

<?php include'includes/notification-alert-js.php';?>
<?php include 'includes/footer.php'; ?>
<?php
   
 }
}


?>


