<?php session_start();
require_once 'config.php';
require_once 'auth.php';
$PageName = "<span style='font-size: 13px;'>Upcomming Discussion</span>";
$UserId = $_SESSION['User']['id'];
 ?>
<!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">
                    <?php 
                    $i=1;
                    $sql2 = "SELECT ts.*,td.Name As Department,tb.BatchName,tc.Name As Course FROM tbl_upcomming_discussions ts 
                     LEFT JOIN tbl_departments td ON ts.DeptId = td.id 
                     LEFT JOIN tbl_courses tc ON ts.CourseId = tc.id 
                     LEFT JOIN tbl_batches tb ON ts.BatchId=tb.id 
                     ORDER BY ts.id DESC"; 
                    $res2 = getList($sql2);
                    foreach($res2 as $row){ ?>
                  <div class="col-sm-12 col-md-6 col-lg-4">
                    <div class="card bg-primary text-white mb-4" style="background-color: #85befb !important;">
                           
                               <?php 
                                if($row["Photo"] == ''){} 
                                else {?>  
                                <img src="<?php echo $SiteUrl;?>/uploads/<?php echo $row['Photo']; ?>">
                                <?php }  ?>
                           
                            <div class="card-body ">
                               <!--  <p><strong>Department : </strong> <?php echo $row['Department']; ?></p>
                                <p><strong>Course : </strong> <?php echo $row['Course']; ?></p>
                                <p><strong>Batch : </strong> <?php echo $row['BatchName']; ?></p> -->
                                <p><strong>Type : </strong> <?php echo $row['Type']; ?> &nbsp;&nbsp;<strong>Fees : </strong> &#8377;<?php echo number_format($row["Fees"],2); ?></p>
                             
                                <p><strong>Subject : </strong> <?php echo $row['DiscSubject']; ?></p>
                                <p><strong>Speaker Name : </strong> <?php echo $row['SpeakerName']; ?></p>
                                <p><strong>Date : </strong> <?php echo date("d/m/Y", strtotime(str_replace('-', '/',$row['StartDate']))); ?> &nbsp;&nbsp;<strong>Time : </strong> <?php echo date("h:i a", strtotime(str_replace('-', '/',$row['StartTime']))); ?></p>
                              
                                <?php if($row['Video']!=''){?>
                                <p><strong>Video Link : </strong> <a href="<?php echo $row['Video']; ?>"><?php echo $row['Video']; ?></a></p>
                            <?php } ?>
                            </div>
                            <div class="card-footer">
                                <?php 
                                $url =  $SiteUrl.'uploads/'.$row["File"];
                                if($row["File"] == ''){} 
                                else {?>  
                                <a href="JavaScript:Void(0);" 
onclick="onDownloadFileFromUrl('<?php echo $url;?>','<?php echo $row["File"];?>')" class="btn btn-outline-light"> Download</a>
                                <?php } ?>
                            </div>
                        </div>
                    </div>
                    <?php $i++;} ?>
                    
                </div>
                    
                       
               
            </div>
        </div>
    </main>

<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>
