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


Current Path : /var/www/html/suk_discontinued/src/
Upload File :
Current File : /var/www/html/suk_discontinued/src/subjectfreez.php

<?php 
function getcollege($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	
	$lquery="SELECT FCOLLCODE AS internal_code,
						CONCAT(FCOLLCODE,'  -  ',FCOLLNAME,',',FTOWN) AS value FROM college order by FCOLLCODE";
	$result=$aobj_context->mobj_db->GetAll($lquery);
	$arr['college']=$result;
		
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
}

function getdegname($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	
	$fcollcode = trim($aobj_context->mobj_data["fcollcode"]); 
	
	$lquery ="select distinct colldeg.FDEGREE AS internal_code,
		CONCAT(colldeg.FDEGREE,' - ',degree.FDESCPN) AS value FROM degree,colldeg 
		WHERE degree.FDEGREE = colldeg.FDEGREE AND colldeg.fcollcode ='{$fcollcode}' order by colldeg.FDEGREE ";
	
	$result = $aobj_context->mobj_db->GetAll($lquery);
	
	$arr['degree']=$result;
	
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
}

function getexamname($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	
	$fcollcode = trim($aobj_context->mobj_data["fcollcode"]);
	$fdegree = trim($aobj_context->mobj_data["fdegree"]);
	
	$lquery ="select distinct collexam.fexamno AS internal_code,
			CONCAT(collexam.fexamno,' - ',degree.fexamname) AS value FROM degree,collexam 
			WHERE degree.FDEGREE = collexam.FDEGREE and degree.fexamno = collexam.fexamno 
			AND collexam.FDEGREE = '{$fdegree}'  and collexam.fcollcode ='{$fcollcode}'  order by collexam.fexamno";
//var_dump($lquery);
	$result = $aobj_context->mobj_db->GetAll($lquery);

	$arr['exam']=$result;
	
	echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");	
}

