ok
Direktori : /home/keydecors/www/ca/admin/app/ |
Current File : /home/keydecors/www/ca/admin/app/select_testimonial.php |
<!DOCTYPE html> <html lang="en"> <head> <!-- Required meta tags --> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <title>Purple Admin</title> <!-- plugins:css --> <link rel="stylesheet" href="vendors/iconfonts/mdi/css/materialdesignicons.min.css"> <link rel="stylesheet" href="vendors/css/vendor.bundle.base.css"> <link rel="stylesheet" href="font-awesome-4.7.0/css/font-awesome.min.css"> <!-- endinject --> <!-- plugin css for this page --> <!-- End plugin css for this page --> <!-- inject:css --> <link rel="stylesheet" href="css/style.css"> <!-- endinject --> <link rel="shortcut icon" href="images/favicon.png" /> </head> <?php $sa = mt_rand(); ?> <body> <div class="container-scroller"> <!-- partial:../../partials/_navbar.html --> <nav class="navbar default-layout-navbar col-lg-12 col-12 p-0 fixed-top d-flex flex-row"> <div class="text-center navbar-brand-wrapper d-flex align-items-center justify-content-center"> <a class="navbar-brand brand-logo" href="index.html"><img src="images/logo.png" alt="logo"/></a> <a class="navbar-brand brand-logo-mini" href="index.html"><img src="images/logo-mini.svg" alt="logo"/></a> </div> <div class="navbar-menu-wrapper d-flex align-items-stretch"> <ul class="navbar-nav navbar-nav-right"> <li class="nav-item nav-profile dropdown"> <a class="nav-link dropdown-toggle" id="profileDropdown" href="#" data-toggle="dropdown" aria-expanded="false"> <div class="nav-profile-img"> </div> </a> <div class="dropdown-menu navbar-dropdown" aria-labelledby="profileDropdown"> <div class="dropdown-divider"></div> <a class="dropdown-item" href="logout_action.php"> <i class="mdi mdi-logout mr-2 text-primary"></i> Signout </a> </div> </li> <li class="nav-item d-none d-lg-block full-screen-link"> <a class="nav-link"> <i class="mdi mdi-fullscreen" id="fullscreen-button"></i> </a> </li> </ul> <button class="navbar-toggler navbar-toggler-right d-lg-none align-self-center" type="button" data-toggle="offcanvas"> <span class="mdi mdi-menu"></span> </button> </div> </nav> <!-- partial --> <div class="container-fluid page-body-wrapper"> <!-- partial:../../partials/_sidebar.html --> <?php include "sidemenu.php"; ?> <!-- partial --> <div class="main-panel"> <div class="content-wrapper"> <div class="col-12 grid-margin stretch-card"> <div class="card"> <div class="card-body"> <h4 class="card-title">Select testimonial</h4> <p class="card-description"> </p> <div class="row"> <div class="col-lg-10"> <table width="527%" height="159" class="table table-hover"> <thead> <tr> <th width="35%" align="center"> Name</th> <th width="35%" align="center"> Job</th> <th width="15%" align="left"><span>Actions</span></th> </tr> </thead> <tbody> <?php include("model/dboperation.php"); /* Place code to connect to your DB here. // include your code to connect to DB. $tbl_name="gallery"; //your table name // How many adjacent pages should be shown on each side? $tbl_name="gallery"; /* First get total idber of rows in data table. If you have a WHERE clause in your query, make sure you mirror it here. */$adjacents = 2; $tbl_name="testimonial"; $query = "SELECT COUNT(*) as ids FROM testimonial"; $result = $mysqli->query($query); $row=mysqli_fetch_array($result,MYSQLI_ASSOC); $total_pages = $row["ids"]; /* Setup vars for query. */ $targetpage = "select_testimonial.php"; //your file name (the name of this file) $limit = 10; //how many items to show per page @$page = $_GET['page']; if($page) $start = ($page - 1) * $limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 /* Get data. */ $sql = "SELECT name, job,ids FROM $tbl_name LIMIT $start, $limit"; $result = $mysqli->query($sql); /* Setup page vars for display. */ if ($page == 0) $page = 1; //if no page var is given, default to 1. $prev = $page - 1; //previous page is page - 1 $next = $page + 1; //next page is page + 1 $lastpage = ceil($total_pages/$limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 /* Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ $pagination = ""; if($lastpage > 1) { $pagination .= "<div class=\"pagination\">"; //previous button if ($page > 1) $pagination.= "<a href=\"$targetpage?page=$prev\"> previous</a>"; else $pagination.= "<span class=\"disabled\"> previous</span>"; //pages if ($lastpage < 7 + ($adjacents * 2)) //not enough pages to bother breaking it up { for ($counter = 1; $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\"> $counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\"> $counter</a>"; } } elseif($lastpage > 5 + ($adjacents * 2)) //enough pages to hide some { //close to beginning; only hide later pages if($page < 1 + ($adjacents * 2)) { for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //in middle; hide some front and some back elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2)) { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } $pagination.= "..."; $pagination.= "<a href=\"$targetpage?page=$lpm1\">$lpm1</a>"; $pagination.= "<a href=\"$targetpage?page=$lastpage\">$lastpage</a>"; } //close to end; only hide early pages else { $pagination.= "<a href=\"$targetpage?page=1\">1</a>"; $pagination.= "<a href=\"$targetpage?page=2\">2</a>"; $pagination.= "..."; for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++) { if ($counter == $page) $pagination.= "<span class=\"current\">$counter</span>"; else $pagination.= "<a href=\"$targetpage?page=$counter\">$counter</a>"; } } } //next button if ($page < $counter - 1) $pagination.= "<a href=\"$targetpage?page=$next\"> next </a>"; else $pagination.= "<span class=\"disabled\"> next </span>"; $pagination.= "</div>\n"; } ?> <?php while($row = mysqli_fetch_array($result)) { ?> <tr> <td align="left"><?php echo $row['name'];?></td> <td><?php echo $row['job'];?></td> <td><a href="update_testimonial.php?pro=<?php echo $row["ids"];?>"><i class="fa fa-pencil fa-2x" aria-hidden="true" ></i></a></td> <td><a href="controller/delete_testimonial.php?dete=<?php echo $row["ids"];?>"><i class="fa fa-trash fa-2x" aria-hidden="true"></i></a></td> </tr> <tr> <td> </td> <td> </td> <td> </td> <td> <br></td> <td> </td> <td> </td> </tr> <?php ?> <?php } ?> </table> <table width="100%" align="center"> <tr> <td align="center"><div class="pagination"> <?=$pagination?> </div></td> </tr> </table> </div> </div> </div> </div> </div> </div> <!-- content-wrapper ends --> <!-- partial:../../partials/_footer.html --> <footer class="footer"> <div class="d-sm-flex justify-content-center justify-content-sm-between"> <span class="text-muted text-center text-sm-left d-block d-sm-inline-block">Copyright © 2018 <a href="#" target="_blank">Bootstrap Dash</a>. All rights reserved.</span> <span class="float-none float-sm-right d-block mt-1 mt-sm-0 text-center">Hand-crafted & made with <i class="mdi mdi-heart text-danger"></i></span> </div> </footer> <!-- partial --> </div> <!-- main-panel ends --> </div> <!-- page-body-wrapper ends --> </div> <!-- container-scroller --> <!-- plugins:js --> <script src="vendors/js/vendor.bundle.base.js"></script> <script src="vendors/js/vendor.bundle.addons.js"></script> <!-- endinject --> <!-- Plugin js for this page--> <!-- End plugin js for this page--> <!-- inject:js --> <script src="js/off-canvas.js"></script> <script src="js/misc.js"></script> <!-- endinject --> <!-- Custom js for this page--> <!-- End custom js for this page--> </body> </html>