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


Current Path : /var/www/html/collportal/custom_src/
Upload File :
Current File : //var/www/html/collportal/custom_src/acceptqp.php

<?php
    function getQPDetails($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $teachcode = $aobj_context->mobj_data["teachcode"];
        $status = $aobj_context->mobj_data["type"];

        if($status == "Pending"){
            $cnd = "and ifnull(qp.fstatus, '')=''";
        }else if($status == "Accepted"){
            $cnd = "and ifnull(qp.fstatus, '')='ACCEPTED'";
        }else if($status == "Rejected"){
            $cnd = "and ifnull(qp.fstatus, '')='REJECTED'";
        }
        
        $query = "select qp.fqpcode, concat(s.fsubname, ' - ', s.fsubshort)as fsubname, 
                s.fvalmax, qp.fset, qp.fyear, qp.fexamtype, qp.ftype,
                s.FQPPATREN, s.FQPSYLLABUS, s.fschpattern, ifnull(qp.fstatus, '')as fstatus,
                ffrommdate,DATE_FORMAT(flastdate, '%d/%m/%Y')as flastdate,
                'F' AS flastdate_status
                from qpseterdet qp 
                inner join qpseter qs on qp.fqpcode = qs.fqpcode 
                and qp.ftype = qp.ftype and qp.fyear = qs.fyear
                and qp.fexamtype = qs.fexamtype
                inner join subject s on qp.fqpcode = s.fqpcode and qs.fqpcode = s.fqpcode
                inner join degree dg on s.fdegree = dg.fdegree and dg.fexamno = s.fexamno
                where qp.fteachcode = '{$teachcode}' {$cnd}
                group by qp.fyear, qp.fexamtype, fqpcode, fset, qp.fteachcode, qp.ftype";
        
        // "select qp.fqpcode, concat(s.fsubname, ' - ', s.fsubshort)as fsubname, 
        //           s.fvalmax, qp.fset, qp.fyear, qp.fexamtype, qp.ftype,
        //           s.FQPPATREN, s.FQPSYLLABUS, s.fschpattern, ifnull(qp.fstatus, '')as fstatus
        //           from qpseterdet qp inner join subject s on qp.fqpcode = s.fqpcode 
        //           inner join degree dg on s.fdegree = dg.fdegree and dg.fexamno = s.fexamno
        //           where fteachcode = '{$teachcode}' {$cnd}
        //           group by qp.fyear, qp.fexamtype, fqpcode, fset, fteachcode, qp.ftype";
    
        $result = $aobj_context->mobj_db->GetAll($query);
       
        if(count($result) > 0){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result, 0, "success"); 
        } else {
            $arr['msg'] = 'No data Found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
        }
    }

    function acceptQPRequest($aobj_context){
        include("error_log.php");
        $data = json_decode($aobj_context->mobj_data["data"], true);
        $status = $aobj_context->mobj_data["status"];
        $teachcode = $aobj_context->mobj_data["userid"];
        $collcode = $aobj_context->mobj_data["collcode"];
        $mobile = $aobj_context->mobj_data["mobile"];
    

        $query0 = "select ifnull(faccno, '')as faccno, ifnull(fifsccode,'')as fifsccode, 
                   ifnull(fbankname, '')as fbankname, fpanno from masteach 
                   where fteachcode = '{$teachcode}'";
    
        $result0 = $aobj_context->mobj_db->GetRow($query0);

        
        if($result0['faccno'] == '' || $result0['fifsccode'] == '' || $result0['fbankname'] == ''){
            $arr['msg'] = 'Please update your bank details';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -2, "failure");
            return;
        }

        $query1 = "update qpseter set fstatus = 'T'
                   where fteachcode = '{$teachcode}' 
                   and fqpcode = '{$data['fqpcode']}' and ftype='{$data['ftype']}'";
        $result1 = $aobj_context->mobj_db->Execute($query1);

        $query = "update qpseterdet set fstatus = '{$status}'
                  where fteachcode = '{$teachcode}' and fqpcode = '{$data['fqpcode']}'
                  and fset = '{$data['fset']}' and ftype='{$data['ftype']}'";
                    
        $result = $aobj_context->mobj_db->Execute($query);

        // $remarks = "Teacher ". $teachcode . " is ". $accept . " against QPCODE ". $fqpcode;
        // $res = error_logs($aobj_context, $univcode, $remarks, $collcode, "Upload QP Pattern and Syllabus Pattern", $teachcode, $mobile);   

        if($result && $result1){
            $arr['msg'] = 'Updated Successfully';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, 0, "success"); 
        }else{
            $arr['msg'] = 'Failed to update';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
            return;
        }

        
        
    }

?>