function getfreezsubject($aobj_context)
{
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  	
		$degree = trim($aobj_context->mobj_data["degree"]); 
		$exam_no = trim($aobj_context->mobj_data["exam_no"]); 	
		$college = trim($aobj_context->mobj_data["college"]);
		$fevent = trim($aobj_context->mobj_data["fevent"]);
	
		if($fevent == 'IAM')
		{
			$query = "select subject.FCSUBCODE,concat(subject.fsubname,', ',subject.fssubname) as fsubname,
			ifnull(ffreezed,'') as ffreezed from subject inner join collia  on subject.FDEGREE = collia.fdegree 
			and subject.FEXAMNO = collia.fexamno 
			and  subject.FCSUBCODE = collia.fsubcode and collia.fcollcode = '{$college}'
			where subject.fdegree = '{$degree}' and subject.fexamno='{$exam_no}'   
			and  IFNULL(subject.FINTASS,'F') = 'T' AND IFNULL(subject.FRETAIN,'F') = 'T' order by fcsubcode ";
			//var_dump($query);
			$obj_get_details = $aobj_context->mobj_db->GetAll($query);
			
		}else
		{
			$query = " select fcollcode,fdegree,fexam,fbatch,fcsubcode,ffreezed,printfreezed 
						from practical_entry_freeze where fcollcode = '{$college}' 
						and fdegree = '{$degree}' and fexam = '{$exam_no}' order by fcollcode,fdegree,fexam,fcsubcode,fbatch";
						
						//var_dump($query);
			$obj_get_details = $aobj_context->mobj_db->GetAll($query);
		}
		if($fevent == 'IAM')
		{
			$e_data.="<table  width='90%'  class='tr_ventor_row' align='center' cellspacing='0' cellpadding='0' border='0' >";
			$e_data.="<th align='left' colspan='4' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Subject Freeze Details </th>";		
			$e_data.="<tr  class='ui-state-default ui-jqgrid-hdiv'>";
			$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sl No</td>";
			$e_data.="<td  align=center style='padding:2px; width:25px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Sub Code</td>";
			$e_data.="<td align=center  style='padding:2px;  width:60px; border-bottom:1px solid #C5DBEC;border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Sub Name</td>";
			$e_data.="<td  align=center style='padding:2px; width:20px; border-bottom:1px solid #C5DBEC; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC;  border-bottom:1px solid #C5DBEC;'>Freeze{$check_all}</td>";//
			$e_data.="</tr>";	
			$i = 1;
			
			for($m=0;$m<count($obj_get_details);$m++)
			{		
				$FSUBCODE=$obj_get_details[$m]['FCSUBCODE']; 
				$FSUBNAME=$obj_get_details[$m]['fsubname'];			 
				$pos = $obj_get_details[$m]['ffreezed'];
				
				if($pos == 'L')
				{
					$fc_checked = "checked disabled = true ";
					$value = "freezed by logisys";
				}else if($pos == 'T')
				{
					$fc_checked = "checked";
					$value = "";
				}
				else
				{
					$fc_checked = '';
					$value = "";
				}		

				$e_data.="<tr class='ui-widget-content jqgrow'>";
				$e_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'>{$i} </td>";
				$e_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;' id='fmacas_FSUBCODE_{$m}'>{$FSUBCODE} </td>";
				$e_data.="<td class='tbl_row_new' align='left'   style='border-right:1px solid #C5DBEC;  padding:2px;' id='fmacas_FSUBNAME_{$m}'>{$FSUBNAME} </td>";
				$e_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;'><input  id='fmacas_FCSTATUS_check_{$m}' type=checkbox {$fc_checked} > {$value}</td>";
				$e_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;display:none;'><input  id='fmacas_FCSTATUS_checkH_{$m}' type=checkbox {$fc_checked} ></td>";	
				$e_data.="</tr>";   
				$i++;
			}

			$arr['html_data'] = $e_data;		  
			$arr['total_count'] = $m;	
			$arr['fevent'] = $fevent;
			$arr['rem_sub']=trim($exam_removed_subject_code);	
		}else
		{
			$j= 0;
			
			foreach($obj_get_details as $ak=>$av)
			{
				if($av['ffreezed'] == 'T')
				{
					$ffreez_checked = "checked";
				}else
				{
					$ffreez_checked = '';
				}
				
				if($av['printfreezed'] == 'T')
				{
					$prifrez_checked = "checked";
				}
				else
				{
					$prifrez_checked = '';
				}
				
				$details.="<tr>
					<td><input type = 'text' id='college{$j}'  disabled	style = 'width:60px;text-align:center''name = 'rowid' name = 'rowid' value = '{$av['fcollcode']}'/></td>
					<td><input type = 'text' id='degree{$j}' style = 'width:60px;text-align:center''  disabled  value = '{$av['fdegree']}'/></td>
					<td ><input type = 'text' id='fexam{$j}'  disabled style = 'width:50px;text-align:center' value = '{$av['fexam']}' /></td> 
					<td width = '10px'> <input type = 'text' id='subcode{$j}'disabled style = 'width:80px;text-align:center' value = '{$av['fcsubcode']}'/> </td>
					<td width = '10px'> <input type = 'text' id='batch{$j}' disabled style = 'width:50px;text-align:center' value = '{$av['fbatch']}'/> <input type = 'hidden' id='feeprh{$j}' style = 'width:50px' value = 'T'/></td>
					<td width = '10px' align='center' >  <input  id='freeze{$j}' value = '{$av['fcsubcode']}~{$av['fbatch']}' type=checkbox {$ffreez_checked} style = 'align:center'> </td>
					<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;display:none;'><input  id='freezeH{$j}' type=checkbox {$ffreez_checked} style = 'align:center'></td>
					<td width = '10px' align='center' >  <input  id='printfreeze{$j}' value = '{$av['fcsubcode']}~{$av['fbatch']}' type=checkbox {$prifrez_checked} style = 'align:center' > </td>
					<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;display:none;'><input  id='printfreezeH{$j}' type=checkbox {$prifrez_checked} align:center></td>
				</tr>";
				$j++;
			}
			$arr['details'] = $details;
			$arr['totallength'] = $j;
			$arr['fevent'] = $fevent;
		}
	if($obj_get_details)	
	  echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
	else
	  echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
    return;
	
}

