406 lines
16 KiB
PHP
Executable File
406 lines
16 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* Created by PhpStorm.
|
|
* User: karthi
|
|
* Date: 11/15/17
|
|
* Time: 5:41 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';
|
|
|
|
/**
|
|
* 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 Call_Tracking_Controller extends REST_Controller {
|
|
|
|
function __construct()
|
|
{
|
|
// Construct the parent class
|
|
parent::__construct();
|
|
|
|
// Configure limits on our controller methods
|
|
// Ensure you have created the 'limits' table and enabled 'limits' within application/config/rest.php
|
|
$this->methods['getTrackingLeadDetails_get']['limit'] = 500; // 500 requests per hour per user/key
|
|
$this->methods['getTrackingLeadDetails_post']['limit'] = 1000; // 100 requests per hour per user/key
|
|
$this->methods['getTrackingLeadDetails_delete']['limit'] = 50; // 50 requests per hour per user/key
|
|
$this->methods['addTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getTrackingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['updateFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['loadFollowupDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getDashboardCallTrack_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentLeadDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentCloseDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['getRecentPendingDetails_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
$this->methods['callAsImportantFlag_post']['limit'] = 1000; // 50 requests per hour per user/key
|
|
|
|
|
|
// load the model
|
|
$this->load->model('Calltracking_model', 'Calltracking_model');
|
|
|
|
}
|
|
|
|
/*
|
|
* get lead details with mobile number
|
|
* created by kms
|
|
* */
|
|
public function getTrackingLeadDetails_post()
|
|
{
|
|
$requestedBy = $this->post('requestedBy');
|
|
$mobileNumber = $this->post('mobileNumber');
|
|
$branchID = $this->post('branchID');
|
|
$loginType = $this->post('userType');
|
|
$getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber,$branchID,$loginType);
|
|
|
|
if ($getLeadDetails)
|
|
{
|
|
$getLeadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* add tracking lead details
|
|
* created by kms
|
|
* */
|
|
|
|
public function addLeadTrackingDetails_post()
|
|
{
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
//store lead details
|
|
$lead_details['LeadName'] = $this->post('studentName');
|
|
$lead_details['MobileNumber'] = $this->post('mobileNumber');
|
|
$lead_details['IsNewEnquiry'] = $this->post('enquiryStatus');
|
|
$lead_details['CreatedBy'] = $this->post('createdBy');
|
|
$lead_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
|
|
//store tracking details
|
|
$tracking_details['University'] = $this->post('universityID');
|
|
$tracking_details['Course'] = $this->post('courseName');
|
|
$tracking_details['ActivityStatus'] = $this->post('activity');
|
|
$tracking_details['AssignedTo'] = $this->post('assignedTo');
|
|
$tracking_details['StatusCode'] = $this->post('status');
|
|
$tracking_details['ReferredBy'] = $this->post('referedBy');
|
|
$tracking_details['AlternateMobile'] = $this->post('alterMobile');
|
|
$tracking_details['Address'] = $this->post('address');
|
|
$tracking_details['CreatedBy'] = $this->post('createdBy');
|
|
$tracking_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$tracking_details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$tracking_details['CreatedBranch'] = $this->post('branchId');
|
|
//store tracking followup details
|
|
$tracking_followup_details['FollowupOn'] = $this->post('date');
|
|
$tracking_followup_details['FollowupComments'] = $this->post('comments');
|
|
$tracking_followup_details['CreatedBy'] = $this->post('createdBy');
|
|
$tracking_followup_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
$leadDetails = $this->Calltracking_model->addleadDetails($lead_details,$tracking_details,$tracking_followup_details);// Check if the users data store contains users (in case the database result returns NULL)
|
|
if ($leadDetails)
|
|
{
|
|
$leadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($leadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'Something went wrong.please try again!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get tracking details
|
|
* created by kms
|
|
* */
|
|
public function getTrackingDetails_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
// $search['branchID'] = $this->post('branchId');
|
|
$search['searchDate'] = $this->post('searchDate');
|
|
$search['CreatedBranch'] = $this->post('branchId');
|
|
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
|
|
// $search['searchName']= $this->post('searchName');
|
|
$getTrackedDetails = $this->Calltracking_model->getTrackingDetails($search);
|
|
|
|
if ($getTrackedDetails)
|
|
{
|
|
$getTrackedDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getTrackedDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* update tracking followup details
|
|
* created by kms
|
|
* */
|
|
public function updateFollowupDetails_post()
|
|
{
|
|
$now = new DateTime();
|
|
$now->setTimezone(new DateTimezone('Asia/Kolkata'));
|
|
|
|
//store followup details for update
|
|
$update_followup_details['TrackingID'] = $this->post('trackingID');
|
|
$update_followup_details['UpdatedBy'] = $this->post('updatedBy');
|
|
$update_followup_details['StatusCode'] = $this->post('status');
|
|
$update_followup_details['AssignedTo'] = $this->post('assignedTo');
|
|
$update_followup_details['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
|
$update_followup_details['CreatedBranch'] = $this->post('branchId');
|
|
$update_followup_details['Address'] = $this->post('address');
|
|
$update_followup_details['AlternateMobile'] = $this->post('alternateMobile');
|
|
$update_followup_details['ReferredBy'] = $this->post('referredBy');
|
|
// store followup details for insert
|
|
$followup_details['TrackingID'] = $this->post('trackingID');
|
|
$followup_details['FollowupOn'] = $this->post('date');
|
|
$followup_details['CreatedBy'] = $this->post('updatedBy');
|
|
$followup_details['FollowupComments'] = $this->post('comments');
|
|
$followup_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
|
|
|
|
|
|
|
|
$updateDetails = $this->Calltracking_model->updateFollowupDetails($update_followup_details,$followup_details);// Check if the users data store contains users (in case the database result returns NULL)
|
|
if ($updateDetails)
|
|
{
|
|
$updateDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($updateDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'Something went wrong.please try again!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* load followup details
|
|
* created by kms
|
|
* */
|
|
|
|
public function loadFollowupDetails_post()
|
|
{
|
|
$get_details['TrackingID'] = $this->post('trackingID');
|
|
$get_details['UpdatedBy'] = $this->post('updatedBy');
|
|
$get_details['CreatedBranch'] = $this->post('branchId');
|
|
$get_details['requestedDept'] = $this->post('requestedDept');
|
|
|
|
$getLoadDetails = $this->Calltracking_model->getLoadFollowupDetails($get_details);
|
|
|
|
if ($getLoadDetails)
|
|
{
|
|
$getLoadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getLoadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get dash board call track details
|
|
* created by kms
|
|
* */
|
|
|
|
public function getDashboardCallTrack_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['BranchID'] = $this->post('branchId');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
|
|
$getdashBoardCallDetails = $this->Calltracking_model->getDashboardTrackingDetails($search);
|
|
if ($getdashBoardCallDetails)
|
|
{
|
|
$getdashBoardCallDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getdashBoardCallDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get recent call lead details
|
|
* created by kms
|
|
* */
|
|
|
|
public function getRecentLeadDetails_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
$search['loadDate'] = $this->post('loadDate');
|
|
$search['CreatedBranch'] = $this->post('branchId');
|
|
// $search['searchDate'] = $this->post('searchDate');
|
|
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
|
|
// $search['searchName']= $this->post('searchName');
|
|
$getRecentLeadDetails = $this->Calltracking_model->getRecentleadDetails($search);
|
|
|
|
if ($getRecentLeadDetails)
|
|
{
|
|
$getRecentLeadDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentLeadDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* get recent close details
|
|
* created by kms
|
|
* */
|
|
public function getRecentCloseDetails_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
$search['loadDate'] = $this->post('loadDate');
|
|
$search['CreatedBranch'] = $this->post('branchId');
|
|
// $search['searchDate'] = $this->post('searchDate');
|
|
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
|
|
// $search['searchName']= $this->post('searchName');
|
|
$getRecentCloseDetails = $this->Calltracking_model->getRecentCloseDetails($search);
|
|
|
|
if ($getRecentCloseDetails)
|
|
{
|
|
$getRecentCloseDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentCloseDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
/*
|
|
* get recent pending details
|
|
* created by kms
|
|
* */
|
|
public function getRecentPendingDetails_post()
|
|
{
|
|
$search['requestedBy'] = $this->post('requestedBy');
|
|
$search['requestedDept'] = $this->post('requestedDept');
|
|
$search['loadDate'] = $this->post('loadDate');
|
|
$search['CreatedBranch'] = $this->post('branchId');
|
|
// $search['searchDate'] = $this->post('searchDate');
|
|
// $search['searchMobileNumber'] = $this->post('searchMobileNumber');
|
|
// $search['searchName']= $this->post('searchName');
|
|
$getRecentPendingDetails = $this->Calltracking_model->getRecentPendingDetails($search);
|
|
|
|
if ($getRecentPendingDetails)
|
|
{
|
|
$getRecentPendingDetails['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($getRecentPendingDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
/*
|
|
* mark as important for call
|
|
* created by kms
|
|
* */
|
|
public function callAsImportantFlag_post(){
|
|
$trackID = $this->post('trackId');
|
|
$flagStatus = $this->post('flag');
|
|
$updateFlag = $this->Calltracking_model->updateFlagStatus($trackID,$flagStatus);
|
|
|
|
if ($updateFlag)
|
|
{
|
|
$updateFlag['status'] = REST_Controller::HTTP_OK;
|
|
// Set the response and exit
|
|
$this->response($updateFlag, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
|
}
|
|
else
|
|
{
|
|
// Set the response and exit
|
|
$this->response([
|
|
'message' => 'No records found!',
|
|
'status' => REST_Controller::HTTP_NOT_FOUND
|
|
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} |