From d3f97a0566d81ef5df4eb4f447bebac84c83d4b8 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 27 Feb 2023 16:26:12 +0530 Subject: [PATCH] Photograph fixes : ps --- api/application/controllers/PD_Controller.php | 9 ++------- .../helpers/photo_zip_creator_helper.php | 16 +++++++--------- api/application/helpers/url_shortener_helper.php | 3 ++- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 8ad44ef6..be30fa2f 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -8780,12 +8780,11 @@ class PD_Controller extends REST_Controller $final_data[$i][($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' ); $i++; } - if (is_array($docs_to_be_collected) && count($docs_to_be_collected)) { $k = 0; foreach ($docs_to_be_collected as $key => $value) { $final_data[] = array('img_key' => 'docs_to_be_collected', 'img_name' => $value['doc_name'], 'fk_form_id' => "24", "is_multiple" => 0, 'pd_image_alias_name' => "", 'is_name_editable' => 0 ,'content_type'=>(strtoupper($key) =='VIDEO' ? "2" : ((strtoupper($key) =='PDF') ? "3" : "1"))); - $final_data[$k][($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' ); + $final_data[$k]['img_data'] = array() ; $k++; } } @@ -8795,11 +8794,7 @@ class PD_Controller extends REST_Controller $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); - // }); - + $final_data = array_values($final_data); $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/helpers/photo_zip_creator_helper.php b/api/application/helpers/photo_zip_creator_helper.php index 7f6ecdcf..ce346489 100644 --- a/api/application/helpers/photo_zip_creator_helper.php +++ b/api/application/helpers/photo_zip_creator_helper.php @@ -116,12 +116,11 @@ class photo_zip_creator //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 - { + // 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'); @@ -151,9 +150,8 @@ class photo_zip_creator unlink($CI->external_path.'/pd_reports/'.$pdid.'/'.$temp_path); } - $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); - } - return $singed_uri; + return $singed_uri = $CI->aws_s3->getSingleObjectInaBucketAsSignedURI($bucketname,$key,'+30 minutes'); + //} } } diff --git a/api/application/helpers/url_shortener_helper.php b/api/application/helpers/url_shortener_helper.php index 9f40610f..5601c21f 100644 --- a/api/application/helpers/url_shortener_helper.php +++ b/api/application/helpers/url_shortener_helper.php @@ -37,7 +37,8 @@ class url_shortener $uri[ 'ppdf' ] = custom_encryption::encode ( 'ppdf/'.$date_of_creation.'/'.$pdid.'/'.$random_string); $uri[ 'zip' ] = custom_encryption::encode ( 'zip/'.$date_of_creation.'/'.$pdid.'/'.$random_string ); - $uri[ 'shortvdo' ] = custom_encryption::encode ( 'shortvdo/'.$date_of_creation.'/'.$pdid.'/'.$random_string ); + $all_pd_shortvideo = $CI->PD_Model->getSignedPDDocsURL($pdid,null,null,null,null,'report_shortVideo'); + if(count($all_pd_shortvideo)>0){$uri[ 'shortvdo' ] = custom_encryption::encode ( 'shortvdo/'.$date_of_creation.'/'.$pdid.'/'.$random_string );} } // print_r($uri);die(); return $uri;