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


Current Path : /var/www/html/mum/src/
Upload File :
Current File : /var/www/html/mum/src/ECHblk.php

<?php 

function getECHblkStudents($aobj_context)
{

	session_start();
	if(!isset($_SESSION['collcode']))
	{
		$arr['msg'] = 'Session Expired Re-login';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
	}	
	$college_code = $_SESSION['collcode'];
	$user_type = $_SESSION['user_type'];
	$userid = $_SESSION['user_id'];
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  	
	$degree = trim($aobj_context->mobj_data["degree"]); 	
	$exam_no = trim($aobj_context->mobj_data["exam_no"]); 
	$status= trim($aobj_context->mobj_data["status"]);

	if($status == 'ALL')
		$fil_cond = '';
	else if($status == 'ELI')
		$fil_cond = "and ifnull(c.FAPPEAR{$exam_no},'X') = 'X'";
	else if($status == 'NEL')
		$fil_cond = "and ifnull(c.FAPPEAR{$exam_no},'X') <> 'X'";
	else if($status == 'FEC')
		$fil_cond = "and instr(c.fconstype, '{$exam_no}') > 0";
	else if($status == 'NFC')
		$fil_cond = "and instr(c.fconstype, '{$exam_no}') = 0";
	else if($status == 'HTB')
		$fil_cond = "and instr(c.fhtblk, '{$exam_no}') > 0";
	else if($status == 'UHT')
		$fil_cond = "and instr(c.fhtblk, '{$exam_no}') = 0";
		
	$query = "select s.fregno, s.fname, d.ftotsub as ftotalsub,
	c.FAPPEAR{$exam_no} as fappstatus,
	if(instr(c.felig, '{$exam_no}') > 0, 'Yes', 'No') as felig,
	if(instr(c.fconstype, '{$exam_no}') > 0, 'Yes', 'No') as fconstype,
	if(instr(c.fhtblk, '{$exam_no}') > 0, 'Yes', 'No') as fhtblk,
	ifnull(c.fremarks,'') as fremarks,
	ifnull(c.FTOTSUB{$exam_no},'') as  ftotsub,
	count(cd.fsubcode) as fcdsubcount,
	ifnull(cd.fpresent,'') as fpresent,
	s.fcaste,ifnull(ca.FCATELIG,'F') as fcatelig
	from candsum c inner join student s 
	on c.fdegree = s.fdegree and c.fcollcode = s.fcollcode and c.fregno = s.fregno
	left outer join canddet cd on c.fdegree =  cd.fdegree and c.fcollcode = cd.fcollcode
	and c.fregno = cd.fregno inner join degree d 
	on cd.fdegree = d.fdegree and cd.fexamno = d.fexamno
	left join category ca on s.fcaste = ca.fcategory
	where c.fcollcode = '{$college_code}' and c.fdegree = '{$degree}'
	and cd.fexamno = '{$exam_no}' {$fil_cond} and ifnull(c.ffreshexam,'') <> ''
	group by c.fregno, cd.fexamno order by c.fregno ";
	//var_dump($query);//FELIG FCONSTYPE FHTBLK
	$obj_get_details = $aobj_context->mobj_db->GetAll($query);

	if(!$obj_get_details)
	{
		$arr['msg'] = 'No Students Found';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}	

	$k = 1;
	foreach ($obj_get_details as $key => $value)
	{		
		$regno = $value['fregno']; 
		$name = $value['fname'];
		$fcaste = $value['fcaste'];
		$examappblk = $value['felig'];
		$constype = $value['fconstype'];			 
		$htblk = $value['fhtblk'];
		$remarks = $value['fremarks'];
		$appstatus = $value['fappstatus'];
		$fcatelig = $value['fcatelig'];

		$el_checked = $examappblk == 'Yes'? 'checked' : '';
		$cn_checked = $constype == 'Yes'? 'checked' : '';
		$ht_checked = $htblk == 'Yes'? 'checked' : '';

		// $ht_lable = $htblk == 'Yes'? 'Blocked' : 'NotBlocked';
		$cn_lable = $constype == 'Yes'? 'Appl.' : 'Not Appl.';
		$ht_lable = $htblk == 'Yes'? 'Blocked' : 'NotBlocked';		
		
		if($appstatus == 'P')
		{
			$el_lable = 'Pass';
		}
		else if($appstatus == 'N')
		{
			$el_lable = 'NotApplicable';
		}
		else if($appstatus == 'A' && $examappblk == 'No'){
			$el_lable = 'NotEligible';
		}
		else if($appstatus == 'A' && $examappblk == 'Yes'){
			$el_lable = 'Eligible';
		}
		else
		{
			$el_lable = 'Unknown';
		}

		$el_disabled = '';
		$cn_disabled = '';
		
		// Disable Exam app if appear is not A or X
		if(strpos('1*X*A', $appstatus) === false)
		{
			$el_disabled = 'disabled';
		}

		// Disable Exam app if fee paid
		$cn_disabled = 'disabled';

		if($fcatelig == 'T')
			$cn_disabled = '';

		if($value['fpresent'] == 'P')
		{
			$el_disabled = 'disabled';
			$el_lable = 'Fee Paid';

			$cn_disabled = 'disabled';
		}

		

		// Disable Exam app if Subject Miss match
		/*if($value['ftotsub'] == 0)
		{
			// check if degree sub count and canddet sub count match
			if($value['fcdsubcount'] != $value['ftotalsub'])
			{	
				$el_disabled = 'disabled';
				$el_lable = 'Sub.Missing';
			}
		}
		else
		{
			// variable subjects 
			if($value['fcdsubcount'] != $value['ftotsub'])
			{
				$el_disabled = 'disabled';
				$el_lable = 'Sub.Missing';
			}
		}*/
		
		if($k%2==0)
		{
			$class='tbl_row';
		}
		else
		{
			$class='tbl_row1'; 
		}
		
		$edy_data.="<tr class='ui-widget-content jqgrow'>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'>{$k}</td>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; padding:2px;'>{$regno} 
			<input type = 'hidden' value = '{$regno}' id = 'hregno_{$k}'>
			</td>";
		$edy_data.="<td class='tbl_row_new' align='left'   style='border-right:1px solid #C5DBEC;  padding:2px;' id='fmacas_FSUBNAME_{$m}'>{$name}</td>";		
		$edy_data.="<td class='tbl_row_new' align='center'   style='border-right:1px solid #C5DBEC;  padding:2px;' id='fmacas_fcaste_{$m}'>{$fcaste}</td>";		
		
		$edy_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;'><input type=checkbox {$el_checked}  onchange='statusChanged(this)' id = 'eligibility_$k' style='vertical-align: sub;' name='eligibility' {$el_disabled}>{$el_lable}</td>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;'><input onchange='statusChanged(this)' type=checkbox {$cn_checked} name='concession' {$cn_disabled}></td>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:2px;'><input type=checkbox {$ht_checked} id = 'ht_$k' onchange='statusChanged(this)' name='hallticket'>  {$ht_lable}</td>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:0px;'><input type='text' name='remarks' onblur='statusChanged(this)' value='{$remarks}' placeholder='Remarks' style='border:0px;' ></td>";
		$edy_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;  padding:0px;display:none'><input type=checkbox id='h_{$regno}' name='hidden'></td>";	
		$edy_data.="</tr>";   
		$k++;
	}

	$e_data="<table  width='90%' id='clear' class='tr_ventor_row' align='center' cellspacing='0' cellpadding='0' border='0' >";
	$e_data.="<th align='left' colspan='8' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Eligibility, Concession, Hall Ticket block</th>";		
	$e_data.="<tr  class='ui-state-default ui-jqgrid-hdiv'>";
	$e_data.="<td  align=center style='padding:2px; width:24px; 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:24px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Reg. No.</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;'>Student Name</td>";
	$e_data.="<td align=center style='padding:2px; width:24px; border-bottom:1px solid #C5DBEC; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>Cat.</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;'>Block Eligibility<br><input type = 'checkbox' id = 'elig' onclick = 'selectall();'> </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;'>Concession Fee Applicable</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;'>Block Hall Ticket <br><input type = 'checkbox' id = 'ht' onclick = 'selecthtall();'> </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;'>Remarks</td>";
	$e_data.="</tr>";		
	
	$arr['html_data']=$e_data.$edy_data;		  
	$arr['total_count']=$k;	
	// $arr['rem_sub']=trim($exam_removed_subject_code);	
	
	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 saveECHblkStudents($aobj_context)
{
	session_start();
	$college_code = $_SESSION['collcode'];
	$realname = $_SESSION['realname'];
	if(!isset($_SESSION['collcode']))
	{
		$arr['msg'] = 'Session Expired Re-login';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);			 
	$degree = trim($aobj_context->mobj_data["degree"]);
	$examno = trim($aobj_context->mobj_data["exam_no"]);
	$strECH = stripslashes($aobj_context->mobj_data["strECH"]);
	$rgECH = json_decode($strECH, true);

	foreach ($rgECH as $key => $value) 
	{
		$query = "select if(length(ifnull(felig,'')) <> 10,'0123456789',felig) as felig, 
		if(length(ifnull(fconstype,'')) <> 10, '0123456789', fconstype) as fconstype, 
		if(length(ifnull(fhtblk,'')) <> 10, '0123456789', fhtblk) as fhtblk 
		from candsum 
		where fdegree = '{$degree}' and fcollcode = '{$college_code}'
		and fregno = '{$value['regno']}'";

		$obj_ch_details = $aobj_context->mobj_db->GetRow($query);

		if($obj_ch_details)
		{
			$semelig =  $obj_ch_details['felig'];
			
			if($value['eligibility'] == 'Yes')
			{
				$semelig[ord($examno)-65] = $examno;
			}
			else
			{
				$semelig[ord($examno)-65] = ord($examno)-65;
			}
			
			$value['eligibility'] = $semelig;
			
			$semconsfee =  $obj_ch_details['fconstype'];
			if($value['concession'] == 'Yes')
			{
				$semconsfee[ord($examno)-65] = $examno;
			}
			else
			{
				$semconsfee[ord($examno)-65] = ord($examno)-65;	
			}
			$value['concession'] = $semconsfee;

			$semhtblk =  $obj_ch_details['fhtblk'];
			if($value['hallticket'] == 'Yes')
			{
				$semhtblk[ord($examno)-65] = $examno;
			}
			else
			{
				$semhtblk[ord($examno)-65] = ord($examno)-65;
			}
			$value['hallticket'] = $semhtblk;

			$query = "update candsum set felig = '{$value['eligibility']}', 
			fconstype = '{$value['concession']}',
			fhtblk = '{$value['hallticket']}',
			fremarks =  '{$value['remarks']}'
			where fdegree = '{$degree}' and fcollcode = '{$college_code}'
			and fregno = '{$value['regno']}'";

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

	if($results) 
	{
		$arr='Updated Successfully';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}	
	else
	{
		$arr='Updation Failure';
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure");
		return;
	}
		
}

?>