File "user.php"

Full Path: /home/ccipcixf/public_html/hirepro/a_company/user.php
File size: 4.95 KB
MIME-type: text/x-php
Charset: utf-8

<?php
session_start();
if (isset($_SESSION['company_a_role']) && $_SESSION['company_a_role'] !== "A") {
  header("location:index.php");
  exit(); // Add an exit to stop further execution after redirection
}
include "menu.php";
$title = "Company A";

$juniorLevelTotalMarks="90";
$MidLevelTotalMarks="54";
$seniorLevelTotalMarks="54";

?>

<?php if (isset($_SESSION["company_a_role"]) == "A") : ?>

  <!DOCTYPE html>
  <html lang="en" class="light-style layout-menu-fixed" dir="ltr" data-theme="theme-default" data-assets-path="../assets/" data-template="vertical-menu-template-free">

  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
    <title><?php echo $title ?></title>
    <meta name="description" content="" />
    <link rel="stylesheet" href="//cdn.datatables.net/1.13.7/css/jquery.dataTables.min.css">
  </head>

  <body>
    <!-- Content wrapper -->
    <div class="content-wrapper">
      <!-- Content -->

      <div class="container-xxl flex-grow-1 container-p-y">
        <a href="downloadexcel.php"><button class=" btn btn-primary  float-end mt-3 mb-2 ms-3" style="background: linear-gradient(#0052D4, #2B32B2 );padding-right: 10px;">Excel File <i class="menu-icon tf-icons bx bx-download ms-2"></i></button></a>
        <!-- <a href="EMS_form.php"><button class=" btn btn-primary  float-end mt-3 mb-2" style="background: linear-gradient(#0052D4, #2B32B2 );">Add New Form</button></a> -->

        <h4 class="fw-bold py-3 mb-4"><span class="text-muted fw-light"><?php echo $title . " " . "Users" ?></h4>

        <!-- Basic Bootstrap Table -->


        <!-- Striped Rows -->
        <div class="card p-2">
          <div class="table-responsive ">
            <?php

            include "config.php";

            $query = "SELECT * FROM `a_questionnaire`";

            $result = mysqli_query($conn, $query);

            if (mysqli_num_rows($result) > 0) {

              // echo "<pre>";
              // print_r($result);



            ?>
              <table id="myTable2" class="table table-striped   table-bordered no-wrap" style="text-align: center;">

                <thead>
                  <tr>
                    <th>ID</th>
                    <th>Position</th>
                    <th>Name</th>
                    <th>Email</th>
                    <th>Designation</th>
                    <th>Phone no</th>
                    <th>City</th>
                    <th class="text-center">Total Marks %</th>
                    <th>Results</th>
                  </tr>
                </thead>
                <tbody class="table-border-bottom-0">
                  <?php

                  while ($row = mysqli_fetch_assoc($result)) {

                  ?>
                    <tr>
                      <td class='id'><?php echo $row["id"] ?></td>
                      <td><?php echo $row["position_level"] ?></td>
                      <td><?php echo $row["name"] ?></td>
                      <td><?php echo $row["email"] ?></td>
                      <td class="text-center"><?php echo $row["designation"] ?></td>
                      <td><?php echo $row["phone"] ?></td>
                      <td><?php echo $row["city"] ?></td>
                     <?php if($row["position_level"] == "Junior Level"){ ?>
                      <td><?php echo number_format($row["total_rating"]/$juniorLevelTotalMarks*100 , 1, '.', ',') ?>%</td>
                      <?php }elseif($row["position_level"] == "Mid Level"){ ?>
                        <td><?php echo number_format($row["total_rating"]/$MidLevelTotalMarks*100 , 1, '.', ',') ?>%</td>
                        <?php }elseif($row["position_level"] == "Senior Level"){ ?>
                        <td><?php echo number_format($row["total_rating"]/$seniorLevelTotalMarks*100 , 1, '.', ',') ?>%</td>
                          <?php }else{
                            echo "No Position Found";
                          }?>
                      <td class='view'><a href='users_view.php?id=<?php echo $row["id"] ?>&level=<?php echo $row['position_level'] ?>'><i class="bx bx-show me-1" style="color: #0350d2;"></i></a></td>
                      <!-- <td class='delete'><a href='users_view.php?id=<?php echo $row["id"] ?>'><i class="bx bx-trash me-1" style="color: #0350d2;"></i></a></td> -->
                    </tr>
                  <?php } ?>



                </tbody>
              </table>
          </div>
        </div>
      <?php } ?>
      <!--/ Striped Rows -->
      <hr class="my-5" />
      </div>
      <!-- / Content -->
      <script src="https://code.jquery.com/jquery-3.7.0.js"></script>
      <script src="https://cdn.datatables.net/1.13.7/js/jquery.dataTables.min.js"></script>
  <script>
    $(document).ready(function() {
      $('#myTable2').DataTable();
    });
  </script>
  </body>


  </html>
<?php endif; ?>