diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 2fa496a0..d5f30111 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -22,7 +22,7 @@ class PD_Controller extends REST_Controller //class level variable declaration //protected $external_path; - private $photo_names = array('selfie_with_person_met' => array('Person met', '18', 0, 0), 'person_met_id' => array('Person met ID Proof', '18', 0, 0), 'address_proof_visited' => array('Address Proof', '5', 0, 0), 'name_board_seen' => array('Name Board Seen', '13', 0, 0), 'machinery_image' => array('Machinery Image', '22', 0, 0), 'gst_Regn_cert_pic' => array('GST Regn Cert', '13', 0, 0), 'pf_regn_pic' => array('PF Regn', '13', 0, 0), 'esic_regn_pic' => array('ESIC Regn', '13', 0, 0), 'export_import_cert_pic' => array('Export Import Cert', '13', 0, 0), 'factory_cert_pic' => array('Factory Cert', '13', 0, 0), 'shop_eat_act_cert_pic' => array('Shop Est Act Cert', '13', 0, 0), 'eb_bill_pic' => array('EB Bill', '13', 0, 0), 'practice_cert_pic' => array('Cert of Practice', '13', 0, 0), 'fire_noc_pic' => array('Fire NOC', '13', 0, 0), 'stock_image' => array('Stock image', '11', 1, 1), 'client_image' => array('Client Bills', '2', 1, 1), 'supplier_image' => array('Supplier Bills', '1', 1, 1), 'office_setup' => array('Office/Business Setup', '13', 1, 1), 'additional_photos' => array('Additional Photographs', '13', 1, 1)); + private $photo_names = array('selfie_with_person_met' => array('Person met', '18', 0, 0), 'person_met_id' => array('Person met ID Proof', '18', 0, 0), 'address_proof_visited' => array('Address Proof', '5', 0, 0), 'name_board_seen' => array('Name Board Seen', '13', 0, 0), 'machinery_image' => array('Machinery Image', '22', 0, 0), 'gst_Regn_cert_pic' => array('GST Regn Cert', '13', 0, 0), 'pf_regn_pic' => array('PF Regn', '13', 0, 0), 'esic_regn_pic' => array('ESIC Regn', '13', 0, 0), 'export_import_cert_pic' => array('Export Import Cert', '13', 0, 0), 'factory_cert_pic' => array('Factory Cert', '13', 0, 0), 'shop_eat_act_cert_pic' => array('Shop Est Act Cert', '13', 0, 0), 'eb_bill_pic' => array('EB Bill', '13', 0, 0), 'practice_cert_pic' => array('Cert of Practice', '13', 0, 0), 'fire_noc_pic' => array('Fire NOC', '13', 0, 0), 'stock_image' => array('Stock image', '11', 1, 1), 'client_image' => array('Client Bills', '2', 1, 1), 'supplier_image' => array('Supplier Bills', '1', 1, 1), 'office_setup' => array('Office/Business Setup', '13', 1, 1), 'additional_photos' => array('Additional Photographs', '13', 1, 1),'Video' => array('Video', null, 1, 1)); private $existing_imges = array(); function __construct() @@ -8607,6 +8607,7 @@ class PD_Controller extends REST_Controller //Applicant Link Check and Get Image Details public function getPDImgDetails_post() { + // echo "\n Parent function entry"; $random_string = $this->post('random_string'); $pd_id = $this->post('pd_id'); @@ -8623,7 +8624,7 @@ class PD_Controller extends REST_Controller if ($pd_id[0]['is_cus_link_valid']) { //$this->updateLinkMetaData($pd_id[0]['pd_id'],$pd_id[0]['cus_link_count'],$random_string); - //get img Data + //get img Data// echo "\n i have PDID IF cond."; $this->getPDImgData($pd_id[0]['pd_id'], $random_string, $pd_id[0]['is_cus_link_disabled']); } else { $data['dataStatus'] = false; @@ -8668,15 +8669,18 @@ class PD_Controller extends REST_Controller public function getPDImgData($pd_id, $random_string, $is_cus_link_disabled) { + // echo "\n i am at child Fns"; $this->existing_imges = $this->PD_Model->getSignedPDDocsURL($pd_id, null, null, null, null, 'customer_app'); + // echo "\n external images".count($this->existing_imges); $docs_to_be_collected = $this->PD_Model->selectCustomRecords(array('*'), array('fk_pd_id' => $pd_id), PDDOCSTOBECOLLECTED); + // echo "\n Collected Docs".count($docs_to_be_collected); $pd_master_details = $this->PD_Model->getPDMasterDetails($pd_id); if ($pd_master_details[0]['customer_segment_abbr'] == 'SAL') { $this->photo_names['attendance_seen_pic'] = array('Attendance Img', '13'); } - + // print_r($this->existing_imges);die(); // print_r($this->photo_names);die(); $final_data = array(); $common_images = array(); @@ -8715,19 +8719,24 @@ class PD_Controller extends REST_Controller $final_data[] = $temp_array; } } + // print_r($final_data); + // echo "\n FInal Data".count($final_data); foreach ($this->existing_imges as $key => $value) { - //print_r(count($this->existing_imges)); + // print_r($this->existing_imges); + // echo "I have CT \n".$value['content_type']; if (!$value['fk_form_id'] && ($value['pd_document_title'] != 'satellite')) { + // echo "I have CT if cond \n".$value['content_type']; $final_data[] = array('img_key' => 'common_image', 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => null, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable']); unset($this->existing_imges[$key]); - } elseif ($value['pd_document_title'] != 'satellite' && $value['fk_form_id'] == 24) { + } elseif ($value['pd_document_title'] != 'satellite' && ($value['fk_form_id'] == 24 || $value['fk_form_id'] == 34)) { + // echo "I have CT ifelse cond \n".$value['content_type']; // doc to be collected img check add it to final data if (is_array($docs_to_be_collected) && count($docs_to_be_collected)) { //print_r(count($this->existing_imges)); $is_listed = false; foreach ($docs_to_be_collected as $dc_key => $dc_value) { - //echo 'before if check - '.$dc_value['doc_name'].'#'.$value['pd_document_title'].'****'; + // echo 'before if check - '.$dc_value['doc_name'].'#'.$value['pd_document_title'].'****'; if ($dc_value['doc_name'] == $value['pd_document_title']) { $is_listed = true; unset($docs_to_be_collected[$dc_key]); @@ -8743,9 +8752,9 @@ class PD_Controller extends REST_Controller } } } - else if($value['image_key'] == 'video'){ - $final_data[] = array('img_key' => $value['image_key'], 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => $value['fk_form_id'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable']); - } + // else if($value['image_key'] == 'video'){ + // $final_data[] = array('img_key' => $value['image_key'], 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'fk_form_id' => $value['fk_form_id'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable']); + // } } //print_r(($this->existing_imges));die(); //add remaining docs_to_be_collected into final array @@ -8819,8 +8828,24 @@ class PD_Controller extends REST_Controller return $arr; // unset($this->photo_names['selfie_with_person_met']); // return $arr; - } else if (strpos($current_img_key, $value['pd_document_title']) !== false) { - //echo $current_img_key.'***'.$value['pd_document_title']; + } else if ($current_img_key == 'Video' && strpos($value['pd_document_title'], 'Video') !== false) { + if ($current_img[2]) { + // echo "\n in if".$current_img_key; + // echo '\n before '.$current_multiple_img_key; + $current_multiple_img_key = $current_img_key; + if (!array_key_exists($current_img_key, $multiple_img_data)) { + $multiple_img_data[$current_img_key] = array('img_key' => $value['pd_document_title'], 'img_name' => $this->photo_names[$value['pd_document_title']][0], 'img_data' => array(array('img_url' => $value['doc_url'], 'img_name' => $value['pd_document_title'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable'])), 'fk_form_id' => $this->photo_names[$value['pd_document_title']][1], 'is_multiple' => $current_img[2], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$value['pd_document_title']][3]); + } else { + $multiple_img_data[$current_img_key]['img_data'][] = array('img_url' => $value['doc_url'], 'form_id' => $value['fk_form_id'], 'img_name' => $value['pd_document_title'], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable']); + } + } else { + $arr = array('img_key' => $value['pd_document_title'], 'img_name' => $this->photo_names[$value['pd_document_title']][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names[$value['pd_document_title']][1], 'is_multiple' => $current_img[2], 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $value['is_name_editable']); + return $arr; + } + unset($this->existing_imges[$key]); + } + else if (strpos($current_img_key, $value['pd_document_title']) !== false) { + //unset($this->existing_imges[$key]); //echo "OTHER"; if ($current_img[2]) { @@ -8841,13 +8866,6 @@ class PD_Controller extends REST_Controller // unset($this->photo_names['selfie_with_person_met']); // return $arr; } - else if ($current_img_key == 'video' && strpos($value['pd_document_title'], 'Video') !== false) { - $arr = array('img_key' => 'video', 'img_name' => $this->photo_names['video'][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names['video'][1], 'is_multiple' => 0, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['video'][3]); - unset($this->existing_imges[$key]); - return $arr; - // unset($this->photo_names['selfie_with_person_met']); - // return $arr; - } // else // { // //unset($this->existing_imges[$key]); diff --git a/api/application/models/PD_Model.php b/api/application/models/PD_Model.php index 403dded1..faabba41 100644 --- a/api/application/models/PD_Model.php +++ b/api/application/models/PD_Model.php @@ -456,8 +456,10 @@ class PD_Model extends SPARQ_Model { unset($document_lists[$key]); continue; } - - $profilepics3path = 'pd'.$pdid.'/'.$value['pd_document_name']; + if($value['content_type'] == 1){ + $profilepics3path = 'pd'.$pdid.'/'.$value['pd_document_name'];}elseif($value['content_type'] == 2){ + $profilepics3path = 'pd'.$pdid.'/video/'.$value['pd_document_name']; + } $singed_uri = $this->aws_s3->getSingleObjectInaBucketAsSignedURI($bucket_name,$profilepics3path,$time); $document_lists[$key]['doc_url'] = $singed_uri;