function savefreezeSubject($aobj_context)
{
	session_start();
	$college_code = $_SESSION['collcode'];
	$realname = $_SESSION['realname'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$format_file= $aobj_context->main_src."/src/format.php";
	include($format_file);
	$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'];	
			 
	$degree = trim($aobj_context->mobj_data["degree"]);
	$examno = trim($aobj_context->mobj_data["exam_no"]);
	$rem_sub = trim($aobj_context->mobj_data["rem_sub"]);
	$collcode = trim($aobj_context->mobj_data["collcode"]);
	$rem_unsub = trim($aobj_context->mobj_data["rem_unsub"]);
	$fevent = trim($aobj_context->mobj_data["fevent"]);
	$user_id = $_SESSION['user_id'];
	
	if($rem_unsub !='')
	{	
		$unfzsub = $rem_unsub;
		$rem_unsub = "'".str_replace('*',"','",$rem_unsub);
		$rem_unsub = substr($rem_unsub,0,strlen($rem_unsub)-2);
		$update_fcstatus = "update collia set ffreezed = null, ffreezedate =now(),
		ffreezeuser = '{$user_id}', ffreezeip = '{$clientIp}'
		WHERE fcollcode='{$collcode}' and fdegree='{$degree}' 
		and fexamno = '{$examno}' and fsubcode in ({$rem_unsub})"; 
		//var_dump($update_fcstatus);
		$obj_update_fcstatus = $aobj_context->mobj_db->Execute($update_fcstatus);
		$query = "insert into userlog values('{$user_id}','{$realname}',now(),DATE_FORMAT(now(),'%H:%i:%s'),'{$college_code}*{$degree}*{$examno}*{$unfzsub}',null,'UFZ*IA')";
		//var_dump($query);
		$rst = $aobj_context->mobj_db->Execute($query); 	
	}	
	if($rem_sub !='')
	{	
		$fzsub = $rem_sub;
		$rem_sub = "'".str_replace('*',"','",$rem_sub);
		$rem_sub = substr($rem_sub,0,strlen($rem_sub)-2);
		$update_fcstatus = "update collia set ffreezed = 'T', ffreezedate =now(),
		ffreezeuser = '{$user_id}', ffreezeip = '{$clientIp}'
		WHERE fcollcode='{$collcode}' and fdegree='{$degree}' 
		and fexamno = '{$examno}' and fsubcode in ({$rem_sub})"; 
		//var_dump($update_fcstatus); 
		$obj_update_fcstatus = $aobj_context->mobj_db->Execute($update_fcstatus);
		$query = "insert into userlog values('{$user_id}','{$realname}',now(),DATE_FORMAT(now(),'%H:%i:%s'),'{$college_code}*{$degree}*{$examno}*{$fzsub}',null,'FZ*IA')";

		$rst = $aobj_context->mobj_db->Execute($query); 	
	}
	

	if($obj_update_fcstatus) 
	{
		$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;
	}	
}

function saveprfreezeSubject($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$degree = trim($aobj_context->mobj_data["degree"]); 	
	$exam_no = trim($aobj_context->mobj_data["exam_no"]); 	
	$college = trim($aobj_context->mobj_data["collcode"]);
	
	$freezesub = trim($aobj_context->mobj_data["prfreezesub"]);
	$freezesub = explode('*', $freezesub);
	
	$unfreezsub = trim($aobj_context->mobj_data["unprfreezsub"]);
	$unfreezsub = explode('*', $unfreezsub);
	
	$printfreeze = trim($aobj_context->mobj_data["printfreeze"]);
	$printfreeze = explode('*', $printfreeze);
	
	$unprintfreeze = trim($aobj_context->mobj_data["unprintfreeze"]);
	$unprintfreeze = explode('*', $unprintfreeze);

	if($unfreezsub !='')
	{	
		for($i=0;$i<count($unfreezsub);$i++)
		{	
			$unfreez = explode('~', $unfreezsub[$i]);
			$update = " update practical_entry_freeze set ffreezed = 'F' 
			where fcollcode = '{$college}' and fdegree = '{$degree}' 
			and fexam = '{$exam_no}' and fbatch = '{$unfreez[1]}'
			and fcsubcode = '{$unfreez[0]}'";
			$lobj_update = $aobj_context->mobj_db->Execute($update);
		}  	
	}	
	if($freezesub !='')
	{	
		for($i=0;$i<count($freezesub);$i++)
		{	
			$freez = explode('~', $freezesub[$i]);
			$update = " update practical_entry_freeze set ffreezed = 'T' 
			where fcollcode = '{$college}' and fdegree = '{$degree}' 
			and fexam = '{$exam_no}' and fbatch = '{$freez[1]}'
			and fcsubcode = '{$freez[0]}'";
			$lobj_update = $aobj_context->mobj_db->Execute($update);
		}	
	}
	
	if($unprintfreeze !='')
	{	
		for($i=0;$i<count($unprintfreeze);$i++)
		{	
			$unprifreez = explode('~', $unprintfreeze[$i]);
			$update = " update practical_entry_freeze set printfreezed = 'F' 
			where fcollcode = '{$college}' and fdegree = '{$degree}' 
			and fexam = '{$exam_no}' and fbatch = '{$unprifreez[1]}' 
			and fcsubcode = '{$unprifreez[0]}' ";
			$lobj_update = $aobj_context->mobj_db->Execute($update);
		} 	
	}	
	if($printfreeze !='')
	{
		for($i=0;$i<count($printfreeze);$i++)
		{	
			$prifreez = explode('~', $printfreeze[$i]);
			$update = " update practical_entry_freeze set printfreezed = 'T' 
			where fcollcode = '{$college}' and fdegree = '{$degree}' 
			and fexam = '{$exam_no}' and fbatch = '{$prifreez[1]}' 
			and fcsubcode = '{$prifreez[0]}' ";
			$lobj_update = $aobj_context->mobj_db->Execute($update);
		} 	
	}

	if($lobj_update)
	{
		$rdata = "Updated Successfully.";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
		return $rdata;
	}
	else
	{
		$rdata = "No Updation";
		print_r($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
		return $rdata;			
	}	
}

?>