256 lines
9.7 KiB
PHP
Executable File
256 lines
9.7 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
|
|
|
|
// 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');
|
|
$getLeadDetails = $this->Calltracking_model->getLeadDetails($requestedBy,$mobileNumber);
|
|
|
|
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['CreatedBy'] = $this->post('createdBy');
|
|
$tracking_details['CreatedOn'] = $now->format('Y-m-d H:i:s');
|
|
//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['searchDate'] = $this->post('searchDate');
|
|
// $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['UpdatedOn'] = $now->format('Y-m-d H:i:s');
|
|
|
|
// 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');
|
|
$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');
|
|
$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
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} |