Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.145.152.49
<?php
function pushNotificationData($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$req = $aobj_context->req_body;
$univcode = $aobj_context->mobj_data['univcode'];
$commondb ="logisys3_comexam";
$data = $req['data'];
$fcollfrom = $data['fcollfrom'];
$fdegfrom = $data['fdegfrom'];
$deggrp = $data['deggrp'];
foreach($fcollfrom as $key => $val){
$colfrm .= "'".$val."',";
}
$collfr = substr_replace($colfrm ,"",-1);
foreach($fdegfrom as $key => $val){
$degfrm .= "'".$val."',";
}
$dgfr = substr_replace($degfrm ,"",-1);
foreach($deggrp as $key => $val){
$dggp.= "'".$val."',";
}
$degreegrp = substr_replace($dggp ,"",-1);
if (!array_key_exists('fsendto', $data) || !array_key_exists('fevent', $data)
|| !array_key_exists('fmsg', $data) || !array_key_exists('deggrp', $data)
|| !array_key_exists('fcollfrom', $data)|| !array_key_exists('fdegfrom', $data))
{
$arr['msg'] = 'Invalid Params';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
return;
}
$deggrp = implode("','", $data['deggrp']);
$fcollfrom = implode("','", $data['fcollfrom']);
$deggrp = implode("','", $data['fdegfrom']);
$result = false;
if($data['fsendto'] == 'ST') {
switch($data['fevent']) {
case 'gen':
$fmsg = $data['fmsg'];
$fcollfrom = $data['fcollfrom'];
$fcollto = $data['fcollto'];
$fregfrom = $data['fregfrom'];
$fregto = $data['fregto'];
$fdegfrom = $data['fdegfrom'];
$fdegto = $data['fdegto'];
$ftitle = $data['ftitle'];
$fstudtype = $data['fstudtype'];
$fyear = $data['fyear'];
$fmode = $data['fmode'];
$fmodule = $data['fmodule'];
$timestamp = date("Ymdhis");
$entype = "ST".$timestamp;
if($fmodule === 'examapp'){
if($fstudtype == 'feepaid'){
$cnd1 = "inner join candsum cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and ifnull(cd.frecptdate,'') <> '' and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}else if($fstudtype == 'feepending'){
$cnd1 = "inner join candsum cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and ifnull(cd.frecptdate,'') = '' and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}else if($fstudtype == 'All'){
$cnd1 = "inner join candsum cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}
}else if($fmodule === 'student'){
$cnd1 = "inner join student cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno ";
}else if($fmodule === 'result'){
if($fstudtype === 'feepaid'){
$cnd1 = "inner join res_fee cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and ifnull(cd.fackdate,'') <> '' and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}else if($fstudtype === 'feepending'){
$cnd1 = "inner join res_fee cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and ifnull(cd.fackdate,'') = '' and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}else if($fstudtype === 'All'){
$cnd1 = "inner join res_fee cd on m.funivcode = '{$univcode}' and m.fregno = cd.fregno and FYEAR = '{$fyear}' and FEXAMTYPE = '{$fmode}'";
}
}
if($collfr == "'All'"){
$cndcoll = "";
}else{
$cndcoll="and fcollcode in ({$collfr})";
}
if($dgfr == "'All'"){
$cnddeg = "";
}else{
$cnddeg = " and fdegree in ({$dgfr}) ";
}
$query ="INSERT IGNORE INTO {$commondb}.pushnotif(funivcode, fregno, fdegree, fcollcode, fmobileno,
fenttype, fsubcode, ftitle, fmobappid, fbody, fstatus, fdeleted, fyear, fexamtype,fpushdate, fmsgtype)
SELECT DISTINCT '{$univcode}', m.fregno, cd.fdegree, cd.fcollcode, m.fmobileno, '{$entype}', '{$entype}',
'{$ftitle}', m.fappmobid, CONCAT('{$data['fmsg']}') AS fbody,
'F', 'F', YEAR(NOW()), '2', NOW(), 'G'
FROM {$commondb}.masuser m
$cnd1
and cd.fregno between '{$fregfrom}' and '{$fregto}'
$cndcoll
$cnddeg
and fdegree in (select distinct fdegree from degree where fdeggrp in ({$degreegrp}))";
//var_dump($query);die();
$result = $aobj_context->pobj_db->Execute($query);
$data['fevent'] = $entype;
break;
case "ht":
$fmsg = $data['fmsg'];
$fcollfrom = $data['fcollfrom'];
$fcollto = $data['fcollto'];
$fregfrom = $data['fregfrom'];
$fregto = $data['fregto'];
$fdegfrom = $data['fdegfrom'];
$fdegto = $data['fdegto'];
$ftitle = $data['ftitle'];
$timestamp = date("Ymdhis");
$entype = "HT".$timestamp;
if($collfr == "'All'"){
$cnd = "";
}else{
$cnd="and x.fcollcode in ({$collfr})";
}
if($dgfr == "'All'"){
$cnd1 = "";
}else{
$cnd1 = " and x.fdegree in ({$dgfr}) ";
}
$query = "INSERT INTO logisys3_comexam.pushnotif (funivcode, fcollcode, fregno, fdegree, fenttype, fsubcode,
ftitle, fbody, fstatus, fpushdate, fyear, fexamtype, fmobileno, fmobappid, fmsgtype)
select distinct '{$univcode}', x.fcollcode, x.fregno, x.fdegree, '{$entype}', '{$entype}',
'{$ftitle}', '{$data['fmsg']}' as fmessage, 'F', now(), x.fyear, x.fexamtype, m.fmobileno, m.fappmobid, 'G'
from candsum x inner join collexam y on x.fdegree = y.fdegree and x.fcollcode = y.fcollcode
inner join student z on x.fdegree = z.fdegree and x.fregno = z.fregno
inner join {$commondb}.masuser m on x.fregno = m.fregno and m.funivcode = '{$univcode}'
inner join degree w on x.fdegree = w.fdegree and x.fexamno = w.fexamno
where ifnull(x.frecptdate,'') <> '' and date_format(now(),'%Y-%m-%d') between y.fhtfrom and y.fhtto
and ifnull(z.fexamappblk,'') <> 'T' and w.fdeggrp in ({$degreegrp}) and ifnull(z.fmp,'') <> 'T'
and x.fregno between '{$fregfrom}' and '{$fregto}'
$cnd
$cnd1";
// var_dump($query);die();
$result = $aobj_context->pobj_db->Execute($query);
$data['fevent'] = $entype;
break;
default:
break;
}
}
else if($data['fsendto'] == 'CL') {
$query = "select funivcode, funivname, fdbname, fstaffmobileno, fgenmsgno
from {$commondb}.dbname
where funivcode = '{$univcode}'";
$comexamRes = $aobj_context->mobj_db->GetRow($query);
$db = $comexamRes['fdbname'];
$funivname = $comexamRes['funivname'];
$stafmobile = $comexamRes['fstaffmobileno'];
$msgno = $comexamRes['fgenmsgno'];
$timestamp = date("dmY");
$entype = "CM".$msgno.$timestamp;
$message = "[{$msgno}]".$data['fmsg'];
}
else if($data['fsendto'] == 'CT') {
$query = "select funivcode, funivname, fdbname, fstaffmobileno, fgenmsgno
from logisys3_comexam.dbname
where funivcode = '{$univcode}'";
$comexamRes = $aobj_context->mobj_db->GetRow($query);
$db = $comexamRes['fdbname'];
$funivname = $comexamRes['funivname'];
$stafmobile = $comexamRes['fstaffmobileno'];
$msgno = $comexamRes['fgenmsgno'];
$timestamp = date("dmY");
$entype = "CM".$msgno.$timestamp;
$message = "[{$msgno}]".$data['fmsg'];
} else if($data['fsendto'] == 'TH') {
$query = "select funivcode, funivname, fdbname, fstaffmobileno, fgenmsgno
from logisys3_comexam.dbname
where funivcode = '{$univcode}'";
$comexamRes = $aobj_context->mobj_db->GetRow($query);
$db = $comexamRes['fdbname'];
$funivname = $comexamRes['funivname'];
$stafmobile = $comexamRes['fstaffmobileno'];
$msgno = $comexamRes['fgenmsgno'];
$timestamp = date("dmY");
$entype = "TH".$msgno.$timestamp;
$message = "[{$msgno}]".$req['fmsg'];
}
if($result)
{
$rows = $aobj_context->pobj_db->affected_rows();
$arr['msg'] = "{$rows} Records Inserted. Press send button.";
$arr['event'] = $req['fevent'];
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr['msg'] = 'DATA Push Failed';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
function getColleges($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$req = $aobj_context->req_body;
$deggrp = $req['data'];
foreach($deggrp as $key => $value){
$deg .= "'".$value."',";
}
$degarr = substr_replace($deg ,"",-1);
$query = "select distinct c.fcollcode, concat(c.fcollname,' - ' ,c.ftown) as fcollname, dg.fdeggrp from college c
inner join student s on s.fcollcode = c.fcollcode
inner join degree d on d.fdegree = s.fdegree
inner join deggrp dg on d.fdeggrp = dg.fdeggrp
where ifnull(c.fdeleted,'') <> 'T' and dg.fdeggrp in({$degarr}) order by fcollcode";
$result=$aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}
else{
$arr['msg']="Please try later";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
}
function getDegreesdetails($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$req = $aobj_context->req_body;
$col = $req['data'];
foreach($col as $key => $value){
$college .= "'".$value."',";
}
$collegeDeg = substr_replace($college ,"",-1);
$query = "select distinct d.fdegree, d.fdescpn from degree d
inner join student s on d.fdegree = s.fdegree
inner join college c on c.fcollcode = s.fcollcode
where c.fcollcode in({$collegeDeg}) order by c.fcollcode";
$result=$aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}
}
function getDegreesAsperDeggrp($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$deggrp = $aobj_context->mobj_data["deggrp"];
$query = "select distinct ifnull(d.FDEGREE,'') as fdegree,ifnull(d.FDESCPN,'') as fdescpn
from degree d
inner join deggrp dg on d.fdeggrp = dg.fdeggrp
inner join subject s on s.FDEGREE = d.fdegree and s.fexamno = d.fexamno
where dg.fdeggrp = '{$deggrp}'";
// var_dump($query);
// die();
$result=$aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}else{
$arr['msg']="Something Wrong";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
}
function getDegfromDeggrp($aobj_context){
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$univcode = $aobj_context->mobj_data['univcode'];
$req = $aobj_context->req_body;
$deg = $req['data'];
foreach($deg as $key => $value){
$deggrp .= "'".$value."',";
}
$degg = substr_replace($deggrp ,"",-1);
$query = "select distinct ifnull(d.FDEGREE,'') as fdegree,ifnull(d.FDESCPN,'') as fdescpn
from degree d
inner join deggrp dg on d.fdeggrp = dg.fdeggrp
inner join subject s on s.FDEGREE = d.fdegree and s.fexamno = d.fexamno
inner join candsum cs on s.fdegree = cs.fdegree
where dg.fdeggrp in ({$degg})";
$result=$aobj_context->pobj_db->GetAll($query);
if($result){
echo $aobj_context->mobj_output->TOJSONEnvelope($result,0,"success");
}else{
$arr['msg']="Something Wrong";
echo $aobj_context->mobj_output->TOJSONEnvelope($arr,-1,"failed");
}
}
?>
|