ok

Mini Shell

Direktori : /home2/selectio/www/y1jobportal.in/admin/data-tables/
Upload File :
Current File : //home2/selectio/www/y1jobportal.in/admin/data-tables/job_assign_data_table.php

<?php
include("../api/config/config.php");
$requestData = $_REQUEST;
$condition='';
session_start();



$status = $_POST['status'];
if(isset($status) && $status!=""){
    $condition.=" and tbl_job_vacancy.status = '".$status."' ";
}

if(isset($_POST['category_id']) && $_POST['category_id']!=""){
    $condition.=" and sub_category.id = '".$_POST['category_id']."' ";
    
    
}

if(isset($_POST['req_id']) && $_POST['req_id']!=""){
    $condition.=" and j.requirement_id = '".$_POST['req_id']."' ";
    
    
}



if(isset($_SESSION['y1_organization'])){
    $condition.=" and tbl_job_vacancy.client_id = '".$_SESSION['y1_organization']['id']."' ";
}


if($districtid!="" && $districtid!=NULL ){
    $condition.=" and customer.district_id = ".$districtid;
}




/*Fetch Database column Details*/
        $columns = array( 
            0 =>'id',
            1 =>'id',
            2 =>'id',
            3 => 'id',
            3 => 'id'
            
        );
        
 
        
/*Fetch Filter Data Start*/    
            $sql="SELECT j.*,
    sub_category.name as sub_category_name,
    customer.cust_firstname as employee_name,
    tbl_job_vacancy.job_vacancy,
    tbl_job_vacancy.minimum_experience,
    users.firstname, 
    users.lastname 
    FROM `tbl_job_assign` j
    LEFT JOIN tbl_job_vacancy ON tbl_job_vacancy.id=j.requirement_id
    LEFT JOIN customer ON customer.id=j.employee_id
    LEFT JOIN sub_category ON sub_category.id=tbl_job_vacancy.sub_category
    LEFT JOIN users ON users.id=j.created_by
WHERE 1=1 $condition";
        
        if( !empty($requestData['search']['value']) ) 
        {   
        	$sql.=" AND ( sub_category.name LIKE '%".$requestData['search']['value']."%' )"; 
        }
        $statement = $pdo->prepare($sql);
        $statement->execute();
		$query = $statement->fetchAll(PDO::FETCH_ASSOC);
        $totalFiltered = $statement->rowCount();
        $totalData = $statement->rowCount();
        
        /*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=$requestData['start']+1;
foreach($query as $row ) {  // preparing an array
	$nestedData=array(); 
	
	
	$action= "<div class='text-center'><div class='btn-group'>";

		               $action.="<a style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' href='recruitment_edit.php?id=".$row["id"]."' title='Edit Job Recruitment' class='tip btn btn-warning btn-xs'>
		                    <i class='bi bi-pencil'></i>
		                </a> ";
		                
		                $action.=" <button style='padding: 0px 0px 0px 5px; height: 30px; margin-right: 3px;' title='Delete Vacancy Details' onClick='delete_vacancy(".$row["id"].")' class='tip btn btn-danger btn-xs'>
		                    <i class='bi bi-trash3'></i>
		                </button>";
		                
		 	$action.="</div></div>";
		 	
	
	$created_user = $row['firstname']." ".$row['lastname'];
   
	$details1 = '<a ><b>'.$row['sub_category_name'].' (Jobs: '.$row['job_vacancy'].') <br>Experience ('.$row['minimum_experience'].')</b></a>';
	$details2 = '<a ><b>'.$row['employee_name'].'</b></a>';
	
	if($row['status']=="1"){
        $status="<span class='span-success' style='cursor: pointer;' onClick='DynamicInActive(".$row["id"].")'> Active </span>";	
    } else{
        $status="<span class='span-danger' style='cursor: pointer;' onClick='DynamicActive(".$row["id"].")'> In-Active </span>";
    }

    $nestedData[] = $action;
    $nestedData[] = $i;
    $nestedData[] = $details1;
    $nestedData[] = $details2;
    $nestedData[] = '<a ><b>'.date('d-m-Y', strtotime($row['interview_date'])).'</b></a>';
    $nestedData[] = '<a ><b>'.$created_user.'</b></a>';
    $nestedData[] = '<a ><b>'.date('d-m-Y h:i A', strtotime($row['created_at'])).'</b></a>';
    $nestedData[] = $status;

    
	$data[] = $nestedData;
	$i++;
}

$json_data = array(
			"draw"            => intval( $requestData['draw'] ),   // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw. 
			"recordsTotal"    => intval( $totalData ),  // total number of records
			"recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
			"data"            => $data   // total data array
			);

echo json_encode($json_data);  // send data as json format

?>

Zerion Mini Shell 1.0