<?php 
session_start();
require"inc/auth.php";
?>

<?php 
  include"inc/conn.php";
  include"inc/session_siswa.php";
  include"inc/style.php";

  $id = $_GET["id"];
  $qunit=mysqli_query($connect,"select * from tb_unit where id_unit='".$id."' and aktif='1'");
  $runit=mysqli_fetch_array($qunit);
?>

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

<head>
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0" name="viewport">

  <title>Artikel Ilmiah | <?php echo $runit['judul_unit'];?></title>
  <meta content="" name="description">
  <meta content="" name="keywords">

  
  
</head>

<body>

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

  
  <main id="main">
    
    <!-- ======= Breadcrumbs ======= -->
    <section class="breadcrumbs">
      <div class="container" style="color:grey;">
          <ol>
            <li><a href="index.php">Beranda</a></li>
            <li><a href="unit.php?id=<?php echo $id;?>">Unit</a></li>
            <li>Artikel Ilmiah</li>
          </ol>
      </div>
    </section><!-- End Breadcrumbs -->
    

    <!-- ======= Blog Single Section ======= -->
    <section id="blog" class="blog" style="margin-top:30px;">
      <div class="container">

        <div class="row">

          <div class="col-lg-12 entries">

            <article class="entry entry-single">

              <a href="unit.php?id=<?php echo $id;?>"><button class="btn btn-sm" style="background:#c2326f;color:white;"><i class="bi bi-arrow-left"></i> Kembali Ke Menu</button></a>
              <br><br> 

              <header class="section-header">
                  <h2>Bahan Ajar</h2>
				<p><?php echo $runit['judul_unit'];?></p>
			  </header>




              <div class="entry-content">

                        
                          <div class="d-none d-sm-block tab-content py-3 px-3 px-sm-0" id="nav-tabContent">
                           
                            <div class="accordion accordion-flush" id="faqlist1">
                              

                              <div class="table-responsive mailbox-messages" style="background:#faf5f9;">
                                <table class="table">
                                  <tbody>
                                  <?php
                                  $qmateri=mysqli_query($connect,"select * from tb_materi where id_unit='".$runit['id_unit']."'");
                                  $jum=mysqli_num_rows($qmateri);
                                  while($rmateri=mysqli_fetch_array($qmateri)){
                                  ?>
                              
                                  
                                  <tr>
                                    <td><b style="color:#c2326f;"><?php echo $rmateri['judul_materi'];?></b></td>
                                    <td align="right">
                                      <a class="btn btn-sm" href="assets/materi/<?php echo $rmateri['file'];?>" style="background:#c2326f;color:white;">
                                        Download
                                      </a>
                                    </td>
                                  </tr>
                                  </tr>
                                  <?php }?>
                                </tbody>
                                </table>
                              </div>


                              <?php if($jum<1){?>
                                  <div class="alert alert-danger text-center" role="alert">
                                    <i class="fa fa-exclamation fa-2x"></i><br>Tidak ditemukan data file materi 
                                  </div>
                              <?php }?>


                              
                            </div>


                          </div>










                          <!-- MOBILE VIEW -->
                          <div class="d-sm-none tab-content py-3 px-3 px-sm-0" id="nav-tabContent">
                           
                            <div class="accordion accordion-flush" id="faqlist1">
                              

                              <div class="table-responsive mailbox-messages" style="background:#faf5f9;">
                                <table class="table">
                                  <tbody>
                                  <?php
                                  $qmateri=mysqli_query($connect,"select * from tb_materi where id_unit='".$runit['id_unit']."'");
                                  $jum=mysqli_num_rows($qmateri);
                                  while($rmateri=mysqli_fetch_array($qmateri)){
                                  ?>
                              
                                  
                                  <tr>
                                    <td><b style="color:#c2326f;"><?php echo $rmateri['judul_materi'];?></b></td>
                                    <td align="right">
                                      <a class="btn btn-sm" href="assets/materi/<?php echo $rmateri['file'];?>" style="background:#c2326f;color:white;">
                                        Download
                                      </a>
                                    </td>
                                  </tr>
                                  </tr>
                                  <?php }?>
                                </tbody>
                                </table>
                              </div>

                              <?php if($jum<1){?>
                                  <div class="alert alert-danger text-center" role="alert">
                                    <i class="fa fa-exclamation fa-2x"></i><br>Tidak ditemukan data file materi 
                                  </div>
                              <?php }?>


                            </div>
                            
                            
                        

                          </div>
                          <!-- END MOBILE VIEW -->











                  </div>

              
            </article><!-- End blog entry -->

       

              

          </div><!-- End blog entries list -->

          

        </div>

      </div>
    </section><!-- End Blog Single 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>