diff --git a/api/application/controllers/Flyhi_Controller.php b/api/application/controllers/Flyhi_Controller.php index 89bd8f86..a6666c5d 100644 --- a/api/application/controllers/Flyhi_Controller.php +++ b/api/application/controllers/Flyhi_Controller.php @@ -717,6 +717,7 @@ class Flyhi_Controller extends REST_Controller { $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $pd_id); // $where_condition_array = array('SALES_PD_DATA.sales_pd_id' => $flyhipd_id); $flyhipd_data = $this->Flyhi_Model->getJoinRecords($columns,$table,$joins,$where_condition_array); + // print_r($flyhipd_data);die(); $pd_type = ""; if($flyhipd_data[0]['sales_pd_type'] == 3){$pd_type = "Workplace FI PD-"; }else if($flyhipd_data[0]['sales_pd_type'] == 4){$pd_type = "Residence FI PD-";} // print_r($flyhipd_data);die(); @@ -738,8 +739,10 @@ class Flyhi_Controller extends REST_Controller { mkdir($this->external_path.'/sales_pd/'.$pd_id,0777); } - if(!$flyhipd_data[0]['is_pdf'] || $flyhipd_data[0]['is_edited']) - //if(1) + $all_section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC'); + // print_r($all_section_data);die(); + // if(!$flyhipd_data[0]['is_pdf'] || $flyhipd_data[0]['is_edited']) + if(1) { $all_section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $pd_id,'isactive' => 1),SALESPD_SECTION_DATA,array(),'','section_id','ASC'); @@ -758,6 +761,19 @@ class Flyhi_Controller extends REST_Controller { $section_fields['section'.$section['section_id'] ] = $this->processFlyhiPDJSON($section); } $view_data['section9'] = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $pd_id,'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS); + if($view_data['section9']){ + foreach ($view_data['section9'] as $key => $value){ + if($value['img_name'] != '' ){ + $bucket_name = LENDER_BUCKET_NAME_PREFIX.$flyhipd_data[0]['lender_id']; + $img_rand_name = $value['rand_name'] != null ? $value['rand_name'] : $value['img_name'].".png" ; + $bucket_key = "sales_pd/".$pd_id."/images/".$img_rand_name; + $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name, $bucket_key,'30 minutes'); + $img_url = $value['img'] ? $value['img'] : ($singed_uri ? $singed_uri : ""); + $view_data['section9'][$key]['img'] = $img_url; + } + } + } + else $view_data['section9']= array(); $view_data['product_id'] = $flyhipd_data[0]['product_id']; $view_data['geo_location'] = $flyhipd_data[0]['geo_location']; @@ -771,7 +787,7 @@ class Flyhi_Controller extends REST_Controller { //$view_name = $flyhipd_data[0]['short_name'].'_'.$flyhipd_data[0]['abbr']; $view_name = $flyhipd_data[0]['short_name']; $html_content = $this->load->view('sale_pd_templates/'.$view_name,$view_data,true); - // echo $html_content;die(); + echo $html_content;die(); $pdf_doc = $this->pdfgenerator->generate($html_content, $filename='version', $stream=false, $paper = 'A4', $orientation = "portrait"); //End of PDF Gen using DOM PDF $output_file = $this->external_path ."/sales_pd/" .$pd_id. "/temp.pdf";