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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/subdet.php

<?php
    function getDegreeSubDetails($aobj_context){
        session_start();
	    $collcode=$_SESSION['collcode'];

        $query = "select d.FDEGREE, d.FDESCPN from degree d 
                  inner join colldeg c on d.fdegree = c.fdegree
                  where c.fcollcode = '{$collcode}'
                  and d.fexamno = 'A'";
        $result = $aobj_context->mobj_db->GetAll($query); 
        
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        }else{
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
        }
    }

    function getSemSubDetails($aobj_context){
        session_start();
        $degree = $aobj_context->mobj_data["degree"];
	    $collcode=$_SESSION['collcode'];

        $query = "select FEXAMNO, FEXAMNAME from degree d 
                  inner join colldeg c on d.fdegree = c.fdegree
                  where c.fcollcode = '{$collcode}' and d.FDEGREE = '{$degree}'";

        $result = $aobj_context->mobj_db->GetAll($query); 
        
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        }else{
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
        }
    }

    function getSubSubDetails($aobj_context){
        session_start();
	    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
	    $collcode=$_SESSION['collcode'];
        // var_dump($sem,$degree,"vikkkkkki" );
        // die();
        $query = "select distinct fcsubcode, concat(fsubname, ' - ', fssubname) as fsubname from subject where fdegree='{$degree}'
                  and fexamno = '{$sem}' and fintass = 'T'";

                //   var_dump($query);
                //   die();
        $result = $aobj_context->mobj_db->GetAll($query); 
        
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        }else{
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
        }
    }

    function saveSubDetData($aobj_context){
        session_start();
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];
	    $collcode=$_SESSION['collcode'];
        $element = $aobj_context->mobj_data["element"];
        $subname = $aobj_context->mobj_data["subname"];
        $maxmarks = $aobj_context->mobj_data["maxmarks"];
        $qnno = $aobj_context->mobj_data["qnno"];
        $notest = $aobj_context->mobj_data["notest"];
        $u1max = $aobj_context->mobj_data["u1max"];
        $u2max = $aobj_context->mobj_data["u2max"];
        $order = $aobj_context->mobj_data["order"];
        $theory = $aobj_context->mobj_data["theory"];

        $querysub = "select fsubcode from subdet where 
                  fdegree='{$degree}' and fexamno='{$sem}' and  fcsubcode='{$sub}' 
                  and fsubcode = '{$element}'";
                  
        $resultsub = $aobj_context->mobj_db->GetRow($querysub); 
        $subcode = $resultsub['fsubcode'];

        if($subcode === $element){
            $query = "update subdet set  fsubname='{$subname}', fmaxmarks='{$maxmarks}', 
                      fqnno='{$qnno}', fnotest='{$notest}', fu1max='{$u1max}', 
                      fu2max='{$u2max}', forder='{$order}', ftheory='{$theory}' where fsubcode='{$element}' and 
                      fdegree = '{$degree}' and fexamno='{$sem}' and fcsubcode='{$sub}' and fcollcode='{$collcode}'";
        }else{
            $query = "insert into subdet(fdegree, fexamno, fcsubcode, fsubname, fmaxmarks, 
                      fqnno, fnotest, fu1max, fu2max, fsubcode, fcollcode, forder, ftheory)
                      values('{$degree}', '{$sem}', '{$sub}', '{$subname}', '{$maxmarks}', 
                      '{$qnno}', '{$notest}', '{$u1max}', '{$u2max}', '{$element}', 
                      '{$collcode}', '{$order}', '{$theory}')";
        }
        // var_dump($query,$subcode === $element);die();
        $result = $aobj_context->mobj_db->Execute($query); 
        if($result){
            $arr['msg'] = "Data Saved Successfully";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
            return;
        }else{
            $arr['msg'] = "Something Went Wrong";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
            return;
        }
    }

    function getSubDetData($aobj_context){
        session_start();
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];
	    $collcode=$_SESSION['collcode'];

        $query = "select s.*, sub.fsubname as fcsubname from subdet s
                  inner join subject sub on s.fdegree = sub.fdegree 
                  and s.fexamno = sub.fexamno and s.fcsubcode = sub.fcsubcode
                  where s.fdegree = '{$degree}' and s.fexamno = '{$sem}' 
                  and s.fcsubcode = '{$sub}'";

        $result = $aobj_context->mobj_db->GetAll($query); 
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
            return;
        }else{
            $arr['msg'] = 'No data Found';
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
            return;
        }
    }

    function deleteSubDet($aobj_context){
        session_start();
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];
        $subcode = $aobj_context->mobj_data["element"];
	    $collcode=$_SESSION['collcode'];

        $query = "delete from subdet where 
                  fsubcode='{$subcode}' and fdegree = '{$degree}' and 
                  fexamno='{$sem}' and fcsubcode='{$sub}' and fcollcode = '{$collcode}'";

        $result = $aobj_context->mobj_db->Execute($query); 
        if($result){
            $arr['msg'] = "Deleted Successfully!!";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
            return;
        }else{
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
            return;
        }
    }

    function getElementsubDet($aobj_context){
        session_start();
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];
        $subcode = $aobj_context->mobj_data["element"];
	    $collcode=$_SESSION['collcode'];

        $query = "select fsubcode from subdet where 
                  fdegree='{$degree}' and fexamno='{$sem}' and  fcsubcode='{$sub}' 
                  and fsubcode = '{$subcode}' and fcollcode='{$collcode}'";

        $result = $aobj_context->mobj_db->GetRow($query); 
        if($result){
            $arr['msg'] = "Element Already present against Subject";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
            return;
        }else{
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,-1,"failure");
            return;
        }
    }

    function saveIASubDetData($aobj_context){
        session_start();
        $collcode=$_SESSION['collcode'];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["subject"];
        $tdata = json_decode($aobj_context->mobj_data["tdata"], true);
// var_dump($tdata);die();
        foreach($tdata as $key=>$value){
            $ins = "insert into subdet(fdegree, fexamno, fcsubcode, fsubname, fmaxmarks, 
                    fqnno, fnotest, fu1max, fu2max, fsubcode, fcollcode, ftheory, forder)
                    values('{$degree}', '{$sem}', '{$sub}', '{$value['subname']}', 
                    '{$value['maxmarks']}', '{$value['qnno']}', '{$value['notest']}', 
                    '{$value['u1max']}', '{$value['u2max']}', '{$value['element']}', 
                    '{$collcode}', '{$value['theory']}', '{$value['order']}')
                    on duplicate key update fsubname = '{$value['subname']}', 
                    fmaxmarks = '{$value['maxmarks']}', fqnno = '{$value['qnno']}', 
                    fnotest = '{$value['notest']}', fu1max = '{$value['u1max']}', 
                    fu2max = '{$value['u2max']}', ftheory = '{$value['theory']}', 
                    forder='{$value['order']}'";
                    // var_dump($ins);
            $result = $aobj_context->mobj_db->Execute($ins);
        }
        // die();
        if($result){
            $arr['msg'] = "Data Saved Successfully";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
            return;
        }else{
            $arr['msg'] = "Something Went Wrong";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
            return;
        }
    }

    function getSubDetMaxMarks($aobj_context){
        $collcode=$_SESSION['collcode'];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["subject"];

        $query="select fvalmax from subject where fdegree='{$degree}' and fexamno='{$sem}' and fcsubcode = '{$sub}';";
        $result = $aobj_context->mobj_db->GetRow($query);
        if($result){
            echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
        }else{
            $arr['msg'] = "Maximum marks not found for this subject";
            echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
            return;
        }
    }

?>