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


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/setExamTimetable.php

<?php

function getExamTimetable($aobj_context)
{

    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data["univcode"];
    $deggrp = $aobj_context->mobj_data["deggrp"];
    $examrange = $aobj_context->mobj_data["examrange"];
    
    $exam = str_split($examrange);    

    $examrange = implode("','",$exam);
    

    $query = "SELECT fdbname, ffolder FROM dbname WHERE funivcode = $univcode";
    $result = $aobj_context->mobj_db->GetRow($query);
    $db = $result['fdbname'];
    $folder = $result['ffolder'];

    $query =  "select s.fqpcode, s.fsubname, group_concat(distinct s.fdegree SEPARATOR ', ')  as fdegree,
    ifnull(t.fdatecode,'') as fdatecode, ifnull(t.ftimecode,'') as ftimecode,
    ifnull(date_format(ifnull(md.fdate, ''),'%d/%m/%Y'),'') as fdate, 
    ifnull(mt.ftime,'') as ftime,
    ifnull(t.fdeleted,'F') as fdeleted  
    from  {$db}.subject s inner join {$db}.degree d on s.fdegree = d.fdegree and s.fexamno = d.fexamno 
    left join {$db}.examtt t on s.fqpcode = t.fqpcode and d.fdeggrp = t.fdeggrp
    left join {$db}.masdate md on t.fdatecode = md.fdatecode 
    left join {$db}.mastime mt on t.ftimecode = mt.ftimecode
    where d.fdeggrp = '{$deggrp}' and s.fexamno in('{$examrange}')
    and s.`FTHEORY` = 'T' and s.fintass <> 'T' and ifnull(s.fqpcode,'') <>''
    group by s.fqpcode";

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

    $query = "select * from {$db}.mastime where ifnull(fdeleted,'') <> 'T'";
    $result2 = $aobj_context->mobj_db->GetAll($query);

    $query = "select fdatecode, date_format(fdate,'%d/%m/%Y') as  fdate from {$db}.masdate where ifnull(fdeleted,'') <> 'T'";
    $result3 = $aobj_context->mobj_db->GetAll($query);

    //var_dump($result);
    if($result1)
	{
        $arr['qpdet'] =  $result1;
        $arr['mastime'] =  $result2;
        $arr['masdate'] =  $result3;

		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	}
	else
	{
		$arr['msg'] = 'Could not get QP List';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 	
	}	
}

function saveExamTimetable($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data["univcode"];
    $deggrp = $aobj_context->mobj_data["deggrp"];
    

    $query = "SELECT fdbname, ffolder FROM dbname WHERE funivcode = $univcode";
    $result = $aobj_context->mobj_db->GetRow($query);
    $db = $result['fdbname'];
    
    if(isset($_POST["setExamTT"]))
    {
        $json = json_decode($_POST["setExamTT"],true);
       
        $query = "SELECT distinct fmeyear,fmeexamtyp FROM {$db}.degree WHERE ifnull(fdeggrp,'') = '{$deggrp}'";
        $result = $aobj_context->mobj_db->GetRow($query);
        $fmeyear = $result['fmeyear'];
        $fmeexamtyp = $result['fmeexamtyp'];

        $values = '';

        foreach($json as $item)
        {
            $qpcode = $item['qpcode'];
            $dcode = $item['dcode'];
            $tcode = $item['tcode'];
            $deleted = $item['deleted'];

            $values .= "( '{$deggrp}','{$qpcode}','{$dcode}','{$tcode}','{$fmeyear}','{$fmeexamtyp}','{$deleted}'),";


        }

        $values = rtrim($values, ','); 
        $query = "insert into {$db}.examtt(fdeggrp,fqpcode,fdatecode,ftimecode,fyear,fexamtype,fdeleted)
                values ".$values."
                on duplicate key update
                fqpcode = VALUES(fqpcode),
                fdatecode = VALUES(fdatecode),
                ftimecode = VALUES(ftimecode),
                fdeleted = VALUES(fdeleted)";
        $results = $aobj_context->mobj_db->Execute($query);

        $query = "update {$db}.subject s, {$db}.examtt t, {$db}.masdate d set s.fdoe = d.fdate, s.fsession = t.ftimecode 
        where s.fqpcode = t.fqpcode and t.fdatecode = d.fdatecode";
        $results1 = $aobj_context->mobj_db->Execute($query);
    }
    if($results)
    {
        $data = "Uploaded Successfully.";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
        return;	
    }
    else
    {
        $data = "Error while updating";
        echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"error"); 
        return;
    }
	
}
function getdegrefdet($aobj_context)
{
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
    $univcode = $aobj_context->mobj_data["univcode"];

    $query = "SELECT fdbname, ffolder FROM dbname WHERE funivcode = $univcode";
    $result = $aobj_context->mobj_db->GetRow($query);
    $db = $result['fdbname'];

    $query = "select fdeggrp as code, concat(fdeggrp,' - ',fdescpn) as value 
        from {$db}.deggrp where ifnull(fdeleted,'F') <> 'T'";
    $result = $aobj_context->mobj_db->GetAll($query);
    $arr['deggrp'] =$result;

    $query = "select distinct concat(fyear,'-',fexamtype) as code, concat(fyear,' - ',fexamtype) as value 
        from {$db}.examtt where ifnull(fdeleted,'F') <> 'T'";
    $result = $aobj_context->mobj_db->GetAll($query);
    $arr['reftype'] =$result;

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


}

?>