Mini Shell

Direktori : /proc/thread-self/root/home/mhcadmin/.trash/IMS/
Upload File :
Current File : //proc/thread-self/root/home/mhcadmin/.trash/IMS/AccessLevelListing.php

<?php
session_start();
require_once './config/config.php';
require_once 'includes/auth_validate.php';

require_once 'AccessControl.php';
if ($ManageAccessLevels  == 1) { 


$result = mysqli_query( $connection,"SELECT  count(accesslevelmanagementID) FROM accesslevelmanagement ORDER BY accesslevelmanagementID DESC");
			// $count=mysqli_num_rows($result);
	
			
			
//======= code for pagination =============================
//$query=mysqli_query($connection,"select count(id) from `customers`");
$row = mysqli_fetch_row($result);

	$rows = $row[0];
	
	$page_rows = 10;

	$last = ceil($rows/$page_rows);

	if($last < 1){
		$last = 1;
	}

	$pagenum = 1;

	if(isset($_GET['pn'])){
		$pagenum = preg_replace('#[^0-9]#', '', $_GET['pn']);
	}

	if ($pagenum < 1) { 
		$pagenum = 1; 
	} 
	else if ($pagenum > $last) { 
		$pagenum = $last; 
	}

	$limit = 'LIMIT ' .($pagenum - 1) * $page_rows .',' .$page_rows;

	$result = mysqli_query( $connection,"SELECT * FROM accesslevelmanagement  $limit");
	
	//$nquery=mysqli_query($connection,"select * from `customers` $limit");

	$paginationCtrls = '';

	if($last != 1){
		
	if ($pagenum > 1) {
        $previous = $pagenum - 1;
		$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$previous.'" class="btn btn-default">Previous</a> &nbsp; &nbsp; ';
		
		for($i = $pagenum-4; $i < $pagenum; $i++){
			if($i > 0){
		        $paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'" class="btn btn-default">'.$i.'</a> &nbsp; ';
			}
	    }
    }

	$paginationCtrls .= ''.$pagenum.' &nbsp; ';
	
	for($i = $pagenum+1; $i <= $last; $i++){
		$paginationCtrls .= '<a href="'.$_SERVER['PHP_SELF'].'?pn='.$i.'" class="btn btn-default">'.$i.'</a> &nbsp; ';
		if($i >= $pagenum+4){
			break;
		}
	}

    if ($pagenum != $last) {
        $next = $pagenum + 1;
        $paginationCtrls .= ' &nbsp; &nbsp; <a href="'.$_SERVER['PHP_SELF'].'?pn='.$next.'" class="btn btn-default">Next</a> ';
    }
	}
// ======================= end of code for pagination ===============================================================================
//=========code ija tachotsa apache_child_terminate

			 

include_once 'includes/header.php';


if($_SERVER["REQUEST_METHOD"] == "POST") {
   
	 $search_string = $_POST["search_string"];

if (!empty($search_string)){
	
	
 $result = mysqli_query( $connection,"SELECT * FROM accesslevelmanagement WHERE AccessName LIKE '%$search_string%' ");
			 $count=mysqli_num_rows($result);
			 
      

  }
	
}

?>


 <style>
.tooltip {
  position: top;
  display: inline-block;
  border-bottom: 1px dotted black;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: black;
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 0;

  /* Position the tooltip */
  position: absolute;
  z-index: 1;
}

.tooltip:hover .tooltiptext {
  visibility: visible;
}
</style>

<!--Main container start-->
<div id="page-wrapper">
    <div class="row">

        <div class="col-lg-6">
            <h1 class="page-header">Manage Access Levels</h1>
        </div>
        <div class="col-lg-6" style="">
            <div class="page-action-links text-right">
	            <a href="AddAccessLevel.php?operation=create">
	            	<button class="btn btn-success"><span class="glyphicon glyphicon-plus"></span> Add new </button>
	            </a>
				
				<a href="AccessLevelListing.php">
	            	<button class="btn btn-success"><span class="glyphicon glyphicon-refresh"></span> Refresh </button>
	            </a>
            </div>
        </div>
    </div>
        <?php include('./includes/flash_messages.php') ?>
    <!--    Begin filter section-->
    <div class="well text-center filter-form">
        <form class="form form-inline" action="" method="POST">
            <label for="input_search" ">Type Access Level Name to Search</label>
			<input type="text" class="form-control" id="input_search"  required="required" placeholder="type here" name="search_string" >
            
            <input type="submit" value="Go" class="btn btn-primary">
            
        </form>
    </div>
<!--   Filter section end-->

    <hr>


    <table class="table table-striped table-bordered table-condensed">
        <thead>
            <tr>
               
                <th>Name</th>
                <th colspan = "2">Actions</th>
                 
            </tr>
        </thead>
         <tbody>               
                        <?php
						echo "<tr>";
						  //while($rws=  mysql_fetch_array($result))
                        	while($row = mysqli_fetch_array($result)){
                            echo "<td>".$row['AccessName']."</td>";
                            
						?>                
					<td><a href="UpdateAccessLevel.php?Access_id=<?php echo $row['accesslevelmanagementID'] ?>&operation=edit" class="btn btn-primary"><span class="glyphicon glyphicon-edit"></span>
                    </td><td>
                    <a href=""  class="btn btn-danger delete_btn" data-toggle="modal" data-target="#confirm-delete-<?php echo $row['accesslevelmanagementID'] ?>" ><span class="glyphicon glyphicon-trash"></span>
				      </td></tr>
					
					
					 
					 
                     <!-- Delete Confirmation Modal-->
					 <div class="modal fade" id="confirm-delete-<?php echo $row['accesslevelmanagementID'] ?>" role="dialog">
					    <div class="modal-dialog">
					      <form action="DeleteAccessLevel.php" method="POST">
					      <!-- Modal content-->
						      <div class="modal-content">
						        <div class="modal-header">
						          <button type="button" class="close" data-dismiss="modal">&times;</button>
						          <h4 class="modal-title">Confirm</h4>
						        </div>
						        <div class="modal-body">
						      
						        		<input type="hidden" name="del_id" id = "del_id" value="<?php echo $row['accesslevelmanagementID'] ?>">
						        	
						          <p>Are you sure you want to delete this record?</p>
						        </div>
						        <div class="modal-footer">
						        	<button type="submit" class="btn btn-default pull-left">Yes</button>
						         	<button type="button" class="btn btn-default" data-dismiss="modal">No</button>
						        </div>
						      </div>
					      </form>
					      
					    </div>
  					</div>

					 <?php } ?>

				</tbody>
                    </table>
                      <div id="pagination_controls" align= 'center'><?php echo $paginationCtrls; ?></div>                                                             
                    
<?php }else { header('location:AccessLevelMessage.php');} ?>

<?php include_once 'includes/footer.php'; ?>