<?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();
$log = new common();
$objadm = new class_admin();
$val = new validation();

$status_type = $val->ValidateString($_REQUEST['tt']);

if ($status_type == 'All' or $status_type == '') {
    $res_faculty = $objadm->GetFacultyList();
}
if ($status_type == 'Left' or $status_type == 'Full' or $status_type == 'Away' or $status_type == 'Emeritus') {
    $objadm->fac_status = $status_type;
    $res_faculty = $objadm->GetFacultyList();
}
$i = 1;
?>
<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">Faculty Status</h5>

                </div>
                <div class="card-body">
                    <div class="tabs">
                        <a href="?tt=All">All Faculty</a>
                        <a href="?tt=Full">Full Faculty</a>
                        <a href="?tt=Emeritus">Emeritus Faculty</a>
                        <a href="?tt=Away">Faculty Away</a>
                        <a href="?tt=Left">Faculty Left</a>
                    </div>

                    <table class="table table-bordered course-table">
                        <thead>
                            <tr>
                                <th>#</th>
                                <th>Code</th>
                                <th>Name</th>
                                <th>Dept</th>
                                <th>Status</th>
                                <th>Email ID</th>
                                <th>DoB</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php while($row = mysqli_fetch_array($res_faculty)){  
                                
                                 $roll = $row["roll"]; 
		$status = $row["fac_status"];
                                ?>
                            <tr>
                                <td><?php echo $i; ?></td>
                                <td><?php echo $roll; ?></td>
                                <td><?php echo $row["name"] ?></td>
                                <td><?php echo $row["dept"] ?></td>
                                <td>
                                    	<FORM METHOD=POST ACTION="people-fac-status.php">
		<INPUT TYPE="hidden" NAME="fac_code" value="<?php echo $roll; ?>">
			<INPUT TYPE="submit" value="<?php echo $status ?>">
		</FORM>
                                </td>
                                <td><?php echo $row["email"]; ?></td>
                                <td><?php echo $row["dob"]; ?></td>
                            </tr>
                            <?php $i=$i+1; } ?>
                        </tbody>
                    </table>

                </div>

            </div>

        </div>

    </div>
</div>
<?php
$pagemaincontent = ob_get_contents();
ob_clean();
$PAGENAME = 'people-faculty';
$HTMLTITLE = '';
$HTMLDESCRIPTION = '';
$HTMLKEYWORDS = '';
include("admin-master.php");
?>