Viewing file: portfolio.php (5.58 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<? include 'index_IncludeAdmin.php'; $_SESSION['page'] = 'portfolio.php';
$Row = "SELECT * FROM portfolio"; $RowQuery = mysqli_query($con,$Row) or die ("Error Query [".$Row."]"); $Num_Rows = mysqli_num_rows($RowQuery); $Per_Page = 20; // Per Page $Page = $_GET["Page"]; if(!$_GET["Page"]){ $Page=1; } $Prev_Page = $Page-1; $Next_Page = $Page+1; $Page_Start = (($Per_Page*$Page)-$Per_Page); if($Num_Rows<=$Per_Page){ $Num_Pages =1; } else if(($Num_Rows % $Per_Page)==0){ $Num_Pages =($Num_Rows/$Per_Page) ; } else{ $Num_Pages =($Num_Rows/$Per_Page)+1; $Num_Pages = (int)$Num_Pages; } $i=$Page_Start+1;
$portfolio_SL = $Row." ORDER BY portfolio_sort ASC LIMIT $Page_Start , $Per_Page "; $portfolio_QR = mysqli_query($con,$portfolio_SL);
?>
<!DOCTYPE html> <html> <head> <? include 'index_Head.php'; ?> </head> <body>
<? include 'index_Navbar.php'; ?> <div class="container-fluid"> <div class="row"> <div class="col-md-2" id="main-left"> <div class="row"> <div class="col-md-12"> <? include 'index_AdminMenu.php'; ?> </div> </div> </div> <div class="col-md-10"> <div class="row"> <div class="col-md-12"> <h3> จัดการ ผลงาน </h3> <hr> </div> </div> <? include 'index_Alerts.php'; ?> <div class="row"> <div class="col-md-12 br-margin2"> <a href="portfolio_add.php" class="btn btn-success"> <span class="glyphicon glyphicon-plus-sign"></span> เพิ่มผลงาน </a> </div> <div class="col-md-12"> <div class="panel panel-default"> <div class="panel-heading"> <div class="row"> <div class="col-md-6"> ผลงานทั้งหมด <span class="badge"> <? echo "$Num_Rows"; ?></span> </div> <div class="col-md-6 text-right" style="margin: -5px;"> <a class="btn btn-default" onclick="location.reload()"> รีเฟรชหน้า </a> <a class="btn btn-default" onclick="goBack()"> <span class="glyphicon glyphicon-backward"> </span> กลับ </a> </div> </div> </div> <div class="panel-body"> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th> # </th> <th> รูป </th> <th> ผลงาน </th> <th> ทีมงาน </th> <th> รายละเอียด , แก้ไข , ลบ </th> </tr> </thead> <tbody class="row_position"> <? while ($portfolio = mysqli_fetch_array($portfolio_QR)) { ?> <tr id="<?php echo $portfolio['portfolio_id'] ?>"> <td><? echo $i; ?></td> <td style="width: 150px;"> <a href="portfolio_one.php?portfolio_id=<?php echo $portfolio[portfolio_id]; ?>" > <div class="img70"> <img src="../Files/portfolio_photo/<?php echo $portfolio[portfolio_photo]; ?>" c /> </div> </a> </td> <td> <? echo $portfolio[portfolio_name]; ?> </td> <td> <? $salesteam_SL = " SELECT * FROM salesteam WHERE salesteam_id = '$portfolio[salesteam_id]'"; $salesteam_QR = mysqli_query($con,$salesteam_SL); $salesteam = mysqli_fetch_array($salesteam_QR); if (isset($salesteam[salesteam_name])&&trim($salesteam[salesteam_name])!='') { echo $salesteam[salesteam_name]; } else{ echo " - "; } ?> </td> <td> <a href="portfolio_one.php?portfolio_id=<?php echo $portfolio[portfolio_id]; ?>" class="btn btn-primary"> <span class="glyphicon glyphicon-zoom-in"></span> รายละเอียด </a> <a href="portfolio_update.php?portfolio_id=<?php echo $portfolio[portfolio_id]; ?>" class="btn btn-info"> <span class="glyphicon glyphicon-edit"></span> แก้ไข </a> <a href="portfolio_del.php?portfolio_id=<?php echo $portfolio[portfolio_id]; ?>" onclick="return confirm(' ยืนยันการลบข้อมูล ? ')" class="btn btn-danger"> <span class="glyphicon glyphicon-trash"></span> ลบ </a> </td> </tr> <? $i++; } ?> </tbody> </table> </div>
</div> <div class="panel-footer"> <? include 'index_Pagenum.php'; ?> </div> </div>
</div> <!-- 12 --> </div> <!-- row --> </div> <!-- 10 --> </div> <!-- row --> </div> <? $position = $_POST['position']; $portfolio_sort_i=1; foreach($position as $k=>$v){ $sql = "Update portfolio SET portfolio_sort=".$portfolio_sort_i." WHERE portfolio_id =".$v; $mysqli->query($sql); $portfolio_sort_i++; } ?> <script type="text/javascript"> $( ".row_position" ).sortable({ delay: 150, stop: function() { var selectedData = new Array(); $('.row_position>tr').each(function() { selectedData.push($(this).attr("id")); }); updateOrder(selectedData); } }); function updateOrder(data) { $.ajax({ url:"portfolio.php", type:'post', data:{position:data}, success:function(){ } }) } </script> </body> </html>
|