From 308da22a61f3759cf69ef8b5c1f425402b98ce10 Mon Sep 17 00:00:00 2001 From: Velz2020 Date: Thu, 26 Mar 2020 18:13:56 +0530 Subject: [PATCH] CUS LINK 4 --- api/application/controllers/PD_Controller.php | 43 ++++++++++++------- 1 file changed, 28 insertions(+), 15 deletions(-) diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index bcc362d0..d11a98c2 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -9637,8 +9637,11 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() { foreach ($this->photo_names as $key => $value) { - $final_data[] = $this->photoMapping($key,$value); - unset($this->photo_names[$key]); + $temp = $this->photoMapping($key,$value); + $final_data[] = is_array($temp) ? $temp : array('img_key' =>$key,'img_name' => $value[0],'img_url' => '','fk_form_id' => $value[1]);; + + + //unset($this->photo_names[$key]); } } @@ -9650,7 +9653,7 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() } } - //print_r($final_data); + //print_r($final_data);die(); //$final_data[] = array('imag_data' => $common_images,'is_multiple' => 1); $data['dataStatus'] = true; @@ -9662,43 +9665,53 @@ public function getCompaniesListsFromGeneralFormRawJSON_post() function photoMapping($current_img_key,$current_img) { - //print_r($èxist_img_array);echo $img_key;die(); - //echo $this->photo_names['selfie_with_person_met'][1];die(); + //print_r(count($this->existing_imges));///echo $img_key;die(); + //;die(); foreach ($this->existing_imges as $key => $value) { - //print_r($value);die(); - if($value['img_type'] == 1 && $current_img_key == 'selfie_with_person_met') + //print_r($value); + // echo $current_img_key.'***'.$value['pd_document_title']; + // echo '
'; + // echo '
'; + if($current_img_key == 'selfie_with_person_met' && $value['img_type'] == 1 ) { unset($this->existing_imges[$key]); + //echo "SELFIE"; return array('img_key' => 'selfie_with_person_met','img_name' => $this->photo_names['selfie_with_person_met'][0],'fk_form_id' => $this->photo_names['selfie_with_person_met'][1],'img_url' => $value['doc_url'],'is_multiple' => 0); } - else if($value['img_type'] == 2 && $current_img_key == 'person_met_id') + else if($current_img_key == 'person_met_id' && $value['img_type'] == 2) { unset($this->existing_imges[$key]); + //echo 'HOLD'; return array('img_key' => 'person_met_id','img_name' => $this->photo_names['person_met_id'][0],'img_url' => $value['doc_url'],'fk_form_id' => $this->photo_names['person_met_id'][1],'is_multiple' => 0); // unset($this->photo_names['selfie_with_person_met']); // return $arr; } - else if(strpos($value['pd_document_title'], 'Approach') !== false && $current_img_key == 'approach_to_pd_location') + else if($current_img_key == 'approach_to_pd_location' && strpos($value['pd_document_title'], 'Approach') !== false) { unset($this->existing_imges[$key]); + //echo "APPROACH"; return array('img_key' => 'approach_to_pd_location','img_name' => $this->photo_names['approach_to_pd_location'][0],'img_url' => $value['doc_url'],'fk_form_id' => $this->photo_names['approach_to_pd_location'][1],'is_multiple' => 0); // unset($this->photo_names['selfie_with_person_met']); // return $arr; } - else if($current_img_key == $value['pd_document_title']) + + else if(strpos($current_img_key, $value['pd_document_title']) !== false) { + //echo $current_img_key.'***'.$value['pd_document_title']; unset($this->existing_imges[$key]); + //echo "OTHER"; return 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' => 0); // unset($this->photo_names['selfie_with_person_met']); // return $arr; } - else - { - //unset($this->existing_imges[$key]); - return array('img_key' =>$current_img_key,'img_name' => $current_img_key,'img_url' => '','fk_form_id' => $current_img[1]); - } + // else + // { + // //unset($this->existing_imges[$key]); + // echo "ELSE"; + // return array('img_key' =>$current_img_key,'img_name' => $current_img_key,'img_url' => '','fk_form_id' => $current_img[1]); + // } } } }