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


Current Path : /var/www/html/bnu/src/
Upload File :
Current File : /var/www/html/bnu/src/getMessages.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();

   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</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</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);
        if(count($results) > 0)
        {
            $cntr = $results['fthcntr'];
            $flag = 'T';
            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}'";
                    $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); 
}

?>