94 lines
3.0 KiB
PHP
94 lines
3.0 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('includes/auth/auth.php');
|
|
|
|
?>
|
|
<?php
|
|
// Connect to mysqli database
|
|
|
|
$page = 1; // The current page
|
|
$sortname = 'id'; // Sort column
|
|
$sortorder = 'asc'; // Sort order
|
|
$qtype = ''; // Search column
|
|
$query = ''; // Search string
|
|
// Get posted data
|
|
if (isset($_POST['page'])) {
|
|
$page = mysqli_real_escape_string($conn,$_POST['page']);
|
|
}
|
|
if (isset($_POST['sortname'])) {
|
|
$sortname = mysqli_real_escape_string($conn,$_POST['sortname']);
|
|
}
|
|
if (isset($_POST['sortorder'])) {
|
|
$sortorder = mysqli_real_escape_string($conn,$_POST['sortorder']);
|
|
}
|
|
if (isset($_POST['qtype'])) {
|
|
$qtype = mysqli_real_escape_string($conn,$_POST['qtype']);
|
|
}
|
|
if (isset($_POST['query'])) {
|
|
$query = mysqli_real_escape_string($conn,$_POST['query']);
|
|
}
|
|
if (isset($_POST['rp'])) {
|
|
$rp = mysqli_real_escape_string($conn,$_POST['rp']);
|
|
}
|
|
// Setup sort and search SQL using posted data
|
|
$sortSql = "order by $sortname $sortorder";
|
|
$searchSql = ($qtype != '' && $query != '') ? " where $qtype = '$query'" : '';
|
|
// Get total count of records
|
|
$sql = "select count(*) from tbl_tender_plateform $searchSql";
|
|
$result = mysqli_query($conn,$sql);
|
|
$row = mysqli_fetch_array($result);
|
|
$total = $row[0];
|
|
// Setup paging SQL
|
|
$pageStart = ($page-1)*$rp;
|
|
$limitSql = "limit $pageStart, $rp";
|
|
// Return JSON data
|
|
$data = array();
|
|
$data['page'] = $page;
|
|
$data['total'] = $total;
|
|
$data['rows'] = array();
|
|
$sql = "SELECT distinct(category) FROM rights_access $searchSql $sortSql $limitSql";
|
|
$results = mysqli_query($conn,$sql);
|
|
$count=1;
|
|
while ($row = mysqli_fetch_assoc($results)) {
|
|
|
|
$id_val=$row['access_id'];
|
|
|
|
|
|
$view_link="<a href='#' onclick=\"window.open('rights_access.php?acn=view&category=$category','mywindow','menubar=0,resizable=0,status=0,scrollbars=0,width=600,height=600,top=70,left=100')\"><span class=\"glyphicon glyphicon-eye-open\"></span></a>";
|
|
$edit_link="<a href='#' onclick=\"window.open('rights_access.php?acn=update&category=$category','mywindow','menubar=0,resizable=0,status=0,scrollbars=0,width=600,height=600,top=70,left=100')\"><span class=\"glyphicon glyphicon-pencil\"></span></a>";
|
|
$delete_link="<a href='#' onclick=deleterecord('rights_access.php?acn=delete&category=$category')><span class=\"glyphicon glyphicon-trash\"></span></a>";
|
|
|
|
/*
|
|
|
|
$sql_check_child="SELECT id FROM rights_access WHERE id NOT IN (SELECT tender_plateform FROM tbl_tenders_list) AND id = '".$id_val."'";
|
|
$res_check_child=@mysqli_query($conn,$sql_check_child);
|
|
|
|
$check_child_row = mysqli_fetch_array($res_check_child);
|
|
$num=$check_child_row[0];
|
|
|
|
|
|
if($num>0)
|
|
{
|
|
$delete_link=" ";
|
|
|
|
}*/
|
|
|
|
$category=$row['category'];
|
|
if($category=='T')
|
|
$category_name="Tender";
|
|
if($category=='Q')
|
|
$category_name="Quotation";
|
|
if($category=='P')
|
|
$category_name="Purchase Order";
|
|
if($category=='A')
|
|
$category_name="Amendments";
|
|
if($category=='C')
|
|
$category_name="Comparison";
|
|
|
|
$data['rows'][] = array(
|
|
'id' => $row['id'],
|
|
'cell' => array($count++, $category_name,$view_link, $edit_link, $delete_link)
|
|
);
|
|
}
|
|
echo json_encode($data);
|
|
?>
|