diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index fda3102a..8ad44ef6 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -8792,7 +8792,14 @@ class PD_Controller extends REST_Controller } //print_r($final_data);die(); //$final_data[] = array('imag_data' => $common_images,'is_multiple' => 1); - + $final_data = array_filter($final_data, function ($var) { + return ($var['content_type'] !== '3'); + }); + // $filterBy = '3'; + // $final_data = array_filter($final_data, function ($var) use ($filterBy) { + // return ($var['content_type'] != $filterBy); + // }); + $data['dataStatus'] = true; $data['status'] = REST_Controller::HTTP_OK; $data['records'] = array('pd_id' => $pd_id, 'random_string' => $random_string, 'is_cus_link_disabled' => $is_cus_link_disabled, 'img_data' => $final_data); diff --git a/api/application/controllers/Welcome.php b/api/application/controllers/Welcome.php index 7350e4fb..a9c62c75 100644 --- a/api/application/controllers/Welcome.php +++ b/api/application/controllers/Welcome.php @@ -69,6 +69,10 @@ class Welcome extends CI_Controller { { $this->redirect_url = $this->vdo($pd_id,$random_string); } + else if($type == 'shortvdo') + { + $this->redirect_url = $this->shortvdo($pd_id,$random_string); + } else if($type == 'ppdf') { $this->redirect_url = $this->ppdf($pd_id,$random_string); @@ -115,7 +119,12 @@ class Welcome extends CI_Controller { } } - + function shortvdo($pd_id,$random_string) + { + // echo "i am Here 124";die(); + $this->load->helper('photo_zip_creator'); + return $res_data = (new photo_zip_creator)->covertShortVideo2ZIP($pd_id,$random_string,array()); + } function ppdf($pd_id,$random_string) { $this->load->helper('photo_pdf_converter'); diff --git a/api/application/helpers/photo_zip_creator_helper.php b/api/application/helpers/photo_zip_creator_helper.php index 37dcaf61..7f6ecdcf 100644 --- a/api/application/helpers/photo_zip_creator_helper.php +++ b/api/application/helpers/photo_zip_creator_helper.php @@ -93,6 +93,68 @@ class photo_zip_creator } } + public function covertShortVideo2ZIP($pdid,$random_string,$pd_master_details = array(),$regenerate = 0) + { + + $CI =&get_instance(); + $CI->load->model('PD_Model'); + + if(!count($pd_master_details)) + { + $pd_master_details = $CI->PD_Model->getPDMasterDetails($pdid,$random_string,$pd_master_details); + } + + if(!file_exists($CI->external_path.'/pd_reports/'.$pdid)) + { + mkdir($CI->external_path.'/pd_reports/'.$pdid,0777); + } + + + $bucketname = LENDER_BUCKET_NAME_PREFIX.$pd_master_details[0]['fk_lender_id']; + $main_applicant_name = $pd_master_details[0]['main_applicant']; + + //get zip url from s3 if any + $key = 'pd'.$pdid.'/'.$main_applicant_name.'_'.$pdid.'_'.'pd_shortvideo.zip'; + + if($regenerate == 0) + { + $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + } + else + { + + $all_pd_shortvideo = $CI->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report_shortVideo'); + + //Generate zip file + $CI->load->library('zip'); + $CI->zip->add_dir('pdshortvideo'); + + + foreach($all_pd_shortvideo as $image) + { + $temp_dir_name = 'Common'; + //replace colon with hyphen in doc name + $doc_name = str_replace(':', '-', $image['pd_document_name']); + $CI->zip->add_data('pdshortvideo/'.$doc_name,file_get_contents($image['doc_url'])); + } + + $temp_path = $main_applicant_name.'_'.$pdid.'_'.'pd_shortvideo.zip'; + + $CI->zip->archive($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path); + + $bucket_data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path)); + + $s3result= $CI->aws_s3->uploadFileToS3Bucket($bucket_data); + + if(is_object($s3result) && $s3result['ObjectURL'] != '' && $s3result['@metadata']['statusCode'] == 200) + { + unlink($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path); + } + + $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + } + return $singed_uri; +} } ?> \ No newline at end of file diff --git a/api/application/helpers/report_attachments_helper.php b/api/application/helpers/report_attachments_helper.php index a8e2b426..a6f6fdf2 100644 --- a/api/application/helpers/report_attachments_helper.php +++ b/api/application/helpers/report_attachments_helper.php @@ -29,7 +29,7 @@ class report_attachments // $video_uri = (new video_grabber_helper)->grabAllVideo($pd_master_details[0]['pd_id'],$pd_master_details[0]['random_string'],$pd_master_details); // print_r($video_uri) ;die(); - $attachment = '
Click here for Short Video ZIP Link
'; if($pd_master_details[0]['fk_pd_type'] == 2 && count($uri['vdo']))// if smart pd { $attachment .='