File manager - Edit - /home/autoph/public_html/pms_v1/config/assignAccessRole.php
Back
<?php include_once("../../../cfg/conn.php"); //error_reporting(0); if(isset($_POST['asgn'])){ $myUserID = $_POST['myUserID']; echo "<input type='hidden' id='myUserID' value='$myUserID'>"; //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== $roleID = userProfileID($userID); include ("../functions/users.php"); $roleID = userProfileID($myUserID); $moduleID = 4; $add =checkViewAccessM1024($roleID, $moduleID)[1]; $edit =checkViewAccessM1024($roleID, $moduleID)[2]; $delete =checkViewAccessM1024($roleID, $moduleID)[3]; $print =checkViewAccessM1024($roleID, $moduleID)[4]; $download =checkViewAccessM1024($roleID, $moduleID)[5]; echo "<input type='hidden' id='addAccess' value='$add'>"; echo "<input type='hidden' id='editAccess' value='$edit'>"; echo "<input type='hidden' id='deleteAccess' value='$delete'>"; echo "<input type='hidden' id='printAccess' value='$print'>"; echo "<input type='hidden' id='downloadAccess' value='$download'>"; if($add == 1){$addButton = '';}else{$addButton='Disabled';} if($edit == 1){$editButton = '';}else{$editButton='Disabled';} if($delete == 1){$deletButton = '';}else{$deletButton='Disabled';} if($print == 1){$printButton = '';}else{$printButton='Disabled';} if($download == 1){$downloadButton = '';}else{$downloadButton='Disabled';} if(checkViewAccessM1024($roleID, $moduleID)[0] == 0){ echo " <center><img src='./images/locked_out_icon.png' width='100' style='margin-top:100px'><img></center> "; echo "<h4 class='text-center text-danger align-middle pt-5'> Access Denied </h4>"; echo "<p class='display-5 text-center text-danger'> Sorry, you are not authorized to access this page. <br>Please contact your system support for assistance. <br><br>Thank you! <br><br> </p>"; exit(); } //============================================================================================================== //VALIDATE ACCESS ============================================================================================== //============================================================================================================== ?> <div class="shadow-sm mb-3 pageHeaderContainer content-justify-right pt-2 pb-3" style="padding:0px;height:50px" > <div class="pageSearchHeader bg-white p-3 pt-1 col-lg-12 col-md-12 col-sm-12" > <h4 class="ml-1 mt-1"><i class="fa fa-user-circle-o text-danger"> Access Role Assignment: </i></h4> </div> <div class="pageSearchHeader bg-white p-1 pt-1 col-lg-12 col-md-12 col-sm-12 float-right"> <button type="button" class="btn btn-info float-right" id="goSearchRecord" style="float:rigth;width:20%;margin-left:3px">Search</button> <input class="form-control border p-3 float-right" type="search" onKeyUp="SearchEmployees()" placeholder="Search by Lastname / Firstname / Employee ID" id="searchText" id="searchText" style="margin:0px;min-width:250px;width:75%;float:left"> </div> </div> <!--########################################################################################--> <!--########################################################################################--> <div id="employeeData" class="col-xl-12 overflow-auto" style='height:600px'> <!--########################################################################################--> <!--########################################################################################--> <table class='table w-100'> <thead> <th>ID</th> <th>EMP. ID</th> <th>EMPLOYEE NAME</th> <th>COMPANY</th> <th>POSITION</th> <th>CURRENT ACCESS</th> <th></th> </thead> <?php $getEmp = "SELECT * FROM `pms_employee_data` WHERE deleted=0 ORDER BY last_name ASC LIMIT 50"; $qEmp = mysqli_query($conn,$getEmp); $statRow = mysqli_num_rows($qEmp); if($statRow > 0){ while($row = mysqli_fetch_array($qEmp)){ $myCompID = $row['comp_id']; $myDealID = $row['branch_id']; $myPosID = $row['position']; $role = $row['access_role']; $accSta = $row['account_status']; if($accSta==0){ $textColor = '#A09E9E'; }else{ $textColor = '#494A4B'; } ?><tr onclick="javascript:getInfo(this);"><?php echo "<td style='width:5%;color:$textColor'>".$row['id']."</td>"; echo "<td style='width:8%;color:$textColor'>".$row['emp_id']."</td>"; echo "<td style='width:23%;color:$textColor'>".$row['last_name'].", ".$row['first_name']."</td>"; echo "<td style='width:8%;color:$textColor'>"; $getCompany = "SELECT `comp_code` FROM `vts_company` WHERE `comp_id`='$myCompID'"; $getC = mysqli_query($conn,$getCompany); while($rowX = mysqli_fetch_array($getC)){ echo $rowX['comp_code']; } echo "</td>"; echo "<td style='width:16%;color:$textColor'>"; $getPos = "SELECT `position_name` FROM `pms_positions_tbl` WHERE `id`='$myPosID'"; $getP = mysqli_query($conn,$getPos); while($rowP = mysqli_fetch_array($getP)){ echo $rowP['position_name']; } echo "</td>"; echo "<td style='width:16%;color:$textColor'>"; $getFile = "SELECT `profile_name` FROM `user_profile` WHERE `id`='$role' LIMIT 1"; $qFile = mysqli_query($conn,$getFile); $pC = mysqli_num_rows($qFile); if($pC > 0){ while($pro = mysqli_fetch_array($qFile)){ echo $pro['profile_name']; } }else{ echo "Default"; } echo "</td>"; echo "<td style='width:3%;color:$textColor'>";?> <!--<abbr title='View KRA'><i class='fa fa-plus-circle' aria-hidden='true' style='cursor:pointer;color:green;float:right;font-size:18px'></i> </abbr>--> <i data-toggle="modal" data-target="#myModal" class="fa fa-list-ol" style='cursor:pointer;float:right;font-size:14px;color:$textColor'></i> <?php echo "</td>"; echo "<tr>"; } } ?> </table> <!--########################################################################################--> <!--########################################################################################--> </div> <!-- The Modal --> <div class="modal fade " id="myModal"> <div class="modal-dialog modal-md"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="FormTitle">ACCESS ROLE ASSIGNMENT</h4> <button type="button" class="close" data-dismiss="modal">×</button> </div> <!-- Modal body --> <div class="modal-body p-4"> <div class="form-group"> <label for="dealCode">EMPLOYEE REC.#:</label> <input disabled type="text" class="form-control w-75" id="employeeID" name="employeeID"> </div> <div class="form-group"> <label for="dealName">EMPLOYEE NAME:</label> <input disabled type="text" class="form-control radius-sm" id="employeeName" name="employeeName"> </div> <div class="form-group"> <label for="dealAddress">ACCESS ROLE:</label> <select <?php echo $addButton;?> name='newRoleID' id='newRoleID' class="form-select form-select-lg p-2 w-100 rounded-sm selectBG"> <option selected value="">-- SELECT --</option> <?php $sql = "SELECT * FROM user_profile WHERE deleted=0 ORDER BY `profile_name` ASC"; $getRole = mysqli_query($conn,$sql); $chkIfExist = mysqli_num_rows($getRole); if($chkIfExist > 0){ while($row = mysqli_fetch_array($getRole)){ echo "<option value='".$row['id']."'>".strtoupper($row['profile_name'])."</option>"; } } ?> </select> </div> </div> <!-- Modal footer --> <div class="modal-footer p-4"> <button <?php echo $addButton;?> type="button" class="btn btn-success pl-4 pr-4" data-dismiss="modal" id="saveNewPropile"> <span class="btn-label"><i class="fa fa-save"> Save</i></button> <button type="button" class="btn btn-danger" data-dismiss="modal"> <span class="btn-label"><i class="fa fa-close"> Close</i></button> </div> </div> </div> </div> <!--END OF MODAL FORM FOR ADD NEW AREA--> <?php } $conn->close(); ?> <script language="javascript" type="text/javascript"> $("#goSearchRecord").click(function(){ var myUserID = $("#myUserID").val(); var searchText = $("#searchText").val(); ShowUploadBar(); $.ajax({ url: "./config/loadEmployeeData.php", type: "POST", async: true, data: { "myUserID":myUserID, "searchText":searchText, "find": 1 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) }); $("#saveNewPropile").click(function(){ var myUserID = $("#myUserID").val(); var newRoleID = $("#newRoleID").val(); var employeeID = $("#employeeID").val(); ShowUploadBar(); $.ajax({ url: "./config/saveNewRole.php", type: "POST", async: true, data: { "myUserID":myUserID, "newRoleID":newRoleID, "employeeID":employeeID, "find": 2 //save profile }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) }); function SearchEmployees(){ var myUserID = $("#myUserID").val(); var searchText = $("#searchText").val(); ShowUploadBar(); $.ajax({ url: "./config/loadEmployeeData.php", type: "POST", async: true, data: { "myUserID":myUserID, "searchText":searchText, "find": 1 }, success: function(d){ $("#employeeData").html(d); ShowUploadBar(); } }) } function getInfo(row) { var x=row.cells; document.getElementById("employeeName").value = x[2].innerHTML; document.getElementById("employeeID").value = x[0].innerHTML; } </script>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings