apollo_developers/api/application/controllers/Broadcast_Controller.php
venbatechnologies@gmail.com 1809bcf9c9 fixed table for student details
2018-04-23 18:34:11 +05:30

184 lines
7.1 KiB
PHP
Executable File

<?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
*
* @package CodeIgniter
* @subpackage Rest Server
* @category Controller
* @author
* @license MIT
* @link
*/
class Broadcast_Controller extends REST_Controller {
/*
* broadcast, sms send functionality
* params:
* created by kdk
* */
function __construct()
{
// Construct the parent class
parent::__construct();
$this->methods['getUniversity_post']['limit'] = 100;
$this->methods['chkUnivIdExistDetail_post']['limit'] = 100;
// 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
}
}
// 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
}
}
public function sendSMSStudentApi_post() {
$reqData = $this->post('data');
$reqDetails = $this->post('requestDetails');
$msg = $this->post('msg');
$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']
);
}
$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
}
}
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
}
}
public function getCronCall_get() {
$getMegCronDetails = $this->broadcast_model->getCronUpdate();// Check if the employee exist
// echo $getMegCronDetails;exit();
if($getMegCronDetails){
echo $getMegCronDetails;
}else {
}
// 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
// }
}
}