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


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

<?php
    function degreeData($aobj_context){
      
        $collcode = $aobj_context->mobj_data["collcode"];
     
             $query = "SELECT DISTINCT IFNULL(d.FDEGREE,'')AS `key`, IFNULL(d.FDEGREE,'')AS `value`,
                       CONCAT(IFNULL(d.FDESCPN,''),' [',IFNULL(d.fdegree,''),']')AS `label` FROM degree d 
                       INNER JOIN colldeg c ON d.fdegree = c.fdegree
                       WHERE c.fcollcode = '{$collcode}'";
      
        $result = $aobj_context->mobj_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");
            return;
        }
      
    }

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

        $query = "SELECT IFNULL(FEXAMNO,'')AS `key`,IFNULL(FEXAMNO,'')AS `value`, 
                  CONCAT(IFNULL(FEXAMNAME,''),'[',IFNULL(FEXAMNO,''),']')AS `label` 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=$aobj_context->mobj_data['collcode'];
      
        $query = "SELECT DISTINCT IFNULL(fcsubcode,'')AS `key`,
                   IFNULL(fcsubcode,'')AS `value`,
                  CONCAT(fsubname, ' [', fssubname,']') AS `label` FROM subject WHERE fdegree='{$degree}'
                  AND fexamno = '{$sem}' AND fintass = 'T'";

        $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 getSubDetMaxMarks($aobj_context){
        $collcode=$aobj_context->mobj_data['collcode'];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];

        $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;
        }
    }

    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=$aobj_context->mobj_data['collcode'];

        $query = "select s.*, sub.fsubname as fcsubname from subdet s inner join colldeg c on c.fdegree = s.fdegree
                  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}' and c.fcollcode = '{$collcode}'";

        $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 saveUpdatedSubjectDetails($aobj_context){
        $collcode = $aobj_context->mobj_data["collcode"];
        $data = $aobj_context->mobj_data["data"];
        $array = json_decode($data,true);
    
        foreach($array as $val){
 
           $querysub = "select fsubcode from subdet where 
                        fdegree='{$val['fdegree']}' and fexamno='{$val['fexamno']}' and  fcsubcode='{$val['fcsubcode']}' 
                        and fsubcode = '{$val['fsubcode']}'";
                    
           $resultsub = $aobj_context->mobj_db->GetRow($querysub); 

           $subcode = $resultsub['fsubcode'];
          

           if($subcode === $val['fsubcode']){
              $query = "update subdet set  fsubname='{$val['fsubname']}', fmaxmarks='{$val['fmaxmarks']}', 
                        fqnno='{$val['fqnno']}', fnotest='{$val['fnotest']}', fu1max='{$val['fu1max']}', 
                        fu2max='{$val['fu2max']}', forder='{$val['forder']}', ftheory='{$val['ftheory']}' where fsubcode='{$val['fsubcode']}' and 
                        fdegree = '{$val['fdegree']}' and fexamno='{$val['fexamno']}' and fcsubcode='{$val['fcsubcode']}' and fcollcode='{$collcode}'";
            }else{
              $query = "insert into subdet(fdegree, fexamno, fcsubcode, fsubname, fmaxmarks, 
                        fqnno, fnotest, fu1max, fu2max, fsubcode, fcollcode, forder, ftheory)
                        values('{$val['fdegree']}', '{$val['fexamno']}', '{$val['fcsubcode']}', '{$val['fsubname']}', '{$val['fmaxmarks']}', 
                        '{$val['fqnno']}', '{$val['fnotest']}', '{$val['fu1max']}', '{$val['fu2max']}', '{$val['fsubcode']}', 
                        '{$collcode}', '{$val['forder']}', '{$val['ftheory']}')";
            }
          
             $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 deleteSubDet($aobj_context){
        $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=$aobj_context->mobj_data['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 saveNewAddedData($aobj_context){
        $collcode = $aobj_context->mobj_data["collcode"];
        $degree = $aobj_context->mobj_data["degree"];
        $sem = $aobj_context->mobj_data["sem"];
        $sub = $aobj_context->mobj_data["sub"];
        $data = $aobj_context->mobj_data["data"];
        $array = json_decode($data,true);
    
        foreach($array as $val){
            // if($val['fsubcode'] !==""){
                $query = "insert into subdet(fdegree, fexamno, fcsubcode, fsubname, fmaxmarks, 
                         fqnno, fnotest, fu1max, fu2max, fsubcode, fcollcode, forder, ftheory)
                         values('{$degree}', '{$sem}', '{$sub}', '{$val['fsubname']}', '{$val['fmaxmarks']}', 
                         '{$val['fqnno']}', '{$val['fnotest']}', '{$val['fu1max']}', '{$val['fu2max']}', '{$val['fsubcode']}', 
                         '{$collcode}', '{$val['forder']}', '{$val['ftheory']}')";
            // }
           
           
            $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;
        }
    }
   
?>