QUESTION AND ENTITY MGMT
This commit is contained in:
parent
e17eb56767
commit
3b8d1e6f0f
@ -113,9 +113,6 @@ defined('OCCUPATIONMEMBERSID') OR define('OCCUPATIONMEMBERSID','occupation_non_e
|
||||
defined('TYPEOFACTIVITY') OR define('TYPEOFACTIVITY','m_type_of_activity');
|
||||
defined('TYPEOFACTIVITYID') OR define('TYPEOFACTIVITYID','type_of_activity_id');
|
||||
|
||||
defined('TYPEOFACTIVITY') OR define('TYPEOFACTIVITY','m_type_of_activity');
|
||||
defined('TYPEOFACTIVITYID') OR define('TYPEOFACTIVITYID','type_of_activity_id');
|
||||
|
||||
defined('TITLES') OR define('TITLES','m_titles');
|
||||
defined('TITLESID') OR define('TITLESID','title_id');
|
||||
|
||||
@ -149,7 +146,7 @@ defined('LISTOFMASTERSID') OR define('LISTOFMASTERSID','master_id');
|
||||
defined('COMMENTSONLOCALITY') OR define('COMMENTSONLOCALITY','m_comments_on_locality');
|
||||
defined('COMMENTSONLOCALITYID') OR define('COMMENTSONLOCALITYID','comments_on_locality_id');
|
||||
|
||||
defined('ENTITYTYPE') OR define('ENTITYTYPE','m_entity_type');
|
||||
defined('ENTITYTYPE') OR define('ENTITYTYPE','c_entity_type');
|
||||
defined('ENTITYTYPEID') OR define('ENTITYTYPEID','entity_type_id');
|
||||
|
||||
defined('COMPANY') OR define('COMPANY','m_company');
|
||||
@ -179,4 +176,16 @@ defined('USERPROFILEROLESID') OR define('USERPROFILEROLESID','user_role_id');
|
||||
defined('LENDER') OR define('LENDER','m_lender');
|
||||
defined('LENDERID') OR define('LENDERID','lender_id');
|
||||
|
||||
defined('QUESTIONS') OR define('QUESTIONS','m_questions');
|
||||
defined('QUESTIONSID') OR define('QUESTIONSID','question_id');
|
||||
|
||||
defined('QUESTIONANSWERTYPE') OR define('QUESTIONANSWERTYPE','m_question_answer_type');
|
||||
defined('QUESTIONANSWERTYPEID') OR define('QUESTIONANSWERTYPEID','question_answer_type_id');
|
||||
|
||||
defined('QUESTIONANSWERS') OR define('QUESTIONANSWERS','m_question_answers');
|
||||
defined('QUESTIONANSWERSID') OR define('QUESTIONANSWERSID','question_answer_id');
|
||||
|
||||
defined('QUESTIONCATEGORY') OR define('QUESTIONCATEGORY','m_question_category');
|
||||
defined('QUESTIONCATEGORYID') OR define('QUESTIONCATEGORYID','question_categroy_id');
|
||||
|
||||
|
||||
|
||||
@ -5,15 +5,37 @@
|
||||
/* public key for encrypt AWS JWT token
|
||||
*/
|
||||
$config['jwt_public_key'] = '-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy7kgZrHJIliQXFJNCGMV
|
||||
v9HoGJAziKKEAyF8nW7nvLgtulJ7IUMiLzhmTeB74RVrvphM1ALEtk/BdQegMYXl
|
||||
KFmMKLDLVPlZULje1cQRJHkXV4kcjSOxPslH2M+MzSa6sjN6DX7tfjvihrYdJ+wo
|
||||
VZFhITjOcUF0d/w2rp3/uelrk85qn8ap7UWkFAWWg+N4v+LuvBNBDLv0Y0dYiAFP
|
||||
bY06D285xmGrko7eXBlKV6tBXaZ29zWD1JOD8uDAgLRNb2S6hpBHfJdNF+BcVNnR
|
||||
cdGx2GbBVHHqHMbYisiVZhgVd6KY4N6vYFl3B/sJDXgl9Ek+PKzeCrRPT9D+8Ibf
|
||||
YQIDAQAB
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w
|
||||
r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM
|
||||
Dgik5jW8aCBvGM5S6PAZXn3fj59HYtKL0HIQ1cxaoIUVXjRHD/QkcCEZuG5dIxij
|
||||
8NOCnE+Ip2nVm9WXbKSb/KXuF+p69Osm8VpVz7hpa/Hcf50iOe3R82dpCytUKBX4
|
||||
eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP
|
||||
7LKZG/M5n9UutA8GWMFeDw0qcI3kLdo6ijbdpGDUqjs+OY6MBH+uKLrzsqVNTamC
|
||||
RwIDAQAB
|
||||
-----END PUBLIC KEY-----';
|
||||
|
||||
$config['jwt_public_key_lender_dev'] = '-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w
|
||||
r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM
|
||||
Dgik5jW8aCBvGM5S6PAZXn3fj59HYtKL0HIQ1cxaoIUVXjRHD/QkcCEZuG5dIxij
|
||||
8NOCnE+Ip2nVm9WXbKSb/KXuF+p69Osm8VpVz7hpa/Hcf50iOe3R82dpCytUKBX4
|
||||
eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP
|
||||
7LKZG/M5n9UutA8GWMFeDw0qcI3kLdo6ijbdpGDUqjs+OY6MBH+uKLrzsqVNTamC
|
||||
RwIDAQAB
|
||||
-----END PUBLIC KEY-----';
|
||||
|
||||
$config['jwt_public_key_vendor_dev'] = '-----BEGIN PUBLIC KEY-----
|
||||
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqTsyy4r3nrjumED4To7w
|
||||
r1rfjMEzL+hcF8OwGm89aHoEzKLZqr12uQw3eK7tVV97QV8aYOi0zUinHlOVx1PM
|
||||
Dgik5jW8aCBvGM5S6PAZXn3fj59HYtKL0HIQ1cxaoIUVXjRHD/QkcCEZuG5dIxij
|
||||
8NOCnE+Ip2nVm9WXbKSb/KXuF+p69Osm8VpVz7hpa/Hcf50iOe3R82dpCytUKBX4
|
||||
eq0HukzvikhFNglSw5GV0pK0syZxvu/ERMg3ja4r9an8fMayVS2YpybtRl6CCCVP
|
||||
7LKZG/M5n9UutA8GWMFeDw0qcI3kLdo6ijbdpGDUqjs+OY6MBH+uKLrzsqVNTamC
|
||||
RwIDAQAB
|
||||
-----END PUBLIC KEY-----';
|
||||
|
||||
|
||||
|
||||
/*Generated token will expire in 1 minute for sample code
|
||||
* Increase this value as per requirement for production
|
||||
*/
|
||||
|
||||
151
api/application/controllers/Entity_Management_Controller.php
Normal file
151
api/application/controllers/Entity_Management_Controller.php
Normal file
@ -0,0 +1,151 @@
|
||||
<?php
|
||||
/**
|
||||
|
||||
* User: velz
|
||||
* This Controller deals with User Management CRUD Operations
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
|
||||
class Entity_Management_Controller extends REST_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
$this->load->model('Entity_Management_Model');
|
||||
|
||||
}
|
||||
|
||||
public function listAllEntites_get()
|
||||
{
|
||||
|
||||
$result = $this->Entity_Management_Model->$listAllEntities();
|
||||
if($result['data_status'])
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result['data'];
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveNewEntity_post()
|
||||
{
|
||||
$entity = "";
|
||||
$entity_child = "";
|
||||
$entity_id = "";
|
||||
|
||||
if($this->post('entity')){ $entity = $this->post('entity'); }
|
||||
|
||||
if($this->post('entity_child')){ $entity_child = $this->post('entity_child'); }
|
||||
|
||||
if($entity != "")
|
||||
{
|
||||
$entity_id = $this->User_Management_Model->saveRecords($entity,ENTITY);//insert user records and get userid
|
||||
}
|
||||
|
||||
if($entity_child != "")
|
||||
{
|
||||
foreach($entity_child as $child)
|
||||
{
|
||||
$entity_child_array = array('contact_person'=>$child['contact_person'],'contact_email'=>$child['contact_email'],'contact_mobile_no'=>$child['contact_mobile_no'],'fk_entity_id'=>$entity_id,'createdon'=>$child['createdon'],'fk_createdby'=>$child['fk_createdby']);
|
||||
$this->User_Management_Model->saveRecords($entity_child_array,ENTITYCHILD);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($entity_id != '' || $entity_id != null)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $entity_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function saveExistEntity_post()
|
||||
{
|
||||
$entity = "";
|
||||
$entity_child = "";
|
||||
$entity_id = "";
|
||||
|
||||
if($this->post('entity')){ $entity = $this->post('entity'); }
|
||||
|
||||
if($this->post('entity_child')){ $entity_child = $this->post('entity_child'); }
|
||||
|
||||
if($entity != "")
|
||||
{
|
||||
$where_condition_array = array('entity_id' => $entity['entity_id'],$where_condition_array);
|
||||
$entity_id = $this->User_Management_Model->updateRecords($entity,ENTITY,$where_condition_array);
|
||||
}
|
||||
|
||||
if($entity_child != "")
|
||||
{
|
||||
foreach($entity_child as $child)
|
||||
{
|
||||
$entity_child_array = array('contact_person'=>$child['contact_person'],'contact_email'=>$child['contact_email'],'contact_mobile_no'=>$child['contact_mobile_no'],'fk_entity_id'=>$entity_id,'updatedon'=>$child['updatedon'],'fk_updatedby'=>$child['fk_updatedby'],'isactive'=>$child['isactive']);
|
||||
$where_condition_array = array('entity_child_id'=>$child['entity_child_id']);
|
||||
$this->User_Management_Model->updateRecords($entity_child_array,ENTITYCHILD,$where_condition_array);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if($entity_id != '' || $entity_id != null)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $entity_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
131
api/application/controllers/Question_Management_Controller.php
Normal file
131
api/application/controllers/Question_Management_Controller.php
Normal file
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
|
||||
* User: velz
|
||||
* This Controller deals with User Management CRUD Operations
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
|
||||
class Question_Management_Controller extends REST_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
$this->load->model('Question_Management_Model');
|
||||
|
||||
}
|
||||
|
||||
public function listAllQuestions_get()
|
||||
{
|
||||
|
||||
$result = $this->User_Management_Model->$listAllQuestions();
|
||||
if($result['data_status'])
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result['data'];
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveNewQuestion_post()// Save Array of question and it's answers(Single too)
|
||||
{
|
||||
|
||||
$records = $this->post('records');
|
||||
$count = 0;
|
||||
foreach($records as $record)
|
||||
{
|
||||
$answers = array();
|
||||
if(array_key_exists('answers',$record))
|
||||
{
|
||||
$answers = $record['answers'];
|
||||
unset($record['ansewrs']);
|
||||
}
|
||||
|
||||
$question_id = $this->db->saveRecords($record,QUESTIONS);
|
||||
|
||||
if($question_id != '' || $question_id != null)
|
||||
{
|
||||
$count++;
|
||||
foreach($answers as $answer)
|
||||
{
|
||||
$temp_answers = array('fk_question_id' => $question_id, 'answer' =>$answer , 'createdon' =>$record['createdon'] , 'fk_createdby' =>$record['fk_createdby'] , 'updatedon' =>$record['updatedon'], 'fk_updatedby' =>$record['fk_updatedby']);
|
||||
$this->db->saveRecords($temp_answers,QUESTIONANSWERS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if($count != 0 && $count == count($records))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $entity_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function saveExistQuestion_post()
|
||||
{
|
||||
$records = $this->post('records');
|
||||
$answers = array();
|
||||
|
||||
if(array_key_exists('answers',$records))
|
||||
{
|
||||
$answers = $records['answers'];
|
||||
unset($records['ansewrs']);
|
||||
}
|
||||
|
||||
$where_condtion_array = array('question_id'=>$records['question_id']);
|
||||
$affected_rows = $this->db->updateRecords($records,QUESTIONS,$where_condtion_array);
|
||||
$affected_rows_child = 0;
|
||||
foreach($answers as $answer)
|
||||
{
|
||||
$where_condtion_array = array('question_answer_id'=>$answer['question_answer_id']);
|
||||
$affected_rows_child = $this->db->updateRecords($answer,QUESTIONANSWERS,$where_condtion_array);
|
||||
}
|
||||
|
||||
if($affected_rows == 1 && (count($answers) == $affected_rows_child))
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $affected_rows;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
264
api/application/controllers/Template_Management_Controller.php
Normal file
264
api/application/controllers/Template_Management_Controller.php
Normal file
@ -0,0 +1,264 @@
|
||||
<?php
|
||||
/**
|
||||
|
||||
* User: velz
|
||||
* This Controller deals with User Management CRUD Operations
|
||||
*/
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
|
||||
require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
|
||||
|
||||
class Template_Management_Controller extends REST_Controller {
|
||||
|
||||
function __construct()
|
||||
{
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
$this->load->model('Template_Management_Model');
|
||||
|
||||
}
|
||||
|
||||
public function listAllUsers_get()
|
||||
{
|
||||
|
||||
$result = $this->User_Management_Model->$listAllUsers();
|
||||
if($result['data_status'])
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['records'] = $result['data'];
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NO_CONTENT;
|
||||
$this->response($data,REST_Controller::HTTP_NO_CONTENT);
|
||||
}
|
||||
}
|
||||
|
||||
public function saveNewUser_post()
|
||||
{
|
||||
$roles = "";
|
||||
$lender_hierarchy = "";
|
||||
|
||||
if($this->post('roles')){ $roles = $this->post('roles'); }
|
||||
|
||||
if($this->post('lender_hierarchy')){ $lender_hierarchy = $this->post('lender_hierarchy'); }
|
||||
|
||||
|
||||
$records = $this->post('records');
|
||||
$roles = $this->post('roles');
|
||||
|
||||
$lender_hierarchy = $this->post('lender_hierarchy');
|
||||
|
||||
if($_FILES['profilepic']['tmp_name'])
|
||||
{
|
||||
|
||||
|
||||
$profilepic = $_FILES['profilepic']['tmp_name'];
|
||||
$profilepicname = $_FILES['profilepic']['name'];
|
||||
$profilepicname = strtolower($profilepicname);
|
||||
$profilepics3path = "";
|
||||
|
||||
if(array_key_exists('fk_entity_id'),$records)
|
||||
{
|
||||
$entity_id = $records['fk_entity_id'];
|
||||
if($entity_id == 1) //1 means sine_edge Profile
|
||||
{
|
||||
$profilepics3path = 'sineedge/'.$profilepicname;
|
||||
}
|
||||
else if($entity_id == 2)//1 means lender Profile
|
||||
{
|
||||
$profilepics3path = 'lender/'.$profilepicname;
|
||||
}
|
||||
else // else or 3 means vendor Profile
|
||||
{
|
||||
$profilepics3path = 'vendor/'.$profilepicname;
|
||||
}
|
||||
}
|
||||
|
||||
$bucketname = PROFILEPICTUREBUCKETNAME;
|
||||
$key = $profilepics3path;
|
||||
$sourcefile = $profilepic;
|
||||
|
||||
$data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($data);
|
||||
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && [$s3result'@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$records['profilepic'] = $profilepicname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$records['profilepic'] = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
$user_id = $this->User_Management_Model->saveRecords($recordrs,USERPROFILE);//insert user records and get userid
|
||||
|
||||
if($roles != "")
|
||||
{
|
||||
foreach($roles as $role)
|
||||
{
|
||||
$role_array = array('user_role'=>$role['user_role'],'fk_userid'=>$user_id);//insert roles againest user
|
||||
$this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES);
|
||||
}
|
||||
}
|
||||
|
||||
if($lender_hierarchy != "")
|
||||
{
|
||||
foreach($lender_hierarchy as $hierarchy)
|
||||
{
|
||||
$hierarchy = array('fk_hierarchy_id'=>$hierarchy['fk_hierarchy_id'],'fk_user_id'=>$user_id,'fk_createdby'=>$records['fk_createdby'],'createdon'=>$records['createdon']);//insert hierarchy againest lender type users
|
||||
$this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY);
|
||||
}
|
||||
}
|
||||
|
||||
if($user_id != '' || $user_id != null)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $user_id;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function updateExistUser_post()
|
||||
{
|
||||
$roles = "";
|
||||
$lender_hierarchy = "";
|
||||
|
||||
if($this->post('roles')){ $roles = $this->post('roles'); }
|
||||
|
||||
if($this->post('lender_hierarchy')){ $lender_hierarchy = $this->post('lender_hierarchy'); }
|
||||
|
||||
|
||||
$records = $this->post('records');
|
||||
$roles = $this->post('roles');
|
||||
|
||||
$lender_hierarchy = $this->post('lender_hierarchy');
|
||||
|
||||
if($_FILES['profilepic']['tmp_name'])
|
||||
{
|
||||
|
||||
|
||||
$profilepic = $_FILES['profilepic']['tmp_name'];
|
||||
$profilepicname = $_FILES['profilepic']['name'];
|
||||
$profilepicname = strtolower($profilepicname);
|
||||
$profilepics3path = "";
|
||||
|
||||
if(array_key_exists('fk_entity_id'),$records)
|
||||
{
|
||||
$entity_id = $records['fk_entity_id'];
|
||||
if($entity_id == 1) //1 means sine_edge Profile
|
||||
{
|
||||
$profilepics3path = 'sineedge/'.$profilepicname;
|
||||
}
|
||||
else if($entity_id == 2)//1 means lender Profile
|
||||
{
|
||||
$profilepics3path = 'lender/'.$profilepicname;
|
||||
}
|
||||
else // else or 3 means vendor Profile
|
||||
{
|
||||
$profilepics3path = 'vendor/'.$profilepicname;
|
||||
}
|
||||
}
|
||||
|
||||
$bucketname = PROFILEPICTUREBUCKETNAME;
|
||||
$key = $profilepics3path;
|
||||
$sourcefile = $profilepic;
|
||||
|
||||
$data = array('bucket_name'=>$bucketname,'key'=>$key,'sourcefile'=>$sourcefile);
|
||||
$s3result= $this->aws_s3->uploadFileToS3Bucket($data);
|
||||
|
||||
if(is_object($s3result) && $s3result['ObjectURL'] != '' && [$s3result'@metadata']['statusCode'] == 200)
|
||||
{
|
||||
$records['profilepic'] = $profilepicname;
|
||||
}
|
||||
else
|
||||
{
|
||||
$records['profilepic'] = null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
$where_condition_array = array('userid'=>$records['userid']);
|
||||
$modified = $this->User_Management_Model->updateRecords($recordrs,USERPROFILE,$where_condition_array);//insert user records and get userid
|
||||
|
||||
if($roles != "")
|
||||
{
|
||||
foreach($roles as $role)
|
||||
{
|
||||
|
||||
$this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEROLES,array('userid'=>$records['userid']));
|
||||
$role_array = array('user_role'=>$role['user_role'],'fk_userid'=>$records['userid']);
|
||||
$this->User_Management_Model->saveRecords($role_array,USERPROFILEROLES);
|
||||
}
|
||||
}
|
||||
|
||||
if($lender_hierarchy != "")
|
||||
{
|
||||
foreach($lender_hierarchy as $hierarchy)
|
||||
{
|
||||
|
||||
$this->User_Management_Model->updateRecords(array('isactive'=>0),USERPROFILEHIERARCHY,array('userid'=>$records['userid']));
|
||||
$hierarchy = array('fk_hierarchy_id'=>$hierarchy['fk_hierarchy_id'],'fk_user_id'=>$user_id);//insert hierarchy againest lender type users
|
||||
$this->User_Management_Model->saveRecords($hierarchy,USERPROFILEHIERARCHY);
|
||||
}
|
||||
}
|
||||
|
||||
if($modified != '' || $modified != null || $modified != 0)
|
||||
{
|
||||
$data['dataStatus'] = true;
|
||||
$data['status'] = REST_Controller::HTTP_OK;
|
||||
$data['record'] = $modified;
|
||||
$this->response($data,REST_Controller::HTTP_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
$data['dataStatus'] = false;
|
||||
$data['status'] = REST_Controller::HTTP_NOT_MODIFIED;
|
||||
$this->response($data,REST_Controller::HTTP_NOT_MODIFIED);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
61
api/application/models/Entity_Management_Model.php
Normal file
61
api/application/models/Entity_Management_Model.php
Normal file
@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . '/libraries/SPARQ_Model.php';
|
||||
class Entity_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function listAllEntities()
|
||||
{
|
||||
$result_data = array();
|
||||
|
||||
$this->db->SELECT('ENTITY.entity_id, ENTITY.full_name, ENTITY.short_name, ENTITY.fk_region,REGIONS.name as region_name, ENTITY.fk_state,STATE.name as state_name, ENTITY.fk_city,CITY.name as city_name, ENTITY.fk_branch,BRANCH.name as branch_name, ENTITY.addressline1, ENTITY.addressline2, ENTITY.official_email, ENTITY.alt_email, ENTITY.phone_number, ENTITY.mobile_no, ENTITY.remarks, ENTITY.createdon, ENTITY.fk_createdby,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as createdby, ENTITY.updatedon, ENTITY.fk_updatedby,concat(USERPROFILE1.first_name,' ',USERPROFILE1.last_name) as updatedby, ENTITY.isactive, ENTITY.pan, ENTITY.gst_no, ENTITY.gst_state_code, addressline3, ENTITY.tat, ENTITY.fk_entity_type_id,ENTITYTYPE.name as entity_name');
|
||||
$this->db->FROM(ENTITY.' as ENTITY');
|
||||
$this->db->JOIN(REGIONS.' as REGIONS','ENTITY.fk_region = REGIONS.region_id AND REGIONS.isactive = 1');
|
||||
$this->db->JOIN(STATE.' as STATE','ENTITY.fk_state = STATE.state_id AND STATE.isactive = 1');
|
||||
$this->db->JOIN(CITY.' as CITY','ENTITY.fk_city = CITY.city_id AND CITY.isactive = 1');
|
||||
$this->db->JOIN(BRANCH.' as BRANCH','ENTITY.fk_branch = BRANCH.branch_id AND BRANCH.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITY.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','ENTITY.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
$this->db->JOIN(ENTITYTYPE.' as ENTITYTYPE','ENTITY.fk_entity_type_id = ENTITYTYPE.entity_type_id AND ENTITYTYPE.isactive = 1');
|
||||
|
||||
|
||||
$result = $this->db->get()->result_array();
|
||||
|
||||
foreach($result as $key => $r)
|
||||
{
|
||||
$this->db->SELECT('ENTITYCHILD.entity_child_id,ENTITYCHILD.contact_person,ENTITYCHILD.contact_email,ENTITYCHILD.contact_mobile_no,ENTITYCHILD.contact_person,ENTITYCHILD.isactive,ENTITYCHILD.createdon,ENTITYCHILD.fk_createdby,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as createdby,ENTITYCHILD.updatedon,ENTITYCHILD.fk_updatedby,concat(USERPROFILE1.first_name,' ',USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->FROM(ENTITYCHILD.' as ENTITYCHILD');
|
||||
$this->db->JOIN(ENTITY.' as ENTITY','ENTITYCHILD.fk_entity_id = ENTITY.entity_id AND ENTITY.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','ENTITYCHILD.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','ENTITYCHILD.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
$this->db->where('ENTITY.entity_id',$r['entity_id']);
|
||||
|
||||
$entity_child_data = $this->db->get()->result_array();
|
||||
|
||||
array_push($result[$key],$entity_child_data);
|
||||
|
||||
}
|
||||
|
||||
if(count($result) > 0 )
|
||||
{
|
||||
$result_data['data_status'] = true;
|
||||
$result_data['data'] = $result;
|
||||
return $result_data;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data['data_status'] = false;
|
||||
$result_data['data'] = null;
|
||||
return $result_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
55
api/application/models/Question_Management_Model.php
Normal file
55
api/application/models/Question_Management_Model.php
Normal file
@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . '/libraries/SPARQ_Model.php';
|
||||
class Question_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function listAllQuestions()
|
||||
{
|
||||
|
||||
|
||||
$this->db->SELECT('QUESTIONS.question_id, QUESTIONS.question, QUESTIONS.description, QUESTIONS.fk_question_catagory,QUESTIONCATEGORY.category_name, QUESTIONS.fk_question_answertype,QUESTIONANSWERTYPE.answer_type_name,QUESTIONS.isactive, QUESTIONS.createdon, QUESTIONS.fk_createdby, QUESTIONS.updatedon, QUESTIONS.fk_updatedby,concat(USERPROFILE.first_name,' ',USERPROFILE.last_name) as createdby,concat(USERPROFILE1.first_name,' ',USERPROFILE1.last_name) as updatedby');
|
||||
$this->db->FROM(QUESTIONS.' as QUESTIONS');
|
||||
$this->db->JOIN(QUESTIONANSWERTYPE.' as QUESTIONANSWERTYPE','QUESTIONS.fk_question_answertype = QUESTIONANSWERTYPE.question_answer_type_id AND QUESTIONANSWERTYPE.isactive = 1');
|
||||
$this->db->JOIN(QUESTIONCATEGORY.' as QUESTIONCATEGORY','QUESTIONS.fk_question_catagory = QUESTIONCATEGORY.question_categroy_id AND QUESTIONCATEGORY.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
|
||||
$result = $this->db->get()->result_array();
|
||||
|
||||
foreach($result as $key => $r)
|
||||
{
|
||||
$this->db->SELECT('QUESTIONANSWERS.question_answer_id, QUESTIONANSWERS.fk_question_id, QUESTIONANSWERS.answer, QUESTIONANSWERS.createdon, QUESTIONANSWERS.fk_createdby, QUESTIONANSWERS.updatedon, QUESTIONANSWERS.fk_updatedby, isactive');
|
||||
$this->db->FROM(QUESTIONANSWERS.' as QUESTIONANSWERS');
|
||||
$this->db->JOIN(QUESTIONS.' as QUESTIONS','QUESTIONANSWERS.fk_question_id = QUESTIONS.question_id AND QUESTIONS.isactive');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE','QUESTIONANSWERS.fk_createdby = USERPROFILE.userid AND USERPROFILE.isactive = 1');
|
||||
$this->db->JOIN(USERPROFILE.' as USERPROFILE1','QUESTIONANSWERS.fk_updatedby = USERPROFILE1.userid AND USERPROFILE1.isactive = 1');
|
||||
$this->db->where('QUESTIONS.question_id',$r['question_id']);
|
||||
$answers_data = $this->db->get()->result_array();
|
||||
|
||||
array_push($result[$key],$answers_data);
|
||||
}
|
||||
|
||||
if(count($result) > 0 )
|
||||
{
|
||||
$result_data['data_status'] = true;
|
||||
$result_data['data'] = $result;
|
||||
return $result_data;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data['data_status'] = false;
|
||||
$result_data['data'] = null;
|
||||
return $result_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
47
api/application/models/Template_Management_Model.php
Normal file
47
api/application/models/Template_Management_Model.php
Normal file
@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
require_once APPPATH . '/libraries/SPARQ_Model.php';
|
||||
class Template_Management_Model extends SPARQ_Model {
|
||||
|
||||
public function __construct() {
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
|
||||
public function listAllUsers()
|
||||
{
|
||||
$result_data = array();
|
||||
|
||||
$this->select('USERPROFILE.userid, USERPROFILE.aws_name, USERPROFILE.first_name, USERPROFILE.last_name, USERPROFILE.email, USERPROFILE.alt_email, USERPROFILE.mobile_no, USERPROFILE.alt_mobile_no, USERPROFILE.addressline1, USERPROFILE.addressline2, USERPROFILE.profilepic, USERPROFILE.createdon, USERPROFILE.fk_createdby,USERPROFILE1.first_name,USERPROFILE1.last_name, USERPROFILE.updatedon, USERPROFILE.fk_updatedby,USERPROFILE2.first_name,USERPROFILE2.last_name, USERPROFILE.fk_entity_id,ENTITY.full_name, USERPROFILE.isactive, USERPROFILE.fk_designation,DESIGNATION.name, USERPROFILE.addressline3, USERPROFILE.fk_city,CITY.name, USERPROFILE.fk_state,STATE.name, USERPROFILE.pincode');
|
||||
$this->db->from(USERPROFILE.'as USERPROFILE');
|
||||
$this->db->join(ENTITY.'as ENTITY','USERPROFILE.fk_entity_id = ENTITY.entity_id and ENTITY.isactive = 1');
|
||||
$this->db->join(DESIGNATION.'as DESIGNATION','USERPROFILE.fk_designation = DESIGNATION.designation_id and DESIGNATION.isactive = 1');
|
||||
$this->db->join(STATE.'as STATE','USERPROFILE.fk_state = STATE.state_id and STATE.isactive = 1');
|
||||
$this->db->join(CITY.'as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1');
|
||||
$this->db->join(USERPROFILE.'as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1');
|
||||
$this->db->join(USERPROFILE.'as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1');
|
||||
$this->db->join(USERPROFILEHIERARCHY.'as USERPROFILEHIERARCHY','USERPROFILE.userid = USERPROFILEHIERARCHY.fk_user_id and LENDERHIERARCHY.isactive = 1','LEFT');
|
||||
$this->db->join(LENDERHIERARCHY.'as LENDERHIERARCHY','USERPROFILEHIERARCHY.user_lender_hierarchy_id = LENDERHIERARCHY.lender_hierarchy_id and LENDERHIERARCHY.isactive = 1');
|
||||
$this->db->join(USERPROFILEROLES.'as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_user_id and USERPROFILEROLES.isactive = 1');
|
||||
//$this->db->where('USERPROFILE.isactive = 1');
|
||||
$result = $this->db->get()->result_array();
|
||||
|
||||
if(count($result) > 0 )
|
||||
{
|
||||
$result_data['data_status'] = true;
|
||||
$result_data['data'] = $result;
|
||||
return $result_data;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$result_data['data_status'] = false;
|
||||
$result_data['data'] = null;
|
||||
return $result_data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -22,7 +22,7 @@ class User_Management_Model extends SPARQ_Model {
|
||||
$this->db->join(CITY.'as CITY','USERPROFILE.fk_city = CITY.city_id and CITY.isactive = 1');
|
||||
$this->db->join(USERPROFILE.'as USERPROFILE1','USERPROFILE.fk_createdby = USERPROFILE1.userid and USERPROFILE1.isactive = 1');
|
||||
$this->db->join(USERPROFILE.'as USERPROFILE2','USERPROFILE.fk_updatedby = USERPROFILE2.userid and USERPROFILE2.isactive = 1');
|
||||
$this->db->join(USERPROFILEHIERARCHY.'as USERPROFILEHIERARCHY','USERPROFILE.userid = USERPROFILEHIERARCHY.fk_user_id and LENDERHIERARCHY.isactive = 1');
|
||||
$this->db->join(USERPROFILEHIERARCHY.'as USERPROFILEHIERARCHY','USERPROFILE.userid = USERPROFILEHIERARCHY.fk_user_id and LENDERHIERARCHY.isactive = 1','LEFT');
|
||||
$this->db->join(LENDERHIERARCHY.'as LENDERHIERARCHY','USERPROFILEHIERARCHY.user_lender_hierarchy_id = LENDERHIERARCHY.lender_hierarchy_id and LENDERHIERARCHY.isactive = 1');
|
||||
$this->db->join(USERPROFILEROLES.'as USERPROFILEROLES','USERPROFILE.userid = USERPROFILEROLES.fk_user_id and USERPROFILEROLES.isactive = 1');
|
||||
//$this->db->where('USERPROFILE.isactive = 1');
|
||||
|
||||
Loading…
Reference in New Issue
Block a user