<?php
include_once '../session/admin-session.php';
include_once '../classes/class_admin.php';
include_once '../classes/validation.php';
include_once '../classes/common.php';
include_once 'read-configration.php';

ob_start();

$ObjDB = new class_db();
$objadm = new class_admin();
$val = new validation();

$for_sem = $val->ValidateString($_POST['for_sem']);
$sub_code = $val->ValidateString($_POST['sub_code']);

$objadm->sem_num = $for_sem;
$SemArr = $objadm->GetSemList();
while($res = mysqli_fetch_array($SemArr)){
    $for_sem_name =  $res["sem_name"];
}

$i = 1;
$qc = "select a.*, b.name from isr_reg_repeat_tbl a, isr_stu_main_tbl b where a.sub_code = '$sub_code' and a.stu_roll = b.roll order by a.stu_roll";
$ObjDB->sproc_name = $qc;
$res = $ObjDB->SelectQuery();
?>
<div class="container-fluid">
    <div class="row">
        <div class="col-xl-12 col-xxl-12 col-sm-12">
            <div class="card">
                <div class="card-header">
                    <h5 class="card-title">Grade I and F students: <?php echo $sub_code; ?></h5><br/><br/>
                    <h5 class="card-title">Courses of <?php echo $for_sem_name; ?></h5>
                </div>
                <div class="card-body">
                   
                        <div class="row">
                            <br/>
                            <div class="table-responsive">
                                <table class="table table-bordered align-middle" id="repeat_exam_List">
                                    <thead class="table" style="background: #f3e4c1;" >
                                        <tr>
                                            <th>#</th>
                                            <th>Roll Number</th>
                                            <th>Name of the Student</th>
                                            <th>Grade</th>
                                            <th>Semester</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                       <?php 
                                       while ($rc = mysqli_fetch_array($res)) {
	$stu_roll = $rc['stu_roll'];
	$stu_name = $rc['name'];
	$stu_grade = $rc['old_grade'];
	$when = $rc['which_sem'];
        
       $objadm->sem_num = $when;
$SemArr = $objadm->GetSemList();
while($res_name = mysqli_fetch_array($SemArr)){
    $sem_name =  $res_name["sem_name"];
}
	?>
                                        
                                            <TR>
	<td align=center><?php echo $i++; ?></td>
	<td align=left><?php echo $stu_roll; ?></td>
	<td align=left><?php echo $stu_name; ?></td>
	<td align=left><?php echo $stu_grade; ?></td>
        <td align=left><?php echo $sem_name; ?></td>
	</tr>
                                        
                                       <?php $i=$i+1; } ?>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                   
                </div>

            </div>
        </div>
    </div>
</div>
<?php
$pagemaincontent = ob_get_contents();
ob_clean();
$PAGENAME = 'registration-repeat-exam-list';
$HTMLTITLE = '';
$HTMLDESCRIPTION = '';
$HTMLKEYWORDS = '';
include("admin-master.php");
?>
<script type="text/javascript">
    $("#repeat_exam_List").DataTable({
        dom: '<"top"lBf>rt<"bottom"ip><"clear">',
        buttons: [
            {
                extend: 'excelHtml5',
                text: 'Download Excel',
                title: 'Data Export',
                className: 'btn btn-success'
            }
        ]
    });
</script>