<?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><?php echo $runit['judul_unit'];?> | Modul Pembelajaran Biologi Digital</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="artikel.php?id=<?php echo $id;?>">Unit</a></li>
            <li>Pengayaan</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">

              

              <h2 class="entry-title">
                <?php echo $runit['judul_unit'];?>
              </h2>



              <div class="entry-content">

                          <?php include"inc/pagemenu.php";?>
                          <br>
                          <div class="tab-content py-3 px-3 px-sm-0" id="nav-tabContent">
                           

                            <h6 class="accordion-button"><b>Soal Pilihan Ganda</b></h6>
                            <br>
                            <?php
                            $bilangan=1;
                            $qsoal=mysqli_query($connect,"select * from tb_pilgan where id_unit='".$runit['id_unit']."'");
                            $jum=mysqli_num_rows($qsoal);
                            while($rsoal=mysqli_fetch_array($qsoal)){
                            ?>
                            <table width="100%">
                              <tr>
                                <td width="3%" align="center" valign="top" rowspan=6>
                                  <?php echo $bilangan++;?>.
                                </td>
                                <td colspan=3 width="97%" style="padding-bottom:5px;">
                                  <?php echo $rsoal['judul_soal'];?>
                                </td>
                              </tr>
                              <tr>
                                <td width="2%"><input type="radio" name="soal[<?php echo $rsoal['id_pilgan'];?>]" value="A" style="cursor:pointer;"></td>
                                <td width="2%">A.</td>
                                <td width="96%"><?php echo $rsoal['opsi_a'];?></td>
                              </tr>
                              <tr>
                                <td><input type="radio" name="soal[<?php echo $rsoal['id_pilgan'];?>]" value="B" style="cursor:pointer;"></td>
                                <td>B.</td>
                                <td><?php echo $rsoal['opsi_b'];?></td>
                              </tr>
                              <tr>
                                <td><input type="radio" name="soal[<?php echo $rsoal['id_pilgan'];?>]" value="C" style="cursor:pointer;"></td>
                                <td>C.</td>
                                <td><?php echo $rsoal['opsi_c'];?></td>
                              </tr>
                              <tr>
                                <td><input type="radio" name="soal[<?php echo $rsoal['id_pilgan'];?>]" value="D" style="cursor:pointer;"></td>
                                <td>D.</td>
                                <td><?php echo $rsoal['opsi_d'];?></td>
                              </tr>
                              <tr>
                                <td><input type="radio" name="soal[<?php echo $rsoal['id_pilgan'];?>]" value="E" style="cursor:pointer;"></td>
                                <td>E.</td>
                                <td><?php echo $rsoal['opsi_e'];?></td>
                              </tr>
                            </table>
                            <br>
                            <?php }?>

                            <?php if($jum<1){?>
                                  <div class="alert alert-danger text-center" role="alert">
                                    <i>Tidak ditemukan data soal</i>
                                  </div>
                              <?php }?>





                            <h6 class="accordion-button"><b>Soal Essai</b></h6>
                            <br>
                            <?php
                            $bilangan=1;
                            $qessai=mysqli_query($connect,"select * from tb_essai where id_unit='".$runit['id_unit']."'");
                            $jum2=mysqli_num_rows($qessai);
                            while($ressai=mysqli_fetch_array($qessai)){
                            ?>
                            <table width="100%">
                              <tr>
                                <td width="3%" align="center" valign="top" rowspan=2>
                                  <?php echo $bilangan++;?>.
                                </td>
                                <td colspan=3 width="97%" style="padding-bottom:5px;">
                                  <?php echo $ressai['soal'];?>
                                </td>
                              </tr>
                              <tr>
                                <td>
                                    <textarea name="" class="form-control"></textarea>
                                </td>
                              </tr>
                              
                            </table>
                            <br>
                            <?php }?>

                            <?php if($jum2<1){?>
                                  <div class="alert alert-danger text-center" role="alert">
                                    <i>Tidak ditemukan data soal</i>
                                  </div>
                              <?php }?>

                                
                          </div>
              </div>




              <?php if(($jum>0)&&($jum2>0)){?>
              <button class="btn btn-success scrollto d-inline-flex align-items-center justify-content-center align-self-center" style="width:100%;">
                  <span>Simpan Jawaban</span>
              </button>
              <?php }?>

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