<?php 
session_start();
require"inc/auth.php";
include"inc/conn.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Beranda | <?php echo $rsw['judul_modul'];?></title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  <?php 
  
  include"inc/session_siswa.php";
  include"inc/style.php";
  ?>
  
</head>

<body>

  <?php include"inc/menu.php";?>

  
  <main id="main">
    
    <!-- ======= Breadcrumbs ======= -->
    <section class="breadcrumbs">
      <div class="container">

      </div>
    </section><!-- End Breadcrumbs -->
    

    <!-- ======= Recent Blog Posts Section ======= -->
    <section id="recent-blog-posts" class="recent-blog-posts">

      <div class="container" data-aos="fade-up">
          
        <!--
        <header class="section-header">
          <p><?php echo $rsw['judul_modul'];?></p>
        </header>
        -->


        <div class="row" style="margin-top:20px;">

          <?php
          $delay=100;
          $qunit=mysqli_query($connect,"select * from tb_unit order by id_unit asc");
          while($runit=mysqli_fetch_array($qunit)){
          ?>
          <div class="col-lg-6" style="margin-bottom:15px;">
            <div class="post-box" data-aos="fade-up" data-aos-delay="<?php echo $delay+=100;?>" style="border:1px solid #f5f1f0;background:#faf5f9;text-align:center;border-top:25px solid #c2326f;border-radius:5px;">
              <?php
              if($runit['aktif']=='1'){
              ?>
              <div class="post-img"><img src="assets/banner/<?php echo $runit['banner'];?>?date=<?php echo date('Ymdhis');?>" onerror="this.src='assets/img/default.png';" class="img-fluid" alt=""></div>
              <?php }else{?>
              <div class="post-img"><img src="assets/banner/<?php echo $runit['banner'];?>?date=<?php echo date('Ymdhis');?>" onerror="this.src='assets/img/default.png';" class="img-fluid" alt=""></div>
              <?php }?>
              <h6 class="post-title"><?php echo $runit['judul_unit'];?></h6>
              
              <?php
              if($runit['aktif']=='1'){
              ?>
              <a href="unit.php?id=<?php echo $runit['id_unit'];?>" class="btn btn-primary stretched-link mt-auto" style="background:#c2326f;color:white;border:0px;"><span>Selengkapnya ...</span></i></a>
              <?php }else{?>
              <a class="btn btn-success stretched-link mt-auto disabled"><span>Belum tersedia</span></i></a>
              <?php }?>
            </div>
          </div>
          <?php }?>


        </div>

      </div>

    </section><!-- End Recent Blog Posts Section -->

    
  </main><!-- End #main -->

  <!-- ======= Footer ======= -->
  <footer id="footer" class="footer">

    <?php include"inc/footer.php";?>
    
  </footer><!-- End Footer -->

  <a href="#" class="back-to-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>

  <?php include"inc/script.php";?>

</body>

</html>