<?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;
$queryb1 = $objadm->GetSemList();
$rowb1 = mysqli_fetch_array($queryb1);
$for_sem_name = $rowb1["sem_name"];

$i = 1;
$qc = "select a.*, b.name, b.batch from isr_reg_repeat_tbl a, isr_stu_main_tbl b where a.sub_code = '$sub_code' and a.reg_status in ('P', 'T') and a.stu_roll = b.roll order by a.stu_roll";
$ObjDB->sproc_name = $qc;
$res_qc = $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; ?><BR><BR>Courses of <?php echo $for_sem_name ?> </h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <TABLE class="table table-bordered align-middle">
                            <tr>
                                <th></th>
                                <th>Batch</th>
                                <th>S</th>
                                <th>Roll</th>
                                <th>Name of the student</th>
                                <th>Old</th>
                                <th>New</th>
                            </tr>
                            <?php while($rc = mysqli_fetch_array($res_qc)){ 
                                
        $stu_roll = $rc['stu_roll'];
	$stu_name = $rc['name'];
	$batch = $rc['batch'];
	$status = $rc['reg_status'];

	$stu_grade = $rc['old_grade'];
	$new_grade = $rc['new_grade'];

	$when = $rc['which_sem'];
        $objadm->sem_num = $when;
        $queryb1 = $objadm->GetSemList();
        $row_queryb1 = mysqli_fetch_array($queryb1);
	$sem_name = $row_queryb1['sem_name'];
                                ?>
                            <tr>
	<td align=center><?php echo $i++; ?></td>
	<!-- <td align=center><?php echo $rb['flag_user']; ?></td> -->
	<td><?php echo $batch; ?></td>
	<td><?php echo $status; ?></td>
	<td><?php echo $stu_roll; ?></td>
	<td><?php echo $stu_name; ?></td>
	<td><?php echo $stu_grade; ?></td>
	<td><?php echo $new_grade; ?></td>
                            </tr>
                            
                            <?php } ?>
                            
                            <tr><td align=center colspan="7">
<FORM METHOD=POST ACTION="control-repeat-exam-save.php">
<INPUT TYPE="hidden" name="sub_code" value="<?php echo $sub_code; ?>">

	<INPUT TYPE="submit" name="approve" value="Approve" class="btn btn-danger"/>
	</FORM>
</td></tr>
                            
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<?php
$pagemaincontent = ob_get_contents();
ob_clean();
$PAGENAME = 'control-repeat-exam-subject';
$HTMLTITLE = '';
$HTMLDESCRIPTION = '';
$HTMLKEYWORDS = '';
include("admin-master.php");
?>