<?php 
ini_set('memory_limit','-1');
// reference the Dompdf namespace
ini_set('max_execution_time', 0);
require_once '../../masterpage/webservice_master.php'; 
	
	header("Access-Control-Allow-Origin: *");
	$surveyor_ID=$_POST['surveyor_ID'];
	//$surveyor_ID="12";

if($surveyor_ID!=''){
	
	$rows = $obj->customeQuery('SELECT lfs_asign_survey.project_ID, lfs_full_door_cate_additional_fields.* FROM lfs_asign_survey join lfs_firedoor_survey ON lfs_asign_survey.project_ID = lfs_firedoor_survey.project_ID join lfs_full_door_cate_additional_fields ON lfs_firedoor_survey.firedoor_ID = lfs_full_door_cate_additional_fields.firedoor_ID WHERE lfs_asign_survey.surveyor_ID ='.$surveyor_ID.' AND surveyType_ID=2 AND lfs_asign_survey.isActive = 1 AND lfs_asign_survey.isDelete = 0 AND  	lfs_asign_survey.isCompletedBySurveyor=0');
	
	$p=0;

	$rowdata=array();
		foreach ($rows  as $key => $value) {
		       // echo $key.'=>'. $value['additional_image1'].'<br>';
		       $rowdata[$key]['addfield_ID']=$value['addfield_ID'];
		       $rowdata[$key]['firedoor_ID']=$value['firedoor_ID'];
		       $rowdata[$key]['category_ID']=$value['category_ID'];
		       $rowdata[$key]['additional_info']=$value['additional_info'];
		       if($value['additional_image1']!=''){
		           // echo $key."<br>";
		           	$image_url = file_get_contents('../../../images/door_images/'.$value['additional_image1']);
				 $rowdata[$key]['additional_image1']=base64_encode($image_url);
				//echo "<br>";
		         }else{
		           $rowdata[$key]['additional_image1']=$value['additional_image1'];   
		         }
		         if($value['additional_image2']!=''){
		           	$image_url1 = file_get_contents('../../../images/door_images/'.$value['additional_image2']);
				$rowdata[$key]['additional_image2']=base64_encode($image_url1);
		         }else{
		              $rowdata[$key]['additional_image2']=$value['additional_image2'];
		         }
		       $rowdata[$key]['isDelete']=$value['isDelete'];

	$p++;
		}
}
// echo "<pre>";
//  print_r($rowdata);
// exit;
	if(!empty($rowdata)){
		echo json_encode($rowdata);
	}
	else
	{
		echo json_encode(0);
	}

?>
