 <?php 
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');

?>
                       
                        <div class="row">
                            <div class="col-xl-12">
                                <div class="card widget widget-list">
                                    <div class="card-header">
                                        <div class='col-md-12 notif'></div>
										
											 <h5 class="card-title">BACKUP SOAL</h5>
                                    </div>
                                    <div class="card-body">
                                   
                                       
                                                   <div class="table-responsive">
							   <table id="datatable1" class="table table-hover table-bordered" style="width:100%">
									<thead>
										<tr>
										<th width='5%'>NO</th>
										<th>KODE</th>
										<th width='5%'>TINGKAT</th>
										<th>KELAS</th>
										
										<th>GURU PENGAMPU</th>
										<th>JUMLAH</th>
										<th></th>
										</tr>
									</thead>
									<tbody>
									 <?php 
									 
									 $Q = mysqli_query($koneksi, "SELECT * FROM banksoal");
									 
									 ?>
									   <?php while ($bank = mysqli_fetch_array($Q)) : ?>
										<?php
										$kelas = fetch($koneksi,'kelas',['level' => $bank['level']]);
											$datakelas = unserialize($bank['kelas']);
										   $guru = fetch($koneksi,'users',['id_user' => $bank['idguru']]);	
											  $jumlahsoal = mysqli_num_rows(mysqli_query($koneksi, "SELECT * FROM soal WHERE id_bank='$bank[id_bank]'"));			   
											  $no++;
												   ?>
													<tr style="height:30px">
													 <td><?= $no ?></td>
													 <td><?= $bank['kode'] ?></td>
													 <td><?= $bank['level'] ?></td>
													 <td>
													 <?php foreach ($datakelas as $key => $value){
													 echo $value. "  " ;}
														 ?>
													 </td>
													 
													 <td><?= $guru['nama'] ?></td>		
													  <td><?= $jumlahsoal ?> soal</td>
													 <td style="text-align:center">
													 
													 <?php if (file_exists("asesmen/backup/".$bank['id_bank']."-".$bank['kode'].".zip")) { ?>
													 <a href="asesmen/backup/<?= $bank['id_bank'] ?>-<?= $bank['kode'] ?>.zip" class="btn-sm btn btn-primary" data-bs-toggle="tooltip" data-bs-placement="top" title="File Soal Gambar"><i class="material-icons">download</i></a>
													 <?php } ?>
													 <a href="asesmen/proses.php?id=<?= $bank['id_bank'] ?>" class="backup btn-sm btn btn-success" data-bs-toggle="tooltip" data-bs-placement="top" title="Backup Excel"><i class="material-icons">storage</i></a>
													
													</td>								
													</tr>
													<?php endwhile; ?>
												</tbody>
											</table>
											</div>
                                              
                                            
                                    </div>
                                </div>
                            </div>
                           
                            </div>
                       