GIF89a; CRX
KBHT HEHE
Server IP : 172.26.0.195  /  Your IP : 3.12.161.151
Web Server : Apache
System : Linux 43-205-77-33.cprapid.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64
User : jnclnmuac ( 1026)
PHP Version : 8.0.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/jnclnmuac/public_html/web/../admission/../cas/application/views/admin/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/jnclnmuac/public_html/web/../admission/../cas/application/views/admin/accountActivities.php
<!DOCTYPE HTML>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <title><?php echo (sizeof($empInfo)) ? stripslashes($empInfo[0]->tprfl_firstname . " " . $empInfo[0]->tprfl_lastname) . ": Account Activites" : "Employees' Account Activities"; ?> | College Automation System | <?php echo $this->session->userdata("adminData")["branch_short_name"]; ?></title>
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/style.css"); ?>">
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/bootstrap-select.min.css"); ?>" type='text/css'>
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/jquery.dataTables.min.css"); ?>" type='text/css' />
        <link rel="stylesheet" href="<?php echo base_url("assets/admin/css/buttons.dataTables.min.css"); ?>" type='text/css' />
        <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,800,900&amp;display=swap">
        <link rel="image icon" href="<?php echo base_url("assets/admin/images/logo.png"); ?>">
        <script src="<?php echo base_url("assets/admin/js/jquery-1.10.2.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/bootstrap-popper.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/bootstrap.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/jquery.dataTables.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/bootstrap-select.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/dataTables.buttons.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/jszip.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/pdfmake.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/vfs_fonts.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/buttons.print.min.js"); ?>"></script>
        <script src="<?php echo base_url("assets/admin/js/buttons.html5.min.js"); ?>"></script>
        <script>
            var csrfHash = '';
        </script>
    </head>
    <body class="cbp-spmenu-push">
        <div class="se-pre-con"></div>
        <section>
            <?php $this->load->view("admin/navAndHeader"); ?>
            <div class="main-content">
                <div class="container-fluid content-top-gap">
                    <nav aria-label="breadcrumb">
                        <ol class="breadcrumb my-breadcrumb">
                            <li class="breadcrumb-item"><a href="<?php echo site_url("admin/Dashboard"); ?>">Home</a></li>
                            <li class="breadcrumb-item active">Admin</li>
                            <li class="breadcrumb-item" aria-current="page"><a href="<?php echo site_url("admin/Authentication/accountActivities"); ?>">Employees' Account Activity</a></li>
                        </ol>
                    </nav>

                    <section class="forms">
                        <div class="card card_border p-4">
                            <h3 class="card__title"><i class="fa fa-user-secret"></i> All Employees Account Activity Tracker</h3><br>
                            <div class="card-body">
                                <?php if ($this->session->flashdata('successMessage')) { ?>
                                    <div class="alert alert-success"> <strong><?php echo $this->session->flashdata('successMessage'); ?></strong></div>
                                <?php } ?>
                                <?php if ($this->session->flashdata('errorMessage')) { ?>
                                    <div class="alert alert-danger"> <strong><?php echo $this->session->flashdata('errorMessage'); ?></strong> </div>
                                <?php } ?>
                                <fieldset>
                                    <legend>Select Employee</legend>
                                    <?php echo form_open(site_url('admin/Authentication/accountActivities'), ['name' => 'fetchAccountActivityFrm', 'id' => 'fetchAccountActivityFrm']); ?>
                                    <div class="form-row">
                                        <div class="form-group col-md-2">
                                            <label for="empRole" class="input__label">Role *</label>
                                            <select id="empRole" name="empRole" class="custom-select">
                                                <option value="" <?php echo set_select("empRole", "") ?>>Select Role</option>
                                                <?php foreach ($roles as $role) { ?>
                                                    <option value="<?php echo $role->role_id; ?>" <?php echo set_select("empRole", $role->role_id); ?>><?php echo stripslashes($role->role_name); ?></option>
                                                <?php }
                                                ?>
                                            </select>
                                        </div>
                                        <div class="form-group col-md-10">
                                            <label for="employee" class="input__label">Employee *</label>
                                            <select id="employee" name="employee" class="form-control selectpicker" data-selected-text-format="count > 1" data-dropup-auto="true" data-live-search="true" onmousedown="if (this.options.length > 2) {
                                                        this.size = 2;
                                                    }" title="Select Employee">
                                            </select>
                                        </div>
                                    </div>
                                    <div class="form-row">
                                        <div class="col-md-12">
                                            <label for="fetchAccountActivity" class="input__label"></label>
                                            <button type="submit" id="fetchAccountActivity" name="fetchAccountActivity" class="btn btn-sm btn-warning pull-right">Fetch Account Activity&nbsp;<i class="fa fa-arrow-left"></i></button>
                                        </div>
                                    </div>
                                    <hr>
                                    <?php echo form_close(); ?>
                                </fieldset>
                                <?php
                                if (sizeof($empInfo)) {
                                    $loginActiveStatus = "";
                                    if ($empInfo[0]->tld_delete_status == "F" && $empInfo[0]->tld_login_status == "T" && $empInfo[0]->tld_working_status != "L") {
                                        $loginActiveStatus = "<i class='fa fa-check' style='color:#00FF00;'></i> Active";
                                    } else if ($empInfo[0]->tld_delete_status == "F" && $empInfo[0]->tld_login_status == "F" && $empInfo[0]->tld_working_status != "L") {
                                        $loginActiveStatus = "<i class='fa fa-ban' style='color:#FF0000;'></i> Blocked";
                                    } else if ($empInfo[0]->tld_delete_status == "F" && $empInfo[0]->tld_working_status == "L") {
                                        $loginActiveStatus = "<i class='fa fa-user-times' style='color:#FF0000;'></i> Employee Left Organization";
                                    } else {
                                        $loginActiveStatus = "<i class='fa fa-trash' style='color:#FF0000;'></i> Employee Deleted";
                                    }
                                    ?>
                                    <fieldset id="empDetails">
                                        <legend>Employee Info</legend>
                                        <div>
                                            <table border="1" class="table table-success table-hover table-striped">
                                                <tr>
                                                    <td rowspan="3">
                                                        <a href="<?php echo base_url($empInfo[0]->staff_photograph); ?>" target="_blank" title="Click To Open Photograph"><img src="<?php echo base_url($empInfo[0]->staff_photograph); ?>" id="photograph" height="78px" alt="Photograph Not Available"/></a><br><br>
                                                    </td>
                                                    <th>Emp No.</th>
                                                    <td><b><span id="empNo" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo ($empInfo[0]->smember_code == "") ? "-" : stripslashes($empInfo[0]->smember_code); ?></span></b></td>
                                                    <th>Designation</th>
                                                    <td><b><span id="empDesig" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo stripslashes($empInfo[0]->designatioName); ?></span></b></td>
                                                    <th>Signin Id</th>
                                                    <td><b><span id="empSigninId" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo $empInfo[0]->tld_signinid; ?></span></b></td>
                                                </tr>
                                                <tr>
                                                    <th>First Name</th>
                                                    <td><b><span id="empFirstName" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo stripslashes($empInfo[0]->tprfl_firstname); ?></span></b></td>
                                                    <th>Last Name</th>
                                                    <td><b><span id="empLastName" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo ($empInfo[0]->tprfl_lastname == "") ? "-" : stripslashes($empInfo[0]->tprfl_lastname); ?></span></b></td>
                                                    <th>Gender</th>
                                                    <td><b><span id="empGender" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo ($empInfo[0]->tprfl_gender == "M") ? "<i class='fa fa-male'></i> Male" : (($empInfo[0]->tprfl_gender == "F") ? "<i class='fa fa-female'></i> Female" : "<i class='fa fa-transgender'></i> Trans"); ?></span></b></td>
                                                </tr>
                                                <tr>
                                                    <th>Category</th>
                                                    <td><b><span id="empCategory" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo stripslashes($empInfo[0]->dcm_short_name); ?></span></b></td>
                                                    <th>Sub. Dept</th>
                                                    <td><b><span id="empSubDept" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo stripslashes($empInfo[0]->sub_dept_name); ?></span></b></td>
                                                    <th>Department</th>
                                                    <td><b><span id="empDept" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo stripslashes($empInfo[0]->dept_name); ?></span></b></td>
                                                </tr>
                                                <tr>
                                                    <th>Login Status</th>
                                                    <td><b><span id="empLoginStatus" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo $loginActiveStatus; ?></span></b></td>
                                                    <th>Ever Logged In?</th>
                                                    <td><b><span id="empHaveLoggedIn" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo ($empInfo[0]->tld_is_first_login == "F") ? "Yes" : "No"; ?></span></b></td>
                                                    <th>Login Count</th>
                                                    <td><b><span id="empLoginCount" style="color:#002166;text-decoration: underline;font-size: smaller;"><?php echo $totLogins; ?></span></b></td>
                                                    <td><b><span id="empClearLogs" style="color:#002166;text-decoration: underline;font-size: smaller;"><a href="#" data-toggle="modal" data-target="#cnfClearLogModal">Click To Clear Logs Of This Employee</a></span></b></td>
                                                </tr>
                                            </table>
                                        </div>
                                        <input type="hidden" name="smember_id" value="<?php echo $empInfo[0]->smember_id; ?>">
                                    </fieldset>
                                    <?php if (sizeof($accountActivity)) { ?>
                                        <table id="empAccountActivities" class="bootstrap-datatable table-striped table-hover" style="width:100%">
                                            <thead>
                                                <tr>
                                                    <th>Sr. No</th>
                                                    <th style="display:none;">Emp. Code</th>
                                                    <th style="display:none;">First Name</th>
                                                    <th style="display:none;">Last Name</th>
                                                    <th style="display:none;">Signin Id</th>
                                                    <th style="display:none;">Category</th>
                                                    <th style="display:none;">Sub. Department</th>
                                                    <th style="display:none;">Department</th>
                                                    <th>Date</th>
                                                    <th>Login Time</th>
                                                    <th>Logout Time</th>
                                                    <th>Active Period</th>
                                                    <th>Terminal IP</th>
                                                    <th>Browser</th>
                                                    <th>Status</th>
                                                </tr>
                                            </thead>
                                            <tfoot>
                                                <tr>
                                                    <th>Sr. No</th>
                                                    <th style="display:none;">Emp. Code</th>
                                                    <th style="display:none;">First Name</th>
                                                    <th style="display:none;">Last Name</th>
                                                    <th style="display:none;">Signin Id</th>
                                                    <th style="display:none;">Category</th>
                                                    <th style="display:none;">Sub. Department</th>
                                                    <th style="display:none;">Department</th>
                                                    <th>Date</th>
                                                    <th>Login Time</th>
                                                    <th>Logout Time</th>
                                                    <th>Active Period</th>
                                                    <th>Terminal IP</th>
                                                    <th>Browser</th>
                                                    <th>Status</th>
                                                </tr>
                                            </tfoot>
                                            <tbody>
                                                <?php
                                                for ($i = 0; $i < sizeof($accountActivity); $i++) {
                                                    $record = $accountActivity[$i];
                                                    ?>
                                                    <tr>
                                                        <td><?php echo ($i + 1); ?></td>
                                                        <td style="display:none;"><?php echo ($empInfo[0]->smember_code == "") ? "-" : stripslashes($empInfo[0]->smember_code); ?></td>
                                                        <td style="display:none;"><?php echo stripslashes($empInfo[0]->tprfl_firstname); ?></td>
                                                        <td style="display:none;"><?php echo stripslashes($empInfo[0]->tprfl_lastname); ?></td>
                                                        <td style="display:none;"><?php echo $empInfo[0]->tld_signinid; ?></td>
                                                        <td style="display:none;"><?php echo stripslashes($empInfo[0]->dcm_short_name); ?></td>
                                                        <td style="display:none;"><?php echo stripslashes($empInfo[0]->sub_dept_name); ?></td>
                                                        <td style="display:none;"><?php echo stripslashes($empInfo[0]->dept_name); ?></td>
                                                        <td><?php echo date("d-m-Y", strtotime($record->access_login_at)); ?></td>
                                                        <td><?php echo date("h:i:s A", strtotime($record->access_login_at)); ?></td>
                                                        <td><?php echo ($record->access_logout_at == "" || $record->access_logout_at == NULL) ? "-" : date("h:i:s A", strtotime($record->access_logout_at)); ?></td>
                                                        <td>
                                                            <?php
                                                            if (!($record->access_logout_at == "" || $record->access_logout_at == NULL)) {
                                                                $first_date = new DateTime($record->access_login_at);
                                                                $second_date = new DateTime($record->access_logout_at);
                                                                $interval = $first_date->diff($second_date);
                                                                echo $interval->format('(%R)%H hrs : %I mins : %S secs');
                                                            } else {
                                                                echo "-";
                                                            }
                                                            ?>
                                                        </td>
                                                        <td><?php echo "<i class='fa fa-desktop'></i> " . $record->access_ip; ?></td>
                                                        <td>
                                                            <?php
                                                            if (strpos($record->access_browser_details, "Chrome") !== false) {
                                                                echo "<i title='Google Chrome' class='fa fa-chrome'></i> Google Chrome";
                                                            } else if (strpos($record->access_browser_details, "Firefox") !== false) {
                                                                echo "<i title='Mozilla Firefox' class='fa fa-firefox'></i> Mozilla Firefox";
                                                            } else if (strpos($record->access_browser_details, "Internet Explorer") !== false) {
                                                                echo "<i title='Internet Explorer' class='fa fa-internet-explorer'></i> IE";
                                                            } else if (strpos($record->access_browser_details, "Opera") !== false) {
                                                                echo "<i title='Opera' class='fa fa-opera'></i> Opera";
                                                            } else if (strpos($record->access_browser_details, "Safari") !== false) {
                                                                echo "<i title='Safari' class='fa fa-safari'></i> Safari";
                                                            } else {
                                                                echo "Others";
                                                            }
                                                            ?>
                                                        </td>
                                                        <td>
                                                            <?php
                                                            if ($record->access_active_status == "F") {
                                                                echo "<a href='#' class='badge badge-danger'>Closed</a>";
                                                            } else {
                                                                if ($i == 0) {
                                                                    echo "<a href='#' class='badge badge-success'>Active</a>";
                                                                } else {
                                                                    echo "<a href='#' class='badge badge-warning'>Unknown</a>";
                                                                }
                                                            }
                                                            ?>
                                                        </td>
                                                    </tr>
                                                <?php } ?>
                                            </tbody>
                                        </table>
                                        <?php
                                    } else {
                                        echo "<center><h4>No Account Activity Has Been Logged For Selected Employee.</h4></center>";
                                    }
                                }
                                ?>
                            </div>
                        </div>
                    </section>
                </div>
            </div>
        </section>
        <script>
            $("#empRole").on("change", function () {
                $(".se-pre-con").fadeIn("slow");
                if (csrfHash === '') {
                    csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
                }
                if ($(this).val().trim() !== "") {
                    $("#employee").html("<option value=''>Select Employee</option>");
                    $.ajax({
                        url: '<?php echo site_url('admin/Staff/getAllEmployeesByRoleForDropDown/'); ?>',
                        data: {role_id: $(this).val(), csrf_token: csrfHash},
                        type: 'POST',
                        async: false,
                        success: function (result) {
                            var employeeInfo = JSON.parse(result);
                            $(".se-pre-con").fadeOut("slow");
                            $("#employee").html(employeeInfo.emp_list);
                            $("#employee").selectpicker('refresh');
                            csrfHash = employeeInfo.csrfHash;
                            fetchAccountActivityFrm.csrf_token.value = csrfHash;
                        }
                    });
                } else {
                    $("#employee").html("<option value=''>Select Employee</option>");
                    $(".se-pre-con").fadeOut("slow");
                }
            });

            $(document).ready(function () {
                $("#empAccountActivities").DataTable({responsive: true, dom: 'Blfrtip', buttons: [
                        {extend: 'copy', text: "<i class='fa fa-clipboard'></i> Copy"},
                        {extend: 'csv', text: "<i class='fa fa-table'></i> CSV"},
                        {extend: 'excel', text: "<i class='fa fa-file-excel-o'></i> Excel"},
                        {extend: 'pdfHtml5', text: "<i class='fa fa-file-pdf-o'></i> PDF", orientation: 'landscape', pageSize: 'LEGAL'}
                    ]});

                if ($("#empRole").val().trim() !== "") {
                    $(".se-pre-con").fadeIn("slow");
                    if (csrfHash === '') {
                        csrfHash = '<?php echo $this->security->get_csrf_hash(); ?>';
                    }
                    $.ajax({
                        url: '<?php echo site_url('admin/Staff/getAllEmployeesByRoleForDropDown/'); ?>',
                        data: {role_id: $("#empRole").val().trim(), smember_id: '<?php echo (sizeof($empInfo)) ? $empInfo[0]->smember_id : ""; ?>', csrf_token: csrfHash},
                        type: 'POST',
                        async: false,
                        success: function (result) {
                            var employeeInfo = JSON.parse(result);
                            $(".se-pre-con").fadeOut("slow");
                            $("#employee").html(employeeInfo.emp_list);
                            $("#employee").selectpicker('refresh');
                            csrfHash = employeeInfo.csrfHash;
                            fetchAccountActivityFrm.csrf_token.value = csrfHash;
                        }
                    });
                } else {
                    $("#employee").html("<option value=''>Select Employee</option>");
                    $(".se-pre-con").fadeOut("slow");
                }
            });
        </script>
        <?php $this->load->view("admin/footer"); ?>
        <!-- Confirm Clear Log Modal -->
        <div class="modal fade" id="cnfClearLogModal" role="dialog" data-backdrop="static" data-keyboard="false">
            <div class="modal-dialog modal-dialog-centered">
                <div class="modal-content">
                    <div class="modal-header">
                        <h4 class="modal-title"><b>You Are About To Clear Log</b></h4>
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                    </div>

                    <div class="modal-body" style="max-height: calc(100vh - 160px);overflow-y: auto;">
                        <b>Click "Clear Logs Now" below if you really want to clear logs for this employee. Cleaning logs <span style='color:#FF0000;'>SAVES SERVER SPACE BUT ACCOUNT ACTIVITIES OF THE EMPLOYEE TILL NOW WILL ALSO BE LOST</span>. So it is <span style='color:#FF0000;'>HIGHLY RECOMMENDED TO TAKE BACKUP/EXPORT (if necessary) BEFORE CLEANING.</span></b><br><br><br>
                        <center><a class="btn btn-danger btn-sm" href="<?php echo site_url("admin/Authentication/clearAccessLogs/" . $empInfo[0]->smember_id); ?>"><i class='fa fa-trash-o'></i> Clear Logs Now</a>
                            &nbsp;&nbsp;<button class="btn btn-info btn-sm" data-dismiss="modal">Cancel</button></center>
                    </div>
                </div>
            </div>
        </div>
        <!-- Confirm Clear Log Modal -->
    </body>
</html>

KBHT - 2023