ok
Direktori : /home2/selectio/public_html/tnpsctestbatch.com/admin/data-tables/ |
Current File : /home2/selectio/public_html/tnpsctestbatch.com/admin/data-tables/topic-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $requestData= $_REQUEST; if($requestData['length']==-1){ $requestData['length']=100000; } /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'home_type', 2 =>'id', 3 =>'home_news_content', 4 =>'id' ); $conditions=""; // $department=$_REQUEST['department']; // if(!empty($department)){ // $conditions.=" and tbl_topic.departement ='$department'"; // } /*Fetch All Data Start*/ // $statement = $pdo->prepare("SELECT * FROM `tbl_standard` ORDER BY `standard` DESC"); $statement = $pdo->prepare("SELECT tbl_topic.*,tbl_subject.subject_name, tbl_standard.standard FROM `tbl_topic` LEFT JOIN tbl_subject ON tbl_subject.id=tbl_topic.subject_id LEFT JOIN tbl_standard ON tbl_standard.id=tbl_topic.standard_id ORDER BY `id` ASC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT tbl_topic.*,tbl_subject.subject_name, tbl_standard.standard FROM `tbl_topic` LEFT JOIN tbl_subject ON tbl_subject.id=tbl_topic.subject_id LEFT JOIN tbl_standard ON tbl_standard.id=tbl_topic.standard_id where tbl_topic.id!=0".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( h. id LIKE '%".$_REQUEST['search']."%') "; } /*Fetch Filter Data End*/ $sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; $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(); $nestedData[] = "<div class='text-center'><div class='btn-group'> <a style='padding: 6px;margin-right: 3px;' href='topic-edit.php?id=".$row["id"]."' title='Edit Subject' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a> <button style='padding: 6px;margin-right: 3px;' value='11' title='Delete Course' onClick='delete_topic(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='fa fa-trash-o'></i> </button> </div></div>"; $nestedData[] = $i; $nestedData[] = $row['subject_name']; $nestedData[] = $row['standard']; $nestedData[] = $row['topic']; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>