ok
Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/data-tables/ |
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/data-tables/department-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'id', 2 =>'id', 3 =>'id' ); $conditions=""; /*$department=$_REQUEST['department']; if(!empty($department)){ $conditions.=" and h.departement ='$department'"; }*/ /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT * FROM tbl_department where status=1"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT * FROM tbl_department where id!=0 and status=1".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND (status LIKE '%".$_REQUEST['search']."%') "; } /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; error_log($sql); $statement = $pdo->prepare($sql); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $data = array(); $i=1; foreach( $query as $row ) { // preparing an array $nestedData=array(); $action= "<div class='text-center'><div class='btn-group'>"; /*$action.=" <a style='padding: 6px;margin-right: 3px;' href='banner-edit.php?id=".$row["id"]."' title='Edit Gallery' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a>"*/ $action.='<button style="padding: 6px;margin-right: 3px;" title="Delete PDF" onClick="delete_department('.$row["id"].')" class="tip btn btn-danger btn-xs"> <i class="fa fa-trash-o"></i> </button>'; if($row["status"]==1){ $status1='<button style="padding: 6px;margin-right: 3px;" class="tip btn btn-danger btn-xs"> Active </button>'; }else{ $status1='<button style="padding: 6px;margin-right: 3px;"class="tip btn btn-danger btn-xs"> Inactive </button>'; } $action.="</div></div>"; // $image_banner ='<img src="../'.$row['tbl_pdf'].'" style="width: 205px;" >'; $action.="</div></div>"; $nestedData[] = $action; $nestedData[] = $i; $nestedData[] = $row["department_name"]; //$nestedData[] = $row["file"]; $nestedData[] = $status1; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>