<?php session_start();
require_once 'config.php';
require_once 'auth.php';
$PageName = "Depatment";
$UserId = $_SESSION['User']['id'];
if(isset($_SESSION['DeptId'])){
  $deptid = $_SESSION['DeptId'];
  $pagename = $_GET['page'];
  $tblname = $_GET['tblname'];
   echo "<script>window.location.href='courses.php?deptid=$deptid&page=$pagename&tblname=$tblname';</script>";
}
 ?>
<!doctype html>
<html lang="en" class="h-100">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="generator" content="">
    <title><?php echo $Proj_Title; ?></title>
    <meta name="apple-mobile-web-app-capable" content="yes">
    <link rel="apple-touch-icon" href="img/favicon180.png" sizes="180x180">
    <link rel="icon" href="img/favicon32.png" sizes="32x32" type="image/png">
    <link rel="icon" href="img/favicon16.png" sizes="16x16" type="image/png">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&amp;display=swap" rel="stylesheet">
    <link href="vendor/swiper/css/swiper.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet" id="style">
</head>

<body class="body-scroll d-flex flex-column h-100 menu-overlay">
    <main class="flex-shrink-0 main">
        <?php include_once 'back-header.php'; ?> 
        <div class="main-container">
            <div class="container">
               
                  
                 
                <div class="row text-center mt-3">
                    <?php 
                    if($_GET['page'] == 'subscribe-course'){
                     $sql = "SELECT * FROM tbl_departments WHERE Status=1";   
                    }
                    else{
                    $sql = "SELECT * FROM tbl_departments WHERE Status=1 AND id IN($DeptId)";
                    }
                    $row = getList($sql);
                    foreach($row as $result){
                    ?>
                   
                    <div class="col-6 col-md-3">
                        <div class="card border-0 mb-4">
                            <div class="card-body">
                                <?php if($_GET['page'] == 'subscribe-course'){?>
                                <a href="subscribe-courses.php?deptid=<?php echo $result['id'];?>">
                                <?php } else{?>
                                <a href="courses.php?deptid=<?php echo $result['id'];?>&page=<?php echo $_GET['page'];?>&tblname=<?php echo $_GET['tblname'];?>"><?php } ?>    
                               <!--  <div class="avatar avatar-60 bg-default-light rounded-circle text-default">
                                    <i class="material-icons vm md-36 text-template">subscriptions</i>
                                </div> -->
                                <h3 class="mb-0 font-weight-normal" style="font-size: 16px;color: black;"><?php echo $result['Name'];?></h3>
                                </a>
                            </div>
                        </div>
                    </div>
                    <?php } ?>
                </div>
                    
                       
               
            </div>
        </div>
    </main>
 <?php include_once 'footer.php'; ?>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="js/jquery.cookie.js"></script>
<script src="vendor/swiper/js/swiper.min.js"></script>
<script src="js/main.js"></script>
<script src="js/color-scheme-demo.js"></script>
<script src="js/app.js"></script>
<script>
    function onDownloadFileFromUrl(url,filename){
         Android.onDownloadFileFromUrl(''+url+'',''+filename+'');
    }
</script>
</body>
</html>
