diff --git a/api/application/controllers/PD_Controller.php b/api/application/controllers/PD_Controller.php index 6019d20a..941a38b9 100644 --- a/api/application/controllers/PD_Controller.php +++ b/api/application/controllers/PD_Controller.php @@ -8714,8 +8714,8 @@ class PD_Controller extends REST_Controller // } $final_data[] = $temp; } else { - $temp_array = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1], "is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3]); - $temp_array[($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : ''); + $temp_array = array('img_key' => $key, 'img_name' => $value[0], 'fk_form_id' => $value[1],"is_multiple" => $value[2], 'pd_image_alias_name' => "", 'is_name_editable' => $value[3],'content_type'=>($key =='Video' ? "2" : "1")); + $temp_array[($value[2] ? 'img_data' : 'img_url')] = ($value[2] ? array() : '' ); $final_data[] = $temp_array; } } @@ -8790,6 +8790,7 @@ class PD_Controller extends REST_Controller //;die(); $multiple_img_data = array(); $current_multiple_img_key = null; + // print_r($this->existing_imges); foreach ($this->existing_imges as $key => $value) { //print_r($value);die(); // echo $current_img_key.'***'.$value['pd_document_title']; @@ -8799,14 +8800,14 @@ class PD_Controller extends REST_Controller // echo $value['pd_document_title']; if ($current_img_key == 'selfie_with_person_met' && $value['img_type'] == 1) { - //echo "SELFIE"; - $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['selfie_with_person_met'][3]); + // echo "SELFIE"; + $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['selfie_with_person_met'][3],'content_type'=> $value['content_type']); unset($this->existing_imges[$key]); return $arr; } else if ($current_img_key == 'person_met_id' && $value['img_type'] == 2) { //echo 'HOLD'; - $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3]); + $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3],'content_type'=> $value['content_type']); unset($this->existing_imges[$key]); return $arr; @@ -8815,7 +8816,7 @@ class PD_Controller extends REST_Controller } else if ($current_img_key == 'approach_to_pd_location' && strpos($value['pd_document_title'], 'Approach') !== false) { //echo "APPROACH"; - $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3]); + $arr = 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, 'pd_document_id' => $value['pd_document_id'], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names['person_met_id'][3],'content_type'=> $value['content_type']); unset($this->existing_imges[$key]); return $arr; // unset($this->photo_names['selfie_with_person_met']); @@ -8823,23 +8824,23 @@ class PD_Controller extends REST_Controller } else if ($current_img_key == 'name_board_seen' && strpos($value['pd_document_title'], 'Name Board Seen') !== false) { //echo "APPROACH"; - $arr = array('img_key' => 'name_board_seen', 'img_name' => $this->photo_names['name_board_seen'][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names['name_board_seen'][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['name_board_seen'][3]); + $arr = array('img_key' => 'name_board_seen', 'img_name' => $this->photo_names['name_board_seen'][0], 'img_url' => $value['doc_url'], 'fk_form_id' => $this->photo_names['name_board_seen'][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['name_board_seen'][3],'content_type'=> $value['content_type']); unset($this->existing_imges[$key]); return $arr; // unset($this->photo_names['selfie_with_person_met']); // return $arr; - } else if ($current_img_key == 'Video' && strpos($value['pd_document_title'], 'Video') !== false) { + } else if ($current_img_key == 'Video') { 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'],'form_id' => $value['fk_form_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],); + $multiple_img_data[$current_img_key] = array('img_key' => $value['image_key'], 'img_name' => "Videos", '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[$current_img_key][1])), 'form_id' => $value['fk_form_id'], 'is_multiple' => $current_img[2], 'pd_image_alias_name' => $value['pd_image_alias_name'], 'is_name_editable' => $this->photo_names[$current_img_key][3],'content_type'=> $value['content_type']); } 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']); + $multiple_img_data[$current_img_key]['img_data'][] = 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'],'form_id' => $value['fk_form_id']); } } 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']); + $arr = array('img_key' => $value['pd_document_title'], 'img_name' => $value['pd_document_title'], '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'],'content_type'=> $value['content_type']); return $arr; } unset($this->existing_imges[$key]); @@ -8852,12 +8853,12 @@ class PD_Controller extends REST_Controller $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]); + $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],'content_type'=> $value['content_type']); } else { - $multiple_img_data[$current_img_key]['img_data'][] = 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']); + $multiple_img_data['VIDEO']['img_data'][] = 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'],'content_type'=> $value['content_type']); } } 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']); + $arr = array('img_key' => $value['pd_document_title'], 'img_name' => $value['pd_document_title'], 'img_url' => $value['doc_url'], 'content_type'=> $value['content_type'],'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'],'content_type'=> $value['content_type']); return $arr; } unset($this->existing_imges[$key]);