broadcast details update : kdk
This commit is contained in:
parent
062b103cc1
commit
a7a3c03836
@ -1,11 +1,9 @@
|
||||
<?php
|
||||
|
||||
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
|
||||
@ -13,70 +11,58 @@ require_once APPPATH . '/libraries/REST_Controller.php';
|
||||
* @package CodeIgniter
|
||||
* @subpackage Rest Server
|
||||
* @category Controller
|
||||
* @author
|
||||
* @author
|
||||
* @license MIT
|
||||
* @link
|
||||
* @link
|
||||
*/
|
||||
class Broadcast_Controller extends REST_Controller {
|
||||
|
||||
/*
|
||||
/*
|
||||
* broadcast, sms send functionality
|
||||
* params:
|
||||
* created by kdk
|
||||
* */
|
||||
function __construct()
|
||||
{
|
||||
function __construct() {
|
||||
// Construct the parent class
|
||||
parent::__construct();
|
||||
$this->methods['getUniversity_post']['limit'] = 100;
|
||||
$this->methods['getUniversity_post']['limit'] = 100;
|
||||
$this->methods['chkUnivIdExistDetail_post']['limit'] = 100;
|
||||
// load the broadcast model
|
||||
// load the broadcast model
|
||||
$this->load->model('Broadcast_model', 'broadcast_model');
|
||||
}
|
||||
|
||||
|
||||
// get University, Course, Branch Detailss
|
||||
public function getUniveCourseBatch_post() {
|
||||
$reqData = $this->post('data');
|
||||
$loginUserId = $reqData['localUserID'];
|
||||
$loginUserBranchId = $reqData['localBranchID'];
|
||||
$loginUserType = $reqData['localType'];
|
||||
$getUniversityListDetails = $this->broadcast_model->get_university_course_batch();// Check if the employee exist
|
||||
if ($getUniversityListDetails)
|
||||
{
|
||||
$getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
$getUniversityListDetails = $this->broadcast_model->get_university_course_batch($loginUserBranchId); // Check if the employee exist
|
||||
if ($getUniversityListDetails) {
|
||||
$getUniversityListDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getUniversityListDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
} else {
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ger Result fot searched keyword details
|
||||
public function getStuListForBrodcast_post() {
|
||||
$reqSearchData = $this->post('data');
|
||||
$reqData = $this->post('requestDetails');
|
||||
// print_r($reqSearchData);exit();
|
||||
|
||||
$getSearchDetails = $this->broadcast_model->get_search_result($reqSearchData, $reqData);// Check if the employee exist
|
||||
if ($getSearchDetails)
|
||||
{
|
||||
$getSearchDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getSearchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
$getSearchDetails = $this->broadcast_model->get_search_result($reqSearchData, $reqData); // Check if the employee exist
|
||||
if ($getSearchDetails) {
|
||||
$getSearchDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getSearchDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
} else {
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,83 +73,60 @@ class Broadcast_Controller extends REST_Controller {
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$dateTime = $time;
|
||||
$count = count($reqData);
|
||||
for($i=0; $i < $count; $i++) {
|
||||
$data[] = array(
|
||||
'StudentID' => $reqData[$i]['StudentID']
|
||||
);
|
||||
for ($i = 0;$i < $count;$i++) {
|
||||
$data[] = array('StudentID' => $reqData[$i]['StudentID']);
|
||||
}
|
||||
|
||||
$sendMsgDetails = $this->broadcast_model->send_msg_students($data, $msg, $reqDetails);// Check if the employee exist
|
||||
if ($sendMsgDetails)
|
||||
{
|
||||
$sendMsgDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($sendMsgDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
$sendMsgDetails = $this->broadcast_model->send_msg_students($data, $msg, $reqDetails); // Check if the employee exist
|
||||
if ($sendMsgDetails) {
|
||||
$sendMsgDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($sendMsgDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
} else {
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getSMSGroupDetails_post() {
|
||||
$reqData = $this->post('data');
|
||||
$reqDataBy = $this->post('localReqDetails');
|
||||
// print_r($reqData);exit();
|
||||
$getMegDetails = $this->broadcast_model->getSMSGroupDetails($reqData);// Check if the employee exist
|
||||
if ($getMegDetails)
|
||||
{
|
||||
$getMegDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getMegDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
$getMegDetails = $this->broadcast_model->getSMSGroupDetails($reqData, $reqDataBy); // Check if the employee exist
|
||||
if ($getMegDetails) {
|
||||
$getMegDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getMegDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
} else {
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getSMSSendReportList_post(){
|
||||
|
||||
public function getSMSSendReportList_post() {
|
||||
$reqData = $this->post('data');
|
||||
$reqDataBy = $this->post('localReqDetails');
|
||||
// $time = date('Y-m-d H:i:s');
|
||||
// $dateTime = $time;
|
||||
// $date1 = $dateTime;
|
||||
// $date2 = $dateTime;
|
||||
|
||||
$getMegCronDetails = $this->broadcast_model->getSmsSendBetweenDate($reqData, $reqDataBy);// Check if the employee exist
|
||||
if ($getMegCronDetails)
|
||||
{
|
||||
$getMegCronDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getMegCronDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set the response and exit
|
||||
$this->response([
|
||||
'message' => 'No list were found',
|
||||
'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
$reqDataBy = $this->post('requestDetails');
|
||||
$getMegCronDetails = $this->broadcast_model->getSmsSendBetweenDate($reqData, $reqDataBy); // Check if the employee exist
|
||||
if ($getMegCronDetails) {
|
||||
$getMegCronDetails['status'] = REST_Controller::HTTP_OK;
|
||||
// Set the response and exit
|
||||
$this->response($getMegCronDetails, REST_Controller::HTTP_OK); // OK (200) being the HTTP response code
|
||||
|
||||
} else {
|
||||
// Set the response and exit
|
||||
$this->response(['message' => 'No list were found', 'status' => REST_Controller::HTTP_NOT_FOUND], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public function getCronCall_get() {
|
||||
$getMegCronDetails = $this->broadcast_model->getCronUpdate();// Check if the employee exist
|
||||
$getMegCronDetails = $this->broadcast_model->getCronUpdate(); // Check if the employee exist
|
||||
// echo $getMegCronDetails;exit();
|
||||
if($getMegCronDetails){
|
||||
echo $getMegCronDetails;
|
||||
}else {
|
||||
|
||||
if ($getMegCronDetails) {
|
||||
echo $getMegCronDetails;
|
||||
} else {
|
||||
}
|
||||
// if ($getMegCronDetails)
|
||||
// {
|
||||
@ -179,5 +142,6 @@ class Broadcast_Controller extends REST_Controller {
|
||||
// 'status' => REST_Controller::HTTP_NOT_FOUND
|
||||
// ], REST_Controller::HTTP_NOT_FOUND); // NOT_FOUND (404) being the HTTP response code
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,202 +4,182 @@
|
||||
* Time: 5:28 PM
|
||||
*/
|
||||
defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
|
||||
class Broadcast_model extends CI_Model
|
||||
{
|
||||
|
||||
class Broadcast_model extends CI_Model {
|
||||
/*
|
||||
* status updation details
|
||||
* params:
|
||||
* created by kdk
|
||||
* */
|
||||
|
||||
|
||||
// get serach result
|
||||
public function get_search_result($reqData, $req) {
|
||||
|
||||
// print_r($reqData['University']);
|
||||
// print_r($req);
|
||||
// exit();
|
||||
$localBranch = $req['localBranchID'];
|
||||
$University = $reqData['University'];
|
||||
$Course = $reqData['Course'];
|
||||
$Batch = $reqData['Batch'];
|
||||
|
||||
if($University != '' && $Course == '' && $Batch == '') {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON
|
||||
SC.CourseID = C.CourseID
|
||||
if ($University != '' && $Course == '' && $Batch == '') {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM " . STUDENTS . " as S
|
||||
LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode
|
||||
LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode
|
||||
WHERE
|
||||
SC.UniversityID = '$University'
|
||||
AND S.IsActive = '1'
|
||||
AND SC.IsActive = '1'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ($University != '' && $Course != '' && $Batch == '' ) {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON
|
||||
SC.CourseID = C.CourseID
|
||||
AND SC.IsActive = '1'
|
||||
AND SC.BranchID = '$localBranch'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ($University != '' && $Course != '' && $Batch == '') {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM " . STUDENTS . " as S
|
||||
LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode
|
||||
LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode
|
||||
WHERE
|
||||
SC.CourseID = '$Course' AND SC.UniversityID = '$University'
|
||||
AND S.IsActive = '1'
|
||||
AND SC.IsActive = '1'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ( $University != '' && $Course == '' && $Batch != '' ) {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName
|
||||
FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON
|
||||
SC.CourseID = C.CourseID
|
||||
LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID
|
||||
AND SC.IsActive = '1'
|
||||
AND SC.BranchID = '$localBranch'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ($University != '' && $Course == '' && $Batch != '') {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName ,C.CourseCode, U.UniversityName
|
||||
FROM " . STUDENTS . " as S
|
||||
LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode
|
||||
LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode
|
||||
LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID
|
||||
WHERE SFS.CourseID = SC.CourseID AND
|
||||
SFS.BatchCode = '$Batch' AND SC.UniversityID = '$University'
|
||||
AND S.IsActive = '1'
|
||||
AND SC.IsActive = '1'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ( $University != '' && $Course != '' && $Batch != '' ) {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON
|
||||
SC.CourseID = C.CourseID
|
||||
LEFT JOIN ".STUDENTS_FEES_STATUS." as SFS ON SFS.StudentID = SC.StudentID
|
||||
AND SC.IsActive = '1'
|
||||
AND SC.BranchID = '$localBranch'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
} else if ($University != '' && $Course != '' && $Batch != '') {
|
||||
$subQuery = "SELECT S.* , SC.ID as UNI_ID, SC.CourseID , C.CourseName , C.CourseCode, U.UniversityName
|
||||
FROM " . STUDENTS . " as S
|
||||
LEFT JOIN " . STUDENTCOURSE . " as SC ON SC.StudentID = S.StudentID
|
||||
LEFT JOIN " . UNIVERSITY . " as U ON SC.UniversityID = U.UniversityID AND SC.BranchID = U.BranchCode
|
||||
LEFT JOIN " . COURSE . " as C ON SC.CourseID = C.CourseID AND SC.BranchID = C.BranchCode
|
||||
LEFT JOIN " . STUDENTS_FEES_STATUS . " as SFS ON SFS.StudentID = SC.StudentID
|
||||
WHERE SFS.CourseID = SC.CourseID AND
|
||||
SFS.BatchCode = '$Batch' AND SC.CourseID = '$Course' AND SC.UniversityID = '$University'
|
||||
AND S.IsActive = '1'
|
||||
AND SC.IsActive = '1'";
|
||||
// AND S.BranchCode = '$branch'
|
||||
// SC.UniversityID LIKE '%$University%'
|
||||
// AND SC.CourseID LIKE '%$Course%'
|
||||
// AND SC.BatchCode LIKE '%$Batch%'
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
}
|
||||
// $subQuery = "SELECT S.* , SC.CourseID , C.CourseName , U.UniversityName
|
||||
// FROM ".STUDENTS." as S LEFT JOIN ".STUDENTCOURSE." as SC ON SC.StudentID = S.StudentID
|
||||
// LEFT JOIN ".UNIVERSITY." as U ON SC.UniversityID = U.UniversityID LEFT JOIN ".COURSE." as C ON
|
||||
// SC.CourseID = C.CourseID
|
||||
// WHERE
|
||||
// SC.UniversityID LIKE '%$University%'
|
||||
// AND SC.CourseID LIKE '%$Course%'
|
||||
// AND SC.BatchCode LIKE '%$Batch%'
|
||||
// AND S.IsActive = '1'
|
||||
// AND SC.IsActive = '1'";
|
||||
AND SC.IsActive = '1'
|
||||
AND SC.BranchID = '$localBranch'";
|
||||
$queryDetails = $this->db->query($subQuery);
|
||||
$results['searchResult'] = true;
|
||||
$results['search_result_details'] = $queryDetails->result();
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
// $queryDetails = $this->db->query($subQuery);
|
||||
// $results['searchResult'] = true;
|
||||
// $results['search_result_details'] = $queryDetails->result();
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
||||
// get list of universities, course, batch
|
||||
public function get_university_course_batch() {
|
||||
public function get_university_course_batch($branchId) {
|
||||
$this->db->select('t1.UniversityID, t1.UniversityName');
|
||||
$this->db->order_by('CreatedOn', 'DESC');
|
||||
$this->db->from(''.UNIVERSITY. ' as t1');
|
||||
$this->db->where('IsActive', 1);
|
||||
$this->db->from('' . UNIVERSITY . ' as t1');
|
||||
$this->db->where('t1.IsActive', 1);
|
||||
$this->db->where('t1.BranchCode', $branchId);
|
||||
// $this->db->join('' . COURSE . ' as t2', 't2.UniversityID = t1.UniversityID', 'LEFT');
|
||||
$univDetails = $this->db->get();
|
||||
$universityDetails = $univDetails->result();
|
||||
$endResult = [];
|
||||
foreach($universityDetails as $clip){
|
||||
foreach ($universityDetails as $clip) {
|
||||
// University Details
|
||||
$resultArr['UniversityID'] = $clip->UniversityID;
|
||||
$resultArr['UniversityName'] = $clip->UniversityName;
|
||||
|
||||
// Course Details
|
||||
$this->db->select('t2.CourseID, t2.CourseName');
|
||||
$this->db->from(''.COURSE. ' as t2');
|
||||
$this->db->from('' . COURSE . ' as t2');
|
||||
$this->db->where('t2.UniversityID', $clip->UniversityID);
|
||||
$this->db->where('t2.IsActive', 1);
|
||||
$this->db->where('t2.BranchCode', $branchId);
|
||||
$courDetails = $this->db->get();
|
||||
$courseDetails = $courDetails->result();
|
||||
$resultArr['Course'] =$courseDetails;
|
||||
|
||||
$resultArr['Course'] = $courseDetails;
|
||||
// Batch Details
|
||||
$this->db->select('t3.BatchName, t3.BatchCode');
|
||||
$this->db->from(''.BATCH. ' as t3');
|
||||
$this->db->from('' . BATCH . ' as t3');
|
||||
$this->db->where('t3.UniversityID', $clip->UniversityID);
|
||||
$this->db->where('t3.IsActive', 1);
|
||||
$this->db->where('t3.BranchCode', $branchId);
|
||||
$batDetails = $this->db->get();
|
||||
$batchDetails = $batDetails->result();
|
||||
$resultArr['Batch'] =$batchDetails;
|
||||
$resultArr['Batch'] = $batchDetails;
|
||||
array_push($endResult, $resultArr);
|
||||
}
|
||||
$results['univList'] = true;
|
||||
$results['univList'] = true;
|
||||
$results['university_details'] = $endResult;
|
||||
return $results;
|
||||
}
|
||||
|
||||
public function getSMSGroupDetails($reqData) {
|
||||
$querys = "SELECT t1.*, t2.DeliveredStatus, t2.DeliveredOn FROM T_BroadcastStatus as t1
|
||||
|
||||
public function getSMSGroupDetails($reqData ,$reqBy) {
|
||||
$localBranch = $reqBy['localBranchID'];
|
||||
$querys = "SELECT t1.*, t2.DeliveredStatus, t2.DeliveredOn FROM T_BroadcastStatus as t1
|
||||
LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
WHERE t1.MsgGroup = '$reqData' ORDER BY t1.CreatedOn DESC";
|
||||
|
||||
$smsSendGroupDetails = $this->db->query($querys);
|
||||
$smsSendGroupDetailsList = $smsSendGroupDetails->result();
|
||||
$results['smsSendGroupDetailsListStatus'] = true;
|
||||
$results['smsSendGroupDetailsList'] = $smsSendGroupDetailsList;
|
||||
return $results;
|
||||
WHERE t1.MsgGroup = '$reqData' AND t1.BranchCode='$localBranch' ORDER BY t1.CreatedOn DESC";
|
||||
$smsSendGroupDetails = $this->db->query($querys);
|
||||
$smsSendGroupDetailsList = $smsSendGroupDetails->result();
|
||||
$results['smsSendGroupDetailsListStatus'] = true;
|
||||
$results['smsSendGroupDetailsList'] = $smsSendGroupDetailsList;
|
||||
return $results;
|
||||
}
|
||||
|
||||
//get sms sent details
|
||||
public function getSmsSendBetweenDate($reqData, $reqDataBy) {
|
||||
|
||||
if($reqData['date'] != '' && $reqData['dateTo'] != '') {
|
||||
$d = new DateTime($reqData['date']);
|
||||
$dTo = new DateTime($reqData['dateTo']);
|
||||
$fromDate = $d->format('Y-m-d');
|
||||
$toDate = $dTo->format('Y-m-d');
|
||||
|
||||
// $querys = "SELECT t1.*, t2.* FROM T_BroadcastStatus as t1
|
||||
// LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
// WHERE STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
// AND '$toDate' ORDER BY t1.CreatedOn DESC";
|
||||
|
||||
$querys = "SELECT t1.*, COUNT(t1.MsgGroup) as MSG_SEND_CNT FROM T_BroadcastStatus as t1
|
||||
$localBranch = $reqDataBy['localBranchID'];
|
||||
if ($reqData['date'] != '' && $reqData['dateTo'] != '') {
|
||||
$d = new DateTime($reqData['date']);
|
||||
$dTo = new DateTime($reqData['dateTo']);
|
||||
$fromDate = $d->format('Y-m-d');
|
||||
$toDate = $dTo->format('Y-m-d');
|
||||
// $querys = "SELECT t1.*, t2.* FROM T_BroadcastStatus as t1
|
||||
// LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
// WHERE STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
// AND '$toDate' ORDER BY t1.CreatedOn DESC";
|
||||
$querys = "SELECT t1.*, COUNT(t1.MsgGroup) as MSG_SEND_CNT
|
||||
FROM T_BroadcastStatus as t1
|
||||
LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
WHERE STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
WHERE t1.BranchCode = '$localBranch' AND STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
AND '$toDate' GROUP BY t1.MsgGroup ORDER BY t1.CreatedOn DESC";
|
||||
|
||||
$smsSendDetails = $this->db->query($querys);
|
||||
$smsSendDetailsList = $smsSendDetails->result();
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsList'] = $smsSendDetailsList;
|
||||
|
||||
$smsSendDetails = $this->db->query($querys);
|
||||
$smsSendDetailsList = $smsSendDetails->result();
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsList'] = $smsSendDetailsList;
|
||||
} else {
|
||||
// $d = new DateTime($d1);
|
||||
// $dTo = new DateTime($d2);
|
||||
// $fromDate = $d->format('Y-m-d');
|
||||
// $toDate = $dTo->format('Y-m-d');
|
||||
|
||||
// $querys = "SELECT t1.*, t2.* FROM T_BroadcastStatus as t1
|
||||
// LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
// WHERE STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
// $querys = "SELECT t1.*, t2.* FROM T_BroadcastStatus as t1
|
||||
// LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
// WHERE STR_TO_DATE(t1.CreatedOn, '%Y-%m-%d') BETWEEN '$fromDate'
|
||||
// AND '$toDate' ORDER BY t1.CreatedOn DESC";
|
||||
|
||||
$querys = "SELECT t1.*, COUNT(t1.MsgGroup) FROM T_BroadcastStatus as t1
|
||||
LEFT JOIN T_BroadcastDeliveryCron as t2 ON t2.MsgId = t1.MsgId
|
||||
WHERE t1.BranchCode = '$localBranch'
|
||||
GROUP BY t1.MsgGroup ORDER BY t1.CreatedOn DESC";
|
||||
|
||||
$smsSendDetails = $this->db->query($querys);
|
||||
$smsSendDetailsList = $smsSendDetails->result();
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsList'] = $smsSendDetailsList;
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsList'] = $smsSendDetailsList;
|
||||
$results['smsSendDetailsListStatus'] = true;
|
||||
$results['smsSendDetailsList'] = $smsSendDetailsList;
|
||||
}
|
||||
return $results;
|
||||
}
|
||||
|
||||
|
||||
// sms send functionality with update details to T_BroadcastStatus
|
||||
public function send_msg_students($arr, $msg, $reqDetails) {
|
||||
$msg_body = $msg['content'];
|
||||
$sender = $reqDetails['localUserID'];
|
||||
$localBranch = $reqDetails['localBranchID'];
|
||||
$mesg = "$msg_body";
|
||||
// $mesg = "Status Update : check - check check.";
|
||||
// $mesg = "Check";
|
||||
@ -217,10 +197,9 @@ class Broadcast_model extends CI_Model
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$dateTime = $time;
|
||||
$msgGroup = date('YmdHis');
|
||||
|
||||
for($i=0, $c = count($arrss) ; $i< $c; $i++){
|
||||
// echo $arrss[$i];exit();
|
||||
if( $arrss[$i] === '') {
|
||||
for ($i = 0, $c = count($arrss);$i < $c;$i++) {
|
||||
// echo $arrss[$i];exit();
|
||||
if ($arrss[$i] === '') {
|
||||
break;
|
||||
} else {
|
||||
$a = explode(':', $arrss[$i]);
|
||||
@ -228,25 +207,17 @@ class Broadcast_model extends CI_Model
|
||||
$msgId = $a[1];
|
||||
$msgNumb = $a[2];
|
||||
$msgStatus = $a[4];
|
||||
$data[] = array(
|
||||
'MsgId' => $msgId,
|
||||
'MobileNumber' => $msgNumb,
|
||||
'MsgBody' => $mesg,
|
||||
'Status' => $msgStatus,
|
||||
'CreatedOn' => $dateTime,
|
||||
'CreatedBy' => $sender,
|
||||
'MsgGroup' => $msgGroup
|
||||
);
|
||||
$data[] = array('MsgId' => $msgId, 'MobileNumber' => $msgNumb, 'MsgBody' => $mesg, 'Status' => $msgStatus, 'CreatedOn' => $dateTime, 'CreatedBy' => $sender, 'MsgGroup' => $msgGroup, 'BranchCode' => $localBranch);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
$this->db->insert_batch('T_BroadcastStatus', $data);
|
||||
if ($this->db->affected_rows() >= 1) {
|
||||
$result['msgStatus'] = true;
|
||||
$result['message'] = "Successfully Messages Sended!!";
|
||||
$result['msgStatus'] = true;
|
||||
$result['message'] = "Successfully Messages Sended!!";
|
||||
} else {
|
||||
$result['msgStatus'] = false;
|
||||
$result['message'] = "error!!";
|
||||
$result['msgStatus'] = false;
|
||||
$result['message'] = "error!!";
|
||||
}
|
||||
// print_r($data);
|
||||
// exit();
|
||||
@ -254,7 +225,6 @@ class Broadcast_model extends CI_Model
|
||||
// $msgSendTime = $arrss[2];
|
||||
// $msgDeleveredNum = $arrss[3];
|
||||
// $msgSendStatus = $arrss[3];
|
||||
|
||||
// print_r($data);exit();
|
||||
return $result;
|
||||
}
|
||||
@ -270,57 +240,46 @@ class Broadcast_model extends CI_Model
|
||||
|
||||
// http://www.24x7sms.com/downloads/24X7SMS_http_API2.0.pdf
|
||||
// API Key : xegCdYUIMf3
|
||||
|
||||
// Your new password for logging into Apollo student portal is (Password). Please change the password as soon as you login.
|
||||
// This is the template to be used.
|
||||
|
||||
public function smssend($arr, $msg)
|
||||
{
|
||||
$number =array();
|
||||
foreach($arr as $ar){
|
||||
$mobi = $this->get_registered_mobile($ar['StudentID']);
|
||||
array_push($number, "91$mobi");
|
||||
public function smssend($arr, $msg) {
|
||||
$number = array();
|
||||
foreach ($arr as $ar) {
|
||||
$mobi = $this->get_registered_mobile($ar['StudentID']);
|
||||
array_push($number, "91$mobi");
|
||||
}
|
||||
$mobile = implode(',', $number);
|
||||
// $message ="Your new password for logging into Apollo student portal is SAMPLE. Please change the password as soon as you login.";
|
||||
// $mobile = "91$mobile";
|
||||
|
||||
$message = urlencode($msg);
|
||||
// echo $mobile , $message;
|
||||
$ch=curl_init();
|
||||
curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=".$mobile."&SenderID=APOLLO&Message=".$message."&ServiceName=PROMOTIONAL_HIGH");
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/SendSMS.aspx?APIKEY=xegCdYUIMf3&MobileNo=" . $mobile . "&SenderID=APOLLO&Message=" . $message . "&ServiceName=PROMOTIONAL_HIGH");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$output =curl_exec($ch);
|
||||
|
||||
// print_r($output);exit();
|
||||
$output = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
return $output;
|
||||
}
|
||||
|
||||
//get cron job call
|
||||
public function getCronUpdate() {
|
||||
$date2 = date('Y-m-d');
|
||||
|
||||
$quw = "SELECT * FROM T_BroadcastDeliveryCron ORDER BY id DESC LIMIT 1";
|
||||
$myext = $this->db->query($quw)->first_row();
|
||||
// print_r($this->db->query($quw)->first_row());exit();
|
||||
if($myext){
|
||||
if($myext->CreatedOn){
|
||||
$arrsss = explode(' ', $myext->CreatedOn);
|
||||
if ($myext) {
|
||||
if ($myext->CreatedOn) {
|
||||
$arrsss = explode(' ', $myext->CreatedOn);
|
||||
}
|
||||
$date1 = $myext->CreatedOn != '' ? $arrsss[0] : $date2;
|
||||
} else {
|
||||
$date1 = $date2;
|
||||
}
|
||||
|
||||
$ch=curl_init();
|
||||
curl_setopt($ch,CURLOPT_URL,"https://smsapi.24x7sms.com/api_2.0/GetReports.aspx?APIKEY=xegCdYUIMf3&StartDate=".$date1."&EndDate=".$date2."");
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, "https://smsapi.24x7sms.com/api_2.0/GetReports.aspx?APIKEY=xegCdYUIMf3&StartDate=" . $date1 . "&EndDate=" . $date2 . "");
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
|
||||
$output =curl_exec($ch);
|
||||
// print_r($output);exit();
|
||||
$output = curl_exec($ch);
|
||||
// print_r($output);exit();
|
||||
curl_close($ch);
|
||||
|
||||
$arrss = explode('<br>', $output);
|
||||
array_pop($arrss);
|
||||
// Array
|
||||
@ -334,9 +293,9 @@ class Broadcast_model extends CI_Model
|
||||
$time = date('Y-m-d H:i:s');
|
||||
$dateTime = $time;
|
||||
$c = count($arrss);
|
||||
for($i=0 ; $i < $c; $i++){
|
||||
// echo $arrss[$i];exit();
|
||||
if( $i == $c-1) {
|
||||
for ($i = 0;$i < $c;$i++) {
|
||||
// echo $arrss[$i];exit();
|
||||
if ($i == $c - 1) {
|
||||
break;
|
||||
} else {
|
||||
$a = explode('|', $arrss[$i]);
|
||||
@ -346,21 +305,19 @@ class Broadcast_model extends CI_Model
|
||||
$delvOn = $a[3];
|
||||
$qury1 = "SELECT * FROM T_BroadcastDeliveryCron WHERE MsgId = '$msgId'";
|
||||
$choe = $this->db->query($qury1)->first_row();
|
||||
|
||||
if($this->db->query($qury1)->first_row()){
|
||||
$qury2 = "UPDATE T_BroadcastDeliveryCron SET DeliveredStatus = '$delvStatus', DeliveredOn = '$delvOn' WHERE MsgId = '$msgId'";
|
||||
|
||||
$choe2 = $this->db->query($qury2);
|
||||
if ($this->db->query($qury1)->first_row()) {
|
||||
$qury2 = "UPDATE T_BroadcastDeliveryCron SET DeliveredStatus = '$delvStatus', DeliveredOn = '$delvOn' WHERE MsgId = '$msgId'";
|
||||
$choe2 = $this->db->query($qury2);
|
||||
// continue;
|
||||
|
||||
} else {
|
||||
$qury3 = " INSERT INTO T_BroadcastDeliveryCron (MsgId, MobileNumber, DeliveredStatus, DeliveredOn, CreatedOn) VALUES('$msgId', '$msgNumb', '$delvStatus', '$delvOn', '$dateTime')";
|
||||
|
||||
$choe3 = $this->db->query($qury3);
|
||||
$qury3 = " INSERT INTO T_BroadcastDeliveryCron (MsgId, MobileNumber, DeliveredStatus, DeliveredOn, CreatedOn) VALUES('$msgId', '$msgNumb', '$delvStatus', '$delvOn', '$dateTime')";
|
||||
$choe3 = $this->db->query($qury3);
|
||||
// continue;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return 'records updated!!';
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user