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


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

<?php
	function getdeggrpsubject($aobj_context){
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['db'];
    
        $query="SELECT fdeggrp as `key`, fdeggrp as `value`, concat(fdescpn, ' ', '[',fdeggrp,']') as `label` FROM tdvs_deggrp order by fdescpn";
         
        $result = $aobj_context->mobj_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"); 	
        }
	}

	function getboardTosubject($aobj_context){
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['db'];

		$qry="select *from masboard where fboardname <> '' ";
		$result = $aobj_context->mobj_db->GetAll($qry);

		
        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 getDegreesTosubject($aobj_context){
	
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['db'];
        $deggrp = $aobj_context->mobj_data['deggrp'];

        $query = "select distinct fdegree as `key`, fdegree as `value`, 
                concat(fdescpn, ' ', '[',fdegree,']') as `label` from degree 
                where ifnull(fdegree, '') <> '' order by fdescpn";

        $result = $aobj_context->mobj_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 saveSubjectCreation($aobj_context){
    
		$data = json_decode($aobj_context->mobj_data['data'], true);
		
        $qry = "select * from subject where fqpcode = '{$data['qpcode']}' 
                and fsubcode = '{$data['subcode']}' and fdegree = '{$data['degree']}'";
			
        $resQry = $aobj_context->mobj_db->GetRow($qry);
		
        if(count($resQry) > 0){
            $query = "update subject set fsubshort='{$data['subshort']}', 
                      fboard='{$data['board']}', fvalmax='{$data['valmax']}', fssubname='{$data['subname']}'
                      where fqpcode='{$data['qpcode']}'";   
				                
            $result = $aobj_context->mobj_db->Execute($query);

            // $query1 = "update tdvs_masqp set fexamno='{$data['examno']}', fsubname='{$data['subname']}', 
            //            fboard='{$data['board']}', fdeggrp='{$data['deggrp']}', fssubname='',
            //            fsmaxmarks='{$data['valmax']}'
            //            where fqpcode = '{$data['qpcode']}'";
            // $result1 = $aobj_context->mobj_db->Execute($query1);

        }else{

            $qry = "select fsubcode from subject where fqpcode = '{$data['qpcode']}' 
                and fsubcode = '{$data['subcode']}' and fdegree = '{$data['degree']}'";
			
            $res = $aobj_context->mobj_db->GetRow($qry);

            if(count($res) > 0){
                $arr['msg'] = 'Subject code already created for this degree and qpcode';
                echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
                return;	
            }

            $query = "insert into subject(fdegree, fexamno, fsubcode, fsubname, fsubshort, fqpcode, fboard, fvalmax, fssubname)
                    values('{$data['degree']}', '{$data['examno']}', '{$data['subcode']}', '{$data['subname']}', '{$data['subshort']}', 
					'{$data['qpcode']}', '{$data['board']}', '{$data['valmax']}', '')";
				 
            $result = $aobj_context->pobj_db->Execute($query);

            // $query1 = "insert into tdvs_masqp(fexamno, fsubname, fqpcode, fboard, fdeggrp, fssubname,fsmaxmarks)
            //         values('{$data['examno']}', '{$data['subname']}', '{$data['qpcode']}', '{$data['board']}', '{$data['deggrp']}', 
			// 		'{$data['subshort']}','{$data['valmax']}')";
            // $result1 = $aobj_context->mobj_db->Execute($query1);
        }

	
        if($result){
            $arr['msg'] = "Saved 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;	
        }
    }

	function getSubjectDetails($aobj_context){
  
        $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['db'];
    
        // $query = "select ifnull(m.fdeggrp, '')as fdeggrp, ifnull(s.fboard, '')as fboard, 
        //         ifnull(s.fdegree, '')as fdegree, ifnull(s.fexamno, '')as fexamno, 
        //         ifnull(s.fsubcode, '')as fsubcode, ifnull(s.fsubname, '')as fsubname,
        //         ifnull(s.fsubshort, '')as fsubshort, ifnull(s.fqpcode, '')as fqpcode, 
        //         ifnull(s.fvalmax, '')as fvalmax
        //         from subject s inner join tdvs_masqp m on
        //         m.fqpcode = s.fqpcode 
        //         group by fsubcode, fexamno, fdegree
        //         order by fexamno desc";
				$query = "SELECT ifnull(s.fboard, '')as fboard,ifnull(s.fdegree, '')as fdegree,ifnull(s.fexamno, '')as fexamno,
							ifnull(s.fsubcode, '')as fsubcode,ifnull(s.fsubname, '')as fsubname,ifnull(s.fsubshort, '')as fsubshort,
							ifnull(s.fqpcode, '')as fqpcode,ifnull(s.fvalmax, '')as fvalmax,ifnull(d.fdeggrp, '')as fdeggrp
							FROM subject s INNER JOIN degree d ON s.fdegree=d.fdegree AND s.fexamno=d.fexamno
							where fqpcode <> ''
							group by fsubcode, fexamno, fdegree
							order by fexamno desc";
			
        $result = $aobj_context->mobj_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 deleteSubjectData($aobj_context){
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
        $univcode = $aobj_context->mobj_data['db'];
        // $data = json_decode($aobj_context->mobj_data['data'], true);
		$exam=$aobj_context->mobj_data['examno'];
		$qpcode=$aobj_context->mobj_data['qpcode'];
		$board=$aobj_context->mobj_data['board'];
		$deggrp=$aobj_context->mobj_data['deggrp'];
		$subcode=$aobj_context->mobj_data['subcode'];
		$degree=$aobj_context->mobj_data['degree'];
    
        $query = "delete from tdvs_masqp where fexamno='{$exam}' 
                  and fqpcode='{$qpcode}' and fboard='{$board}'   
                  and fdeggrp='{$deggrp}'";
        $result = $aobj_context->mobj_db->Execute($query);

        $query1 = "delete from subject where 
                  fexamno='{$exam}' 
                  and fqpcode='{$qpcode}' 
                  and fsubcode='{$subcode}'
                  and fdegree='{$degree}'";
				
        $result1 = $aobj_context->mobj_db->Execute($query1);
		

        if($result1){
             $arr['msg'] = 'Deleted 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;	
        }
	}

	function updateSubjectCreationData($aobj_context){
		$qpcode=$aobj_context->mobj_data['qpcode'];
      	$examno=$aobj_context->mobj_data['examno'];
		$degree=$aobj_context->mobj_data['degree'];

		$query = "SELECT s.fboard,s.fdegree,s.fexamno,s.fsubcode,s.fsubname,s.fsubshort,s.fqpcode,s.fvalmax,d.fdeggrp
		          FROM subject s INNER JOIN degree d ON s.fdegree=d.fdegree AND s.fexamno=d.fexamno 
                  WHERE s.fdegree = '{$degree}' AND s.fexamno='{$examno}' AND fqpcode='{$qpcode}'";
		$res=$aobj_context->mobj_db->GetRow($query);
	
		if($res){
			// $arr['qpcode']=$res;
			// $arr['degree']=$result;
		   echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success"); 
		   return;	
	   }else{
		   $arr['msg'] = 'Something went wrong try again later';
		   echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
		   return;	
	   }
	}
	?>