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


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

<?php 
function getattsSubjectDetails($aobj_context)
{
	session_start();	
	$college_code = $_SESSION['collcode'];
	$user_type = $_SESSION['user_type'];
	
	$userid = $_SESSION['user_id'];
	$usrtype = $_SESSION['usrtype'];
	
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);  	
    $degree = trim($aobj_context->mobj_data["degree"]); 	
    $exam_no = trim($aobj_context->mobj_data["exam_no"]); 	
	$month_name = trim($aobj_context->mobj_data["month_name"]); 
	$query="Select FUNIVCODE,FUNIVNAME,pdf_logo_path,DATE_FORMAT(NOW(),'%d/%m/%Y') as date from control";
	$rst = $aobj_context->mobj_db->GetRow($query);
	$univcode = $rst['FUNIVCODE'];
	
	$select_category_cond="select * from markentrycodition";
	$cat_cond='';
	$lobj_select_category_cond = $aobj_context->mobj_db->GetRow($select_category_cond);
	
	if($lobj_select_category_cond['Value']!='0' || $lobj_select_category_cond['Value']!=0) 
		$cat_cond=" and ".$lobj_select_category_cond['Value'];
	
	$freezcnd = "and  1=1";
	
	if($univcode == '018' )
		$freezcnd = "and  ((IFNULL(subject.FINTASS,'F') = 'T' OR IFNULL(subject.FTHEORY,'F') <> 'T') or IFNULL(subject.FSUBSIDARY,'F') = 'T')";
	
	if(strtoupper($_SESSION['usr']) =='ADMIN' || strtoupper($_SESSION['usr']) =='SUPER' || $usrtype == '40')
	{
		$ltable = 'and 1=1';
	}
	else
	{
		$ltable = "inner join usersub us on attend.fdegree = us.fdegree and instr(us.fsubcode,subject.fsubcode) > 0 and attend.fcollcode = us.fcollegecode and us.fuser = '{$userid}'";
	}
	
	$query = "select DISTINCT subject.FCSUBCODE,concat(subject.fsubname,', ',subject.fssubname) as fsubname,ifnull(collatt.ffreezed,'') as ffreezed from 
	subject inner join attend  on subject.FDEGREE = attend.fdegree and subject.FEXAMNO = attend.fexamno 
	and  subject.FCSUBCODE = attend.fsubcode and attend.fcollcode = '{$college_code}'
	{$ltable}  
	left join collatt on attend.fcollcode = collatt.fcollcode and attend.fdegree = collatt.fdegree and
	attend.fexamno = collatt.fexamno and attend.fsubcode = collatt.fsubcode and collatt.fperiod = '{$month_name}'
	where subject.fdegree = '{$degree}' and subject.fexamno='{$exam_no}'  {$freezcnd}";
	$obj_get_details = $aobj_context->mobj_db->GetAll($query);
	
	//var_dump($query);
//FCOLLCODE,FDEGREE,FEXAMNO,FSUBCODE,FMONTH,FFREEZED
		$check_all="";
		if(strtolower($user_type)=='superuser')	
			$check_all="<input type='checkbox' onclick='checkAllFamuFcSubjects(this.id);' id=Fmacas_fc_check> ";
	
	   	$e_data.="<table  width='90%'  class='tr_ventor_row' align='center' cellspacing='0' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='3' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='font-size:12px; padding-left:6px; height:22px;'>Attendance Entry Freezing</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;'>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>";		
		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 == 'T')
			{
				$start_val = '';
				$end_val = '';
				$exam_removed_subject_code =$start_val.$end_val;
				$fc_checked = "checked  disabled=true;";
				if(strtolower($user_type)=='superuser')	
				$fc_checked=" checked";
			}
			else
			{
				$fc_checked = '';
			}		
			if($k%2==0)
			{
				$class='tbl_row';
			}
			else
			{
				$class='tbl_row1'; 
			}  
			$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;' 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} ></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>";   
			$k++;
		}
	
		$arr['html_data']=$e_data;		  
		$arr['total_count']=$m;	
		$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 saveattendancefreez($aobj_context)
{
	session_start();
	$college_code = $_SESSION['collcode'];
	$user_id = $_SESSION['user_id'];
	$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"]);
	$month_name = trim($aobj_context->mobj_data["month_name"]); 
	
	$rem_sub = trim($aobj_context->mobj_data["rem_sub"]);
	$rem_unsub = trim($aobj_context->mobj_data["rem_unsub"]);
	
	$rem_sub1 = explode('*',$rem_sub);
	$rem_unsub1 = explode('*',$rem_unsub);
	
	if($rem_unsub !='')
	{
		for($i = 0;$i<count($rem_unsub1);$i++)
		{
			$check_dup = "select count(*) as count from collatt where  
			FCOLLCODE='{$college_code}' and FDEGREE ='{$degree}' and fexamno = '{$examno}'  and fsubcode = '{$rem_unsub1[$i]}' and FPERIOD = '{$month_name}'";
			$results = $aobj_context->mobj_db->getRow($check_dup);     
			$dup_flag = $results[count];
			if($dup_flag == 0) 
			{
				if($rem_unsub1[$i] != '')
				{
					$query =" insert into collatt( FCOLLCODE,FDEGREE,FEXAMNO,FSUBCODE,FPERIOD,FFREEZED,FFREEZEDATE,FFREEZEUSER,FFREEZIP)	value	
					('{$college_code}','{$degree}','{$examno}','{$rem_unsub1[$i]}','{$month_name}',null,now(),'{$user_id}','{$clientIp}')";	
					$obj_update_fcstatus = $aobj_context->mobj_db->Execute($query);
				}
			}
			else
			{
				$update_colldeg_pre_data =  " update collatt set  FFREEZED = null
				where FCOLLCODE = '{$college_code}' and FDEGREE = '{$degree}' and FEXAMNO = '{$examno}' and FSUBCODE = '{$rem_unsub1[$i]}' and FPERIOD = '{$month_name}' "; 
				$obj_update_fcstatus = $aobj_context->mobj_db->Execute($update_colldeg_pre_data);
			}
		}
	}
	
	if($rem_sub !='')
	{
		for($i = 0;$i<count($rem_sub1);$i++)
		{
			$check_dup = "select count(*) as count from collatt where  
			FCOLLCODE='{$college_code}' and FDEGREE ='{$degree}' and fexamno = '{$examno}'  and fsubcode = '{$rem_sub1[$i]}' and FPERIOD = '{$month_name}'";
			
			$results = $aobj_context->mobj_db->getRow($check_dup);     
			$dup_flag = $results[count];
			if($dup_flag == 0) 
			{
				if($rem_sub1[$i] != '')
				{
					$query =" insert into collatt( FCOLLCODE,FDEGREE,FEXAMNO,FSUBCODE,FPERIOD,FFREEZED,FFREEZEDATE,FFREEZEUSER,FFREEZIP)	value	
					('{$college_code}','{$degree}','{$examno}','{$rem_sub1[$i]}','{$month_name}','T',now(),'{$user_id}','{$clientIp}')";	
					$obj_update_fcstatus = $aobj_context->mobj_db->Execute($query);
				}
			}
			else
			{
				$update_colldeg_pre_data =  " update collatt set  FFREEZED = 'T'
				where FCOLLCODE = '{$college_code}' and FDEGREE = '{$degree}' and FEXAMNO = '{$examno}' and FSUBCODE = '{$rem_sub1[$i]}' and FPERIOD = '{$month_name}' "; 
				$obj_update_fcstatus = $aobj_context->mobj_db->Execute($update_colldeg_pre_data);
			}
		}
		
	}

	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;
	}	
}





?>