<?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();

$log = new common();
$objadm = new class_admin();
$val = new validation();

$working_semester_number = $working_curriculum;

$objadm->ccl = $working_semester_number;
$result_course_list = $objadm->GetTempCourseList();
?>

<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">Manage Allocation</h5>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
                        <table class="table table-bordered align-middle">
                            <thead class="table" style="background: #f3e4c1;">
                                <tr>
                                    <th>#</th>
                                    <th>BSMS</th>
                                    <th>Credit</th>
                                    <th>PhD</th>
                                    <th>Credit</th>
                                    <th>Course Title</th>
                                    <th>Semester</th>
                                    <th>Slot</th>
                                    <th>Teacher</th>
                                    <th>Edit Teacher</th>
                                    <th>Edit Course</th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                $cn = 1;
                                while ($rowCl = mysqli_fetch_assoc($result_course_list)) {
                                    
                                    $objadm->sub_code = $rowCl['bsms_code'];
                                    $unique_code = $rowCl['unique_code'];
                                    

                                    $ResultTempFacList = $objadm->GetTempFacultyList();
                                    $fac_list = "";
                                    while ($rowFac = mysqli_fetch_array($ResultTempFacList)) {
                                        $fac_list = $fac_list . $rowFac['name'] . '<BR>';
                                    }
                                    ?>
                                    <tr>
                                        <td><?php echo $cn; ?></td>
                                        <td><?php echo $rowCl['bsms_code']; ?></td>
                                        <td><?php echo $rowCl['bsms_credit']; ?></td>
                                        <td><?php echo $rowCl['phd_code']; ?></td>
                                        <td><?php echo $rowCl['phd_credit']; ?></td>
                                        <td><?php echo $rowCl['title']; ?></td>
                                        <td><?php echo $rowCl['sem']; ?></td>
                                        <td><?php echo $rowCl['slot']; ?></td>
                                        <td>
                                            <?php echo $fac_list; ?>
                                        </td>
                                        <td class="text-center"><a href="course-teacher-allocation.php?IdStr=<?php echo $unique_code;  ?>" class="btn btn-primary shadow btn-xs sharp me-1"><i class="fa fa-pencil"></i></a></td> 
                                        <td class="text-center"><a href="course-curriculam-edit.php?IdStr=<?php echo $unique_code;  ?>" class="btn btn-primary shadow btn-xs sharp me-1"><i class="fa fa-pencil"></i></a></td>
                                    </tr>

                                <?php $cn=$cn+1; } ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>

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