ok
Direktori : /home2/selectio/www/pvmatricschool.com/admin/data-tables/ |
Current File : /home2/selectio/www/pvmatricschool.com/admin/data-tables/mobile-email-data-table.php |
<?php ob_start(); session_start(); include"../config/config.php"; $allPermissions=$_SESSION['permission']; $requestData= $_REQUEST; /*Fetch Database column Details*/ $columns = array( 0 =>'id', 1 =>'g_id', 2 =>'name', 3 =>'mobile', 4 =>'desgination_id', 5 =>'code', 6 =>'alter_mobile', 7 =>'id', 8 =>'id', 9 =>'id', 10 =>'id', 11 =>'id', 12 =>'id' ); $conditions=""; if(isset($_POST['department_id']) && $_POST['department_id']!=''){ $conditions.=" and h.designation ='".$_POST['department_id']."'"; } /*Fetch All Data Start*/ $statement = $pdo->prepare("SELECT h.* FROM tbl_mobile h where h.id!=0 ".$conditions." ORDER BY h.id DESC"); $statement->execute(); $query = $statement->fetchAll(PDO::FETCH_ASSOC); $totalData = $statement->rowCount(); $totalFiltered = $totalData; /*Fetch All Data End*/ /*Fetch Filter Data Start*/ $sql="SELECT h.* FROM tbl_mobile h where id!=0".$conditions; if( !empty($_REQUEST['search']) ) { $sql.=" AND ( h.employee_name 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(); $action= "<div class='text-center'><div class='btn-group'>"; if($_SESSION['hrm']['id']==1 || $allPermissions['mobile']['update']=="1"){ $action.=" <a style='padding: 6px;margin-right: 3px;' href='edit-email-mobile-icom.php?id=".$row["id"]."' title='Edit Mobile/Email/Icom' class='tip btn btn-warning btn-xs'> <i class='fa fa-edit'></i> </a>"; } if($_SESSION['hrm']['id']==1 || $allPermissions['mobile']['delete']=="1"){ $action.=" <button style='padding: 6px;margin-right: 3px;' title='Delete Consignor Details' onClick='delete_mobile(".$row["id"].")' class='tip btn btn-danger btn-xs'> <i class='fa fa-trash-o'></i> </button>"; } $action.="</div></div>"; $nestedData[] = $action; $nestedData[] = $i; /*$nestedData[] = $row["g_id"];*/ if($row["g_id"]==1){ $nestedData[] ="Executive";}if($row["g_id"]==2){ $nestedData[] ="Department Mobile";}else{$nestedData[] ="Department Intercom";} $nestedData[] = $row["employee_name"]; $nestedData[] = $row["mobile_no"]; $nestedData[] = $row["designation"]; $nestedData[] = $row["code"]; $nestedData[] = $row["email"]; $nestedData[] = $row["alter_mobile"]; $nestedData[] = $row["employee_ord"]; $nestedData[] = $row["icom"]; $nestedData[] = $row["icom_bak"]; if($row["status"]==1){ $nestedData[] ="<span class='btn btn-success btn-xs'><i class='fa fa-eye'></i> Active</span>";}else{$nestedData[] ="<span onClick='dynamic_active(".$row["id"].")' class='btn btn-danger btn-xs'><i class='fa fa-eye-slash'> In-active</span>";} // if($row["date"]!=""){ $nestedData[] =date('d-m-Y', strtotime($row["date"]));}else{$nestedData[] ="";} // $nestedData[] = $row["circular_tittle"]; /*if($row["updated_at"]!=""){ $nestedData[] =date('d-m-Y h:i:s A', strtotime($row["updated_at"]));}else{$nestedData[] ="";}*/ // $nestedData[] = $row["created_by_name"]; // $nestedData[] = $row["updated_by_name"]; $data[] = $nestedData; $i++; } $json_data = array( "draw" => intval( $requestData['draw'] ), "recordsTotal" => intval( $totalData ), "recordsFiltered" => intval( $totalFiltered ), "data" => $data ); echo json_encode($json_data); ?>