flyhi getflyhi api : ps
This commit is contained in:
parent
455cfca658
commit
13a1891dda
@ -377,7 +377,7 @@ $route['faceMarkImage'] = 'PD_Controller/toMakeFaceBoundingBox';
|
||||
|
||||
$route['saveFlyhiPD'] = 'Flyhi_Controller/saveFlyhiPD';
|
||||
$route['listFlyhiPD'] = 'Flyhi_Controller/listFlyhiPD';
|
||||
$route['getFlyhiPD'] = 'Flyhi_Controller/getFlyhiPD';
|
||||
$route['getFlyhiPDSectionData'] = 'Flyhi_Controller/getFlyhiPD';
|
||||
$route['loadFlyhiPDTemplate'] = 'Flyhi_Controller/loadFlyhiPDTemplate';
|
||||
$route['(downloadFlyhiPDReport/:any)'] = 'Flyhi_Controller/getFlyhiPDReport';
|
||||
$route['getMasterForFlyhiPD'] = 'Flyhi_Controller/getMasterForFlyhiPD';
|
||||
|
||||
@ -530,19 +530,25 @@ class Flyhi_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getFlyhiPD_get()
|
||||
|
||||
public function getFlyhiPD_post()
|
||||
{
|
||||
$Flyhi_pdid = $this->get('pd_id');
|
||||
$section_id = $this->get('section_id');
|
||||
$records = $this->post('records');
|
||||
$section_data = array();
|
||||
if(isset($Flyhi_pdid) || $Flyhi_pdid != "" || $Flyhi_pdid != null)
|
||||
{
|
||||
if(isset($section_id) || $section_id != "" || $section_id != null){
|
||||
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $Flyhi_pdid,'isactive' => 1,'section_id' => $section_id),SALESPD_SECTION_DATA);
|
||||
if($section_id == 2 && count($section_data))
|
||||
if(!is_numeric($records['section_id'])){
|
||||
$fields=array('id','sales_pd_id','section_id','status','createdby','createdon');
|
||||
if($records['section_id'] == 'data'){ $fields[] = 'section_data'; }
|
||||
$section_data=$this->Flyhi_Model->selectCustomRecords($fields,array('sales_pd_id' => $records['sales_pd_id'],'isactive' => 1),SALESPD_SECTION_DATA);
|
||||
}
|
||||
else{
|
||||
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $records['sales_pd_id'],'isactive' => 1,'section_id' => $records['section_id']),SALESPD_SECTION_DATA);
|
||||
//print_r( json_decode($section_data[0]['section_data'],true));die();
|
||||
if($records['section_id'] == 2 && count($section_data))
|
||||
{
|
||||
$all_sales_pd_images = $this->Flyhi_Model->selectCustomRecords(array('*'),array('fk_sales_pd_id' => $records['sales_pd_id'],'img_name !=' => 'satellite','isactive' => 1),SALEPD_DOCS);
|
||||
$photo_questions = (json_decode(($section_data[0]['section_data']),true));
|
||||
//print_r($all_sales_pd_images);die();
|
||||
$photo_questions = (json_decode(($section_data[0]['section_data']),true));
|
||||
// print_r($photo_questions);
|
||||
foreach ($photo_questions['questions'] as $key => $value)
|
||||
{
|
||||
if(isset($value['answer_value']) && $value['answer_value'] && !$value['is_repeatable'])
|
||||
@ -551,20 +557,24 @@ class Flyhi_Controller extends REST_Controller {
|
||||
if(count($selfie))
|
||||
{
|
||||
$photo_questions['questions'][$key]['answer_value'] = $selfie[0]['img'];
|
||||
//$photo_questions['questions'][$key]['answer_value'] = "CHNAGED";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
{
|
||||
foreach ($value['questions_group'] as $v_key => $individual_value)
|
||||
{
|
||||
//print_r($individual_value);die();
|
||||
//if($individual_value['questions'][0]['answer_value'])
|
||||
if(isset($individual_value['questions'][0]['answer_value']))
|
||||
{
|
||||
//iterate all_sales_pd_images to get one
|
||||
foreach ($all_sales_pd_images as $img_key => $img_value)
|
||||
{
|
||||
if($individual_value['questions'][0]['question_key'] == $img_value['img_name'])
|
||||
{
|
||||
$photo_questions['questions'][$key]['questions_group'][$v_key]['questions'][0]['answer_value'] = $img_value['img'];
|
||||
//$photo_questions['questions'][$key]['questions_group'][$v_key]['questions'][0]['answer_value'] = "CHANGED";
|
||||
unset($all_sales_pd_images[$img_key]);
|
||||
break;
|
||||
}
|
||||
@ -573,29 +583,26 @@ class Flyhi_Controller extends REST_Controller {
|
||||
}
|
||||
}
|
||||
}
|
||||
//die();
|
||||
$photo_questions = json_encode($photo_questions);
|
||||
$section_data[0]['section_data'] = $photo_questions;
|
||||
}
|
||||
|
||||
}else{
|
||||
$section_data = $this->Flyhi_Model->selectCustomRecords(array('*'),array('sales_pd_id' => $Flyhi_pdid,'isactive' => 1),SALESPD_SECTION_DATA);
|
||||
}
|
||||
|
||||
}
|
||||
if($section_data)
|
||||
{
|
||||
if($section_data)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $section_data;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$data['msg'] = 'No Data Found';
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function loadFlyhiPDTemplate_post()
|
||||
@ -818,7 +825,7 @@ class Flyhi_Controller extends REST_Controller {
|
||||
else if($question['is_repeatable'] == 1 )
|
||||
{
|
||||
//print_r($question['questions_group']);die();
|
||||
if($section_id != 9)
|
||||
if($section_id != 2)
|
||||
{
|
||||
foreach ($question['questions_group'] as $group_key => $group_value)
|
||||
{
|
||||
@ -910,6 +917,8 @@ class Flyhi_Controller extends REST_Controller {
|
||||
{
|
||||
$this->Flyhi_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('section_id' => 2,'sales_pd_id' => $records['fk_sales_pd_id']));
|
||||
}
|
||||
// $this->Flyhi_Model->updateRecords(array('isactive' => 0),SALESPD_SECTION_DATA,array('section_id' => 2,'sales_pd_id' => $records['fk_sales_pd_id']));// temporary
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user