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


Current Path : /var/www/oasis/Report_details/
Upload File :
Current File : /var/www/oasis/Report_details/getDegreeAndSem.php

<?php

function getSubjectDetails($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$teachcode = $_SESSION['usr'];
	$degree_ = $aobj_context->mobj_data["degree"];
	$sem_ = $aobj_context->mobj_data["sem"];
	$deg = explode(' - ', $degree_);
	$degree = $deg[0];
	$seme = explode(' - ', $sem_);
	$sem = $seme[0];

	$query = "select * from attendsum where fteachcode = '{$teachcode}'";
	
	$result = $aobj_context->mobj_db->GetRow($query);
	
	$teacode = $result['fteachcode'];
	
	if(strtoupper($teachcode) ==strtoupper($teacode)){
		$qur = "SELECT left(s.fcsubcode,4)as fcsubcode, s.fsubname FROM subject s 
		INNER JOIN attendsum a ON s.fdegree = a.fdegree AND s.fexamno = a.fexamno
		and s.fcsubcode = a.fsubcode
		WHERE a.fteachcode = '{$teachcode}' AND a.fdegree = '{$degree}'
		GROUP BY a.fsubcode
		order by s.fsubname";
		
	}else{
		$qur = "SELECT left(s.fcsubcode,4)as fcsubcode, s.fsubname FROM subject s 
		INNER JOIN attendsum a ON s.fdegree = a.fdegree AND s.fexamno = a.fexamno 
		and s.fcsubcode = a.fsubcode
		AND a.fdegree = '{$degree}'
		GROUP BY s.fsubcode";
	}

	//  var_dump($qur);
	// 	 die();
	
	
	$result_sub = $aobj_context->mobj_db->GetAll($qur);  
    
    if($result_sub){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sub,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	} 
}

function getSemisterDetails($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$degree_ = $aobj_context->mobj_data["degree"];
	var_dump($degree_);
	die();
	$deg = explode(' - ', $degree_);
	$degree = $deg[0];

	$query = "SELECT fexamname, fexamno FROM degree WHERE fdegree = '{$degree}' GROUP BY fexamno";
	
	$result_sem = $aobj_context->mobj_db->GetAll($query);  

    if($result_sem){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sem,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}  

}

function getSectionDetails($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$degree_ = $aobj_context->mobj_data["degree"];
	$teachcode = $_SESSION['usr'];
	$sem_ = $aobj_context->mobj_data["sem"];
	$deg = explode(' - ', $degree_);
	$degree = $deg[0];
	$seme = explode(' - ', $sem_);
	$sem = $seme[0];

	$query = "select * from attendsum where fteachcode = '{$teachcode}'";
	
	$result = $aobj_context->mobj_db->GetRow($query);
	
	$teacode = $result['fteachcode'];
	if(strtoupper($teachcode) ==strtoupper($teacode)){
	$qur = "SELECT IFNULL (s.fsection ,'') AS fsection FROM student s
	INNER JOIN attendsum a ON s.fexamno = a.fexamno
	 WHERE s.fdegree = '{$degree}' AND  a.fteachcode = '{$teachcode}' AND a.fexamno = '{$sem}'
	 AND IFNULL(s.fsection, '')<> '' GROUP BY s.fsection";
	}else{
		$qur = "SELECT IFNULL (s.fsection ,'') AS fsection FROM student s
	INNER JOIN attendsum a ON s.fexamno = a.fexamno
	 WHERE s.fdegree = '{$sdegree}' AND
		 IFNULL(s.fsection, '')<> '' GROUP BY s.fsection";
	}
	
	$result_sec = $aobj_context->mobj_db->GetAll($qur);  
	// var_dump($result_sec);
	// die();
	
    
    if($result_sec){
		echo $aobj_context->mobj_output->ToJSONEnvelope($result_sec,0,"success"); 
	}else{
		$data = 'Fail to load semester';
		echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
	}
}

function getDegreeAndSemType($aobj_context){
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
	$userID = $_SESSION['user_id'];
	$teachcode = $_SESSION['usr'];

	$query = "select * from s_sysdb where internal_code = '{$userID}'";
	$res = $aobj_context->mobj_db->GetRow($query);
	$user_type = $res['user_type'];							

	$join = "inner join attendsum a on d.fdegree = a.fdegree
	and a.fteachcode = '{$teachcode}'"; 
	if($user_type =='40' || $user_type =='14')
		$join = "";

	$query = "SELECT d.fdegree, d.fdescpn FROM degree d 
	INNER JOIN colldeg c ON d.fdegree = c.fdegree  
	{$join}
	WHERE c.fcollcode = '{$collcode}' 
	AND IFNULL(c.fdeleted ,'') <> 'T' 
	and d.fexamno = 'A'
	group by d.fdegree";
	$result = $aobj_context->mobj_db->GetAll($query);
	// var_dump($result);
	// die();

		if($result){
			echo $aobj_context->mobj_output->ToJSONEnvelope($result,0,"success"); 
		}else{
			$data = 'Fail to load degree';
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
		}  
}
?>