84 lines
2.5 KiB
PHP
84 lines
2.5 KiB
PHP
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: kms
|
|
* Date: 11/13/17
|
|
* Time: 7:40 PM
|
|
*/
|
|
|
|
defined('BASEPATH') OR exit('No direct script access allowed');
|
|
|
|
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
|
|
/** @noinspection PhpIncludeInspection */
|
|
require_once APPPATH . '/libraries/REST_Controller.php';
|
|
include_once APPPATH.'/vendor/autoload.php';
|
|
|
|
/**
|
|
* This is an example of a few basic user interaction methods you could use
|
|
* all done with a hardcoded array
|
|
*
|
|
* @package CodeIgniter
|
|
* @subpackage Rest Server
|
|
* @category Controller
|
|
* @author
|
|
* @license MIT
|
|
* @link
|
|
*/
|
|
class Data_Dump_Controller extends REST_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
|
|
parent::__construct();
|
|
$this->load->model('PD_Model','PD_Model');
|
|
$this->load->model('Data_Dump_Model','Data_Dump_Model');
|
|
//$this->load->library('AWS_S3');
|
|
}
|
|
|
|
public function getRawData_get()
|
|
{
|
|
|
|
$pdid = $this->get('pdid');
|
|
$rs = $this->get('rs');
|
|
$pd_processed_forms = array();
|
|
$master = $this->PD_Model->getPDMasterDetails($pdid);
|
|
|
|
if($pdid != '')// && $rs != '')
|
|
{
|
|
$this->load->helper('data_dump');
|
|
|
|
for($i = 1;$i<=30;$i++)
|
|
{
|
|
$fields = array('processed_json');
|
|
$where_condition_array = array('isactive' => 1,'fk_pd_id'=>$pdid,'fk_form_id' => $i);
|
|
|
|
$pd_processed_forms[$i] = $this->PD_Model->selectCustomRecords($fields,$where_condition_array,PDFORMDETAILSJSON,array(),'','company_id','ASC');
|
|
// $fields2 = array('*');
|
|
// $data['pd_images'][$i] = $this->PD_Model->getSignedPDDocsURL($pdid,$i,null,null,null,'report');
|
|
}
|
|
|
|
//get General form dump
|
|
$gen_data_dump = array();
|
|
if(isset($pd_processed_forms[18]))
|
|
{
|
|
$gen_data = (json_decode($pd_processed_forms[18][0]['processed_json'],TRUE));
|
|
//print_r($gen_data);die();
|
|
$gen_data_dump = DATA_DUMP::convertGeneralDetailsForm($gen_data,$master);
|
|
print_r($gen_data_dump);
|
|
$this->Data_Dump_Model->saveGenDumpData($gen_data_dump);
|
|
}
|
|
if(isset($pd_processed_forms[13]))
|
|
{
|
|
if(array_key_exists('company_data', $gen_data_dump) && count($gen_data_dump))
|
|
{
|
|
$business_data = (json_decode($pd_processed_forms[13][0]['processed_json'],TRUE));
|
|
//print_r($business_data);die();
|
|
$business_data_dump = DATA_DUMP::convertBusinessDetailsForm($business_data,$master,$gen_data_dump['company_data']);
|
|
print_r($business_data_dump);
|
|
$this->Data_Dump_Model->saveBusinessDUmpData($business_data_dump);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
} |