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


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

<?php

	function getDegreeGroup($aobj_context)
	{
		
		$query = "SELECT DISTINCT(fdeggrp) AS internal_code,fdeggrp AS VALUE FROM degree 
		WHERE ifnull(fdeggrp,'') <> ''";
		
		$results = $aobj_context->mobj_db->GetAll($query);

		$arr['deggrp']=$results;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}
	
	function getDegreeNames($aobj_context)
	{

		$deg = $aobj_context->mobj_data["degtype"];
		//var_dump($deg );
		$query1="SELECT DISTINCT(fdegree) AS internal_code,CONCAT(fdegree,' - ',fdescpn) AS VALUE FROM degree where fdeggrp='{$deg}' ";
		//var_dump($query1);
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degree']=$results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getIADegreeName($aobj_context)
	{
		session_start();
		$collcode  = $_SESSION['collcode'];
		$user_type = $_SESSION['user_type'];
		$userid = $_SESSION['user_id'];
	

		if(strtoupper($_SESSION['user_type']) =='ADMIN' || strtoupper($_SESSION['user_type']) =='SUPERUSER')
		{
			$ltable = "";
		}else
		{
			$ltable = "inner join usersub us on d.fdegree = us.fdegree and r.fcollcode = us.fcollegecode and us.fuser = '{$userid}'";
		}

		
		$query1="SELECT DISTINCT d.fdegree AS internal_code,CONCAT(d.fdegree,' - ',d.fdescpn) AS VALUE FROM degree d
		 inner join marks r on d.fdegree = r.fdegree 
		 {$ltable}
		where r.fcollcode = '{$collcode}'";
		//var_dump($query1);

		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degree']=$results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getIADegreeExamName($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		//var_dump($deg );
		$query1="SELECT DISTINCT d.fexamno AS internal_code,CONCAT(d.fexamno,' - ',d.fexamname) AS VALUE FROM degree d 
		inner join marks r on d.fdegree = r.fdegree 
		and d.fexamno = r.fexamno
		where r.fcollcode = '{$collcode}' and r.fdegree = '{$degree}'";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degexam']=$results1;

		$query1="SELECT DISTINCT fsection AS internal_code,fsection AS VALUE FROM student 
		where fcollcode = '{$collcode}' and fdegree = '{$degree}'
		and ifnull(fsection,'') <> ''";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['section']=$results1;

		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getIADegreeSubject($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["exam"];
		$user_type = $_SESSION['user_type'];
		//var_dump($deg );

		$userID = $_SESSION['user_id'];
	

		if(strtoupper($_SESSION['user_type']) =='ADMIN' || strtoupper($_SESSION['user_type']) =='SUPERUSER')
		{
			$ltable = "";
		}else
		{
			$ltable = "inner join usersub us on r.fdegree = us.fdegree and instr(us.fsubcode,r.fsubcode) > 0 and r.fcollcode = us.fcollegecode and us.fuser = '{$userID}'";
		}


		$query1="SELECT DISTINCT s.fsubcode AS internal_code, CONCAT(s.fsubcode,' - ',s.fsubname) AS VALUE 
		FROM subject s 
		inner join marks r on s.fdegree = r.fdegree 
		and s.fexamno = r.fexamno
		and s.fcsubcode = r.fsubcode
		{$ltable}
		where r.fcollcode = '{$collcode}' 
		and r.fdegree = '{$degree}'
		and r.fexamno = '{$exam}'";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		//var_dump($query1);
		$arr['subcode']=$results1;
		
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getIADegreeSubjectTest($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["exam"];
		$subcode = $aobj_context->mobj_data["subcode"];
		//var_dump($deg );
		$query1="SELECT DISTINCT s.ftest AS internal_code, s.ftest AS VALUE 
		FROM subject s 
		inner join marks r on s.fdegree = r.fdegree 
		and s.fexamno = r.fexamno
		and s.fcsubcode = r.fsubcode
		where r.fcollcode = '{$collcode}' 
		and r.fdegree = '{$degree}'
		and r.fexamno = '{$exam}'
		and s.fsubcode = '{$subcode}'
		and ifnull(s.ftest,'') <> ''";
		$results1=$aobj_context->mobj_db->GetAll($query1);
		//var_dump($query1);
		$arr['test']=$results1;
		
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}
	

	function displayStudSubDet($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		$subcode = $aobj_context->mobj_data["subcode"];
		$section = $aobj_context->mobj_data["section"];
		
		$cnd = "and stu.fsection = '{$section}'";
		

		$query = "select * from collexam 
		where fcollcode = '{$collcode}' 
		and fdegree = '{$degree}'  
		and fexamno = '{$exam}'
		and DATE_FORMAT(NOW(),'%Y-%m-%d') between DATE_FORMAT(collexam.fiafrom,'%Y-%m-%d') 
		AND DATE_FORMAT(collexam.fiato,'%Y-%m-%d')";
		$res3=$aobj_context->mobj_db->GetAll($query);

		if($section == 'All')
		{
			$cnd = "";
		}

		$query1="select stu.FREGNO, stu.FNAME,ifnull(stu.fuucmsregno,'-') as fuucmsregno,
		group_concat(
		concat(mak.FSUBCODE,'_',IFNULL(mak.FMARKS, '-1'),'_',IFNULL(mak.FPRESENT, ''),'_',sub.FVALMAX)
		order by mak.FSUBCODE) as sublist
		FROM student stu inner join marks mak ON stu.fdegree = mak.fdegree 
		and stu.FREGNO=mak.FREGNO and mak.Fdegree='{$degree}' 
		and mak.Fexamno='{$exam}' and mak.FCOLLCODE='{$collcode}'
		inner join subject sub on sub.FcSUBCODE = mak.FSUBCODE
		inner join degree d on d.FDEGREE =mak.FDEGREE 
		and  d.Fexamno=mak.Fexamno and d.FMEYEAR=mak.FYEAR 
		and d.FMEEXAMTYP=mak.FEXAMTYPE
		WHERE stu.FREGNO != ''  
		and fintass = 'T'
		and sub.FSUBCODE='{$subcode}' and sub.FDEGREE='{$degree}'
		and sub.FEXAMNO='{$exam}'
		{$cnd}
		group by stu.FREGNO
		order by stu.FREGNO";
		$results1=$aobj_context->mobj_db->GetAll($query1);

		$query = "select distinct fcsubcode,FVALMAX from subject 
		where fdegree = '{$degree}' and fexamno = '{$exam}' 
		and fsubcode='{$subcode}'
		and fintass = 'T'
		order by fcsubcode";	
		$res=$aobj_context->mobj_db->GetAll($query);
		$id = 4+count($res);
		//var_dump($query);
		$e_data.="<table  width='80%' id = 'showteachsub' cellspacing='0' class='tr_ventor_row' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='{$id}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:24px;'>Marks List</th>";			
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
		$e_data.="<td  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Sl.<br>No.</center></td>";
		$e_data.="<td  style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>UUCMS Reg. No.</center></td>";
		$e_data.="<td  style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Reg. No.</center></td>";
		$e_data.="<td  style='padding:2px; width:140px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Student Name</center></td>";
			
		foreach($res as $value)
		{
			$e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Marks ({$value['fcsubcode']}) <br> Max. Marks: {$value['FVALMAX']}</center></td>";
		}

		$e_data.="</tr>";
		$k=1;
		$border_bottom="border-bottom:1px solid #C5DBEC;";
		if($res3)
		{
			foreach($results1 as $value)
			{

				$e_data.="<tr class='ui-widget-content jqgrow'>";
				$e_data.="<td tabindex=-1   align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>{$k}</td>";
				$e_data.="<td tabindex=-1   align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>{$value[fuucmsregno]}</td>";
				$e_data.="<td tabindex=-1   align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>
					<input tabindex=-1  {$inp_class} type=text name='Regno' style='width:80px;border:none;' readonly id='reg_{$value[FREGNO]}' value='{$value[FREGNO]}'> </td>";
				$e_data.="<td tabindex=-1  align='left' style='{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;' id='mes_std_name_{$value[FREGNO]}' >  {$value[FNAME]} </td>";
				$sublist = $value['sublist'];
				$subdet = explode(",",$sublist);
				foreach($subdet as $val) 
				{
					$marks = explode("_",$val);
					$regno = $value['FREGNO'];
					$e_data.="<td tabindex=-1  align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> 
					<input type='text' style='width:30px;{$border}' id='mes_marks_{$marks[0]}_{$value[FREGNO]}' class='ElementCount'  onkeypress='return acceptNumbersOnlyForModule(event);'  onchange = 'getupdate(this.id)'  onblur = 'getValidateMarks(\"{$marks[3]}\",\"{$regno}\",\"{$marks[0]}\")' value='{$marks[1]}' > 
					<input type=hidden style='width:10px;{$border}' id='hidden_{$marks[0]}_{$value[FREGNO]}' value='A'> </td>";
				}
				$k++;
				
				$e_data.="</tr>";

			}
		}else
		{
			$e_data.="<tr class='ui-widget-content jqgrow'>";
			$e_data.="<td colspan='{$id}'  align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;'>Dates are not enabled contact admin</td>";
			$e_data.="</tr>";
		}

		$arr['tabledata'] = $e_data;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}


	function saveIAMarkEntry($aobj_context)
	{
		session_start();
		include("error_log.php");
		$collcode=$_SESSION['collcode'];
		$User_code = $_SESSION['usr']; 
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		$subcode = $aobj_context->mobj_data["subcode"];
		$test = $aobj_context->mobj_data["test"];
		$subarry = $aobj_context->mobj_data["subarry"];
		$fsubarry = json_decode($subarry);
		
		foreach($fsubarry as $value)
		{
			
			$qry = "select fmarks from marks where 
					fcollcode = '{$collcode}'
					and fdegree = '{$degree}' 
					and fexamno = '{$exam}'
					and fsubcode = '{$value->subcode}'
					and fregno = '{$value->regno}'";
			$res = $aobj_context->mobj_db->getRow($qry);

			$presnt = "";
			if($value->marks == '-2')
			{
				$presnt = "A";
			}else if($value->marks == '-1')
			{
				$presnt = "";
			}else
			{
				$presnt = "P";
			}

			$query = "update marks set FMARKS = '{$value->marks}', FPRESENT = '{$presnt}', 
			FLOGNAME = '{$User_code}', FLOGDATE = now()
			where fregno = '{$value->regno}'
			and fsubcode = '{$value->subcode}'
			and fdegree = '{$degree}'
			and fcollcode = '{$collcode}'";
			$obj_upd = $aobj_context->mobj_db->Execute($query);

			$oldmarks =  $res['fmarks'];
			$univcode = $_SESSION['FUNIVCODE'];
			$mob = $_SESSION['FMOBILE'];
			$usr = $_SESSION['usr'];
			$college_code = $_SESSION['collcode'];
			$remark = "MEN - IA Marks Entry - $degree, $exam, $value->subcode, $College_Code,".$value->regno.", Old: $oldmarks, New: ".$value->marks;
			$enttype = "MEN";

			$res = error_logs($aobj_context,$univcode,$remark,$college_code,$enttype,$usr,$mob);

		}

		if($obj_upd)
		{
			$rdata = "Updated Successfully.";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "No Updation / Add..!";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}

	}


	
?>