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 : 18.119.132.80


Current Path : /proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/
Upload File :
Current File : //proc/thread-self/root/proc/thread-self/root/var/www/oasis/src/teachFreeze.php

<?php 
function loadteachfreeze($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    
    $cond = "";
    if($_SESSION['usrtype'] == '17'){
        $cond=" and m.fteachcode='{$_SESSION['usr']}'";
    }
    $query = "select ifnull(m.FTEACHCODE, '')as fteachcode, 
              ifnull(m.FTEACHNAME, '')as fteachname 
              from masteach m 
              inner join attclass a on a.fteachcode = m.fteachcode 
              where a.fcollcode = '{$collcode}' {$cond}
              group by m.FTEACHCODE";
    //var_dump($query);
    $result = $aobj_context->mobj_db->GetAll($query);
    if($result){
        echo($aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"));
			return $result;
    }else{
            $arr['msg'] = "No data found..!";
			echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));  
			return $arr;
    }
}

function loadclassnamefreeze($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $teach = $aobj_context->mobj_data["teach"];
    // if($collcode == '1827')
    // $teach = '20506';
    if($_SESSION['usrtype'] == '17'){
        $cond=" ac.fteachcode='{$_SESSION['usr']}'";
    }else{
        $cond = " ac.fteachcode = '{$teach}'";
    }   

    $query = "select ifnull(ac.fclassid,'')as fclassid, 
    ifnull(ac.fclassname, '')as fclassname, 					
    ifnull(at.fdegree, '')as fdegree, 
    ifnull(at.fexamno, '')as fexamno
    from attclass ac inner join attendsum at on 
    ac.fteachcode = at.fteachcode and ac.fclassid = at.fclassid 
    where {$cond} and ac.fcollcode = '{$collcode}' 
    group by ac.fclassid";
    
    $result = $aobj_context->mobj_db->GetAll($query);
    if($result){
        echo($aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"));
			return $result;
    }else{
            $arr['msg'] = "No data found..!";
			echo($aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));  
			return $arr;
    }
}

function loadsubjectfreeze($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $teach = $aobj_context->mobj_data["teach"];
    $classid = trim($aobj_context->mobj_data["classname"]);
    $split = explode(" - ",$classid);
    $classcode = $split[0];
    $degree = $split[1];
    $examno = $split[2];


    $query = "select a.fteachcode,a.fclassid,s.fcsubcode as fsubcode,
    s.FSSUBNAME as fssubname,c.fteachcode,c.fclassid, s.fexamno,s.fdegree,c.fiateachfreez 
    from attendsum a 
    inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno 
    inner join subject s on a.fdegree = s.fdegree and a.fexamno = s.fexamno 
    and left(a.fsubcode,4) = s.fsubcode 
    left join classfreez c on c.fteachcode = a.fteachcode and c.fclassid = a.fclassid
    and left(c.fsubcode,4) = left(a.fsubcode,4)
    and c.fsubcode = s.fcsubcode
    where a.fteachcode = '{$teach}'
    and ifnull(s.FINTASS,'') = 'T' and a.fclassid = '{$classcode}'
    group by s.fcsubcode";


    // var_dump($query);
    // die();

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

// function viewteachfreeze($aobj_context){
//     $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
//     $collcode = $_SESSION['collcode'];
//     $teach = $aobj_context->mobj_data["teach"];
//     $classid = trim($aobj_context->mobj_data["classname"]);
//     $split = explode(" - ",$classid);
//     $classcode = $split[0];
//     $degree = $split[1];
//     $examno = $split[2];
    

//     $query = "select s.fcsubcode as fsubcode,s.FSSUBNAME as fssubname, s.fexamno,s.fdegree 
// 	from attendsum a 
// 	inner join degree d on a.fdegree = d.fdegree and a.fexamno = d.fexamno
// 	inner join subject s on a.fdegree = s.fdegree and a.fexamno = s.fexamno and left(a.fsubcode,4) = s.fsubcode
//     left join classfreez c on c.fteachcode = a.fteachcode and c.fclassid = a.fclassid and c.fsubcode = a.fsubcode
// 	where a.fteachcode = '{$teach}'
// 	and ifnull(s.FRETAIN,'') = 'T'
// 	and ifnull(s.FINTASS,'') = 'T'
// 	and fclassid = '{$classcode}'
// 	group by s.fcsubcode";

//     // var_dump($query);
//     // die();
	

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

function saveTeacherFreeze($aobj_context){
    $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
    $collcode = $_SESSION['collcode'];
    $teachcode = trim($aobj_context->mobj_data["teach"]);
    $classid = trim($aobj_context->mobj_data["classname"]);
    $split = explode(" - ",$classid);
    $classcode = $split[0];
    $degree = $split[1];
    $examno = $split[2];
    $user_id = $_SESSION['user_id'];
    $data = $aobj_context->mobj_data["data"];
    $array = json_decode($data,true);
    $format_file= $aobj_context->main_src."/src/format.php";
	include($format_file);
    include("error_log.php");
	$clientIp ='';
	
		if (!empty($_SERVER['HTTP_X_REAL_IP'])) 
			 $_SERVER['HTTP_X_REAL_IP'];
		else if (!empty($_SERVER['HTTP_CLIENT_IP'])) 
			 $clientIp = $_SERVER['HTTP_CLIENT_IP'];
		else if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
				$clientIp = $_SERVER['HTTP_X_FORWARDED_FOR'];
		else 
			 $clientIp = $_SERVER['REMOTE_ADDR'];


             $qry = "select fclassid from classfreez
             where fteachcode = '{$teachcode}' and fclassid = '{$classcode}'";
             $resqry = $aobj_context->mobj_db->GetRow($qry);

            //  var_dump($resqry);
            //  die();


    foreach($array as $key=>$value){
        $qrey = "select fiateachfreez from classfreez
        where fclassid = '{$classcode}' and fsubcode = '{$value['subcode']}' and fteachcode = '{$teachcode}'";
        $resqrey = $aobj_context->mobj_db->GetRow($qrey);
        $prevfreeze = $resqrey['fiateachfreez'];
        if(count($resqry) == 0){
            $currfreeze = $value['teacherfreeze'];
            $subcode = $value['subcode'];
            $str = "TEACHER FREEZE: USER : $user_id, COLLCODE: $collcode, TEACHCODE : $teachcode, CLASSID : $classcode, SUBCODE : $subcode, FREEZED : $currfreeze";
            $remark = $str;
            $enttype = "TEACHFR";
            $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);

            $query = "insert into classfreez (fteachcode,fcollcode,fclassid,fsubcode,fiateachfreez,fiatfreezdate,fiateachfreezuser)
            values ('{$teachcode}','{$collcode}','{$classcode}','{$value['subcode']}','{$value['teacherfreeze']}',now(),'{$user_id}')";


            $result = $aobj_context->mobj_db->Execute($query);   
        }else{
            $currfreeze = $value['teacherfreeze'];
            $subcode = $value['subcode'];
            $str = "UPDATED TEACHER FREEZE: USER : $user_id, COLLCODE: $collcode, TEACHCODE : $teachcode, CLASSID : $classcode, SUBCODE : $subcode, PREVFREEZE : $prevfreeze, UPDFREEZE : $currfreeze";
            $remark = $str;
            $enttype = "UPDTEACHFR";
            $res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);

            $query = "update classfreez set fiateachfreez='{$value['teacherfreeze']}',
                        fiateachfreezuser='{$user_id}',fiatfreezdate =now() 
                        where fcollcode = '{$collcode}'  
                        and fteachcode = '{$teachcode}' and fclassid = '{$classcode}'
                        and fsubcode = '{$value['subcode']}'";

                        $result = $aobj_context->mobj_db->Execute($query);
        }             
    }
    if($result){
        $arr='Updated Successfully';
        echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
        return;
    }else{
        $arr='Updatation Failed';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
    }
}


?>