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


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

<?php
    function cgetDegreedet($aobj_context){
        $univcode = $aobj_context->mobj_data["univcode"];
        $type = $aobj_context->mobj_data["type"];
        $collcode = $aobj_context->mobj_data["collcode"];
        $degree_code=trim($aobj_context->mobj_data["degree_range"]);
     
        if($type === 'selectedonly'){
             $query="select ifnull(B.FDEGREE, '') as FDEGREE, ifnull(B.FDESCPN,'') as FDESCPN ,A.FDELETED ,
                    IF(A.FDELETED='F','CHECKED',' ') AS CHECKED from colldeg A 
                    left join degree B on A.FDEGREE = B.FDEGREE 
                    Where A.FCOLLCODE='{$collcode}' and ifnull(B.FDEGREE,'')<>'' and A.FDELETED='F' group by A.FDEGREE ";
        }else{
            $degree_code=($degree_code=='')?"where ifnull(FDEGREE, '') <> ''":" where FDEGREE like '%{$degree_code}%'";
            $query = "select ifnull(A.FDEGREE, '')as FDEGREE, ifnull(A.FDESCPN, '')as FDESCPN, IF(B.FDELETED='F','CHECKED',' ') AS CHECKED from
                    (select ifnull(FDEGREE, '')as FDEGREE, ifnull(FDESCPN, '')as FDESCPN from degree     {$degree_code} 
                    group by FDEGREE) A	
                    LEFT JOIN colldeg B on A.FDEGREE = B.FDEGREE and B.FCOLLCODE='{$collcode}' and B.FDELETED='F'
                    and ifnull(A.FDEGREE , '')<> ''						 
                    group by A.FDEGREE ";
          
        }
        $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 csaveDegreedet($aobj_context){

        $data=json_decode($aobj_context->mobj_data["data"],true);
        $univcode = $aobj_context->mobj_data["univcode"];
        $degree = $aobj_context->mobj_data["degree"];
        $collcode = $aobj_context->mobj_data["collcode"];
        $user = $aobj_context->mobj_data["user"];
  

        foreach($data as $val){
            if($val['CHECKED'] === "CHECKED"){
                $cond = 'F';
            }else{
                $cond = 'T';
            }
            
            $check_dup = "select count(*) as count from colldeg where  
                            FCOLLCODE='{$collcode}' 
                            and FDEGREE='{$val['FDEGREE']}'";
                                   
		    $res_check_dup = $aobj_context->mobj_db->getRow($check_dup); 
          
            $dup_flag = $lobj_check_dup['count'];

            if($dup_flag === 0){
                $query = "insert into colldeg( FCOLLCODE,FDEGREE,FDELETED,FLOGNAME,FLOGDATE)values	
								   ('{$collcode}','{$val['FDEGREE']}','{$cond}','{$user}',now())";	
                                 
            }else{
                $query = "update colldeg set fdeleted='{$cond}' where fcollcode='{$collcode}' and 
                          fdegree = '{$val['FDEGREE']}'";
                         
            }

            $resupd = $aobj_context->mobj_db->Execute($query);
            

            $check_dup_collexam = "select count(*) as count from collexam where 
                                   fcollcode='{$collcode}' and fdegree='{$val['FDEGREE']}'";
                                   
            $res_check_dup_collexam = $aobj_context->mobj_db->getRow($check_dup_collexam);
            $dup_flag_collexam =  $res_check_dup_collexam['count'];

            if($dup_flag_collexam === 0){
                $query_collexam = "insert into collexam (fcollcode, fdegree, fexamno, fsuspend, fdeleted)
                                   select '{$collcode}', fdegree, fexamno, 'F', '{$cond}'
                                   from degree where fdegree='{$val['FDEGREE']}'";
                                   
            }else{
                $query_collexam = "update collexam set fdeleted='{$cond}' where fcollcode='{$collcode}' and 
                                   fdegree='{$val['FDEGREE']}'";
                                 
            }
            $resupd_colexam = $aobj_context->mobj_db->Execute($query_collexam);
        
        }  
        
        if($resupd){
            $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;
        }
       
    }
?>