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


Current Path : /var/www/oasis/src/
Upload File :
Current File : /var/www/oasis/src/subjReg.php

<?php



	function getDegreeDetails($aobj_context)
	{
		session_start();
		$collcode = $_SESSION['collcode'];
		$usrtype = $_SESSION['usrtype'];
		$userId = $_SESSION['user_id'];

			
		
		if($usrtype == '17')
		{
			$query1="SELECT DISTINCT d.fdegree AS internal_code,
			CONCAT(d.fdegree,' - ',d.fdescpn) AS VALUE 
			FROM degree d 
			inner join regcandsum r on d.fdegree = r.fdegree 
			inner join usersub u on u.fdegree = r.fdegree
			and u.FUSER = '{$userId}'
			where r.fcollcode = '{$collcode}'";
		}else
		{
			$query1="SELECT DISTINCT d.fdegree AS internal_code,
			CONCAT(d.fdegree,' - ',d.fdescpn) AS VALUE 
			FROM degree d
			 inner join regcandsum r on d.fdegree = r.fdegree 
			where r.fcollcode = '{$collcode}'";
		}	
		// var_dump($query1);die();		
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['degree']=$results1;
		echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 

	}

	function getExamNoDet($aobj_context)
	{
		session_start();
		$collcode=$_SESSION['collcode'];
		$degree = $aobj_context->mobj_data["degree"];
	
		$query1="SELECT DISTINCT d.fexamno AS internal_code,CONCAT(d.fexamno,' - ',d.fexamname) AS VALUE FROM degree d 
		inner join regcandsum r on d.fdegree = r.fdegree 
		and d.fexamno = r.ffreshexam
		where r.fcollcode = '{$collcode}' 
		and r.fdegree = '{$degree}' 
		order by d.fexamno";

		$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,'') <> '' 
		order by fsection";
		
		$results1=$aobj_context->mobj_db->GetAll($query1);
		$arr['section']=$results1;

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

	}

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

		$query = "insert ignore into regcanddet(fdegree, fexamno, fcollcode, fregno, fsubcode,fyear,fexamtype) 
				  (select rc.fdegree, rc.fexamno, rc.fcollcode, rc.fregno, s.fsubcode,rc.fyear,rc.fexamtype from 
				  regcandsum rc left join subject s on s.fdegree = rc.fdegree and s.fexamno = rc.fexamno  
				  where s.fmandatory='T' and s.fdegree='{$degree}' 
				  and s.fexamno='{$exam}' and rc.fcollcode='{$collcode}' group by s.fsubcode, rc.fregno order by s.fsubcode, rc.fregno	)";		  
		$results = $aobj_context->mobj_db->Execute($query);
		

		if($univcode == '097')
		{
			$query1="select if(ifnull(mak.ffmob,'') = '','Not Registered','Registered') as status,
			su.FMANDATORY,
			stu.FREGNO, stu.FNAME,d.ftotsub,group_concat(cd.fsubcode,'-',ifnull(su.FMANDATORY,'F') order by ifnull(su.FMANDATORY,'F') desc,cd.fsubcode) as subcode
			FROM student stu inner join regcandsum mak ON stu.fdegree = mak.fdegree 
			and stu.FREGNO=mak.FREGNO and mak.Fdegree='{$degree}' 
			and mak.ffreshexam='{$exam}' and mak.FCOLLCODE='{$collcode}'	
			inner join degree d on d.FDEGREE =mak.FDEGREE 
			and  d.Fexamno=mak.Fexamno 
			left join regcanddet cd on mak.fregno = cd.fregno and mak.fdegree = cd.fdegree 
			and mak.fcollcode = cd.fcollcode and mak.ffreshexam = cd.fexamno
			left join (select distinct fdegree,fexamno,fsubcode,FMANDATORY from subject where fdegree = '{$degree}' 
			and fexamno = '{$exam}') su on su.fdegree = cd.fdegree and su.fexamno = cd.fexamno
			and cd.fsubcode = su.fsubcode
			WHERE stu.FREGNO != ''  
			and mak.ffreshexam='{$exam}'
			{$cnd}
			group by mak.fregno
			order by stu.FREGNO"; 
			//var_dump($query1);
		}else
		{
			$query1="select '' as status,stu.FREGNO, stu.FNAME,d.ftotsub,group_concat(cd.fsubcode,'-',ifnull(su.FMANDATORY,'F') order by ifnull(su.FMANDATORY,'F') desc,cd.fsubcode) as subcode
			FROM student stu inner join regcandsum mak ON stu.fdegree = mak.fdegree 
			and stu.FREGNO=mak.FREGNO and mak.Fdegree='{$degree}' 
			and mak.ffreshexam='{$exam}' and mak.FCOLLCODE='{$collcode}'
			inner join degree d on d.FDEGREE =mak.FDEGREE 
			and  d.Fexamno=mak.Fexamno 
			left join regcanddet cd on mak.fregno = cd.fregno and mak.fdegree = cd.fdegree 
			and mak.fcollcode = cd.fcollcode and mak.ffreshexam = cd.fexamno
			left join (select distinct fdegree,fexamno,fsubcode,FMANDATORY from subject where fdegree = '{$degree}' 
			and fexamno = '{$exam}') su on su.fdegree = cd.fdegree and su.fexamno = cd.fexamno
			and cd.fsubcode = su.fsubcode
			WHERE stu.FREGNO != ''  
			and mak.ffreshexam='{$exam}'
			{$cnd}
			group by mak.fregno
			order by stu.FREGNO"; 
			// var_dump($query1);
		}

		
		// and d.FMEYEAR=mak.FYEAR 
		// and d.FMEEXAMTYP=mak.FEXAMTYPE
		$results1=$aobj_context->mobj_db->GetAll($query1);
		
		$ftotsub = $results1[0]['ftotsub'];
		// var_dump($results1,$ftotsub,$query1);die();
		$query = "select distinct fsubcode,fsubname,fsubshort from subject 
		where fdegree = '{$degree}' and fexamno = '{$exam}' 
		and ifnull(fsuspend,'') <> 'T'
		group by fsubcode";	

		$res=$aobj_context->mobj_db->GetAll($query);
		$opt = "<option>--Select--</option>";
		
		foreach($res as $value)
		{	
			$opt .= "<option value = '{$value['fsubcode']}'>".$value['fsubshort']." - ".$value['fsubcode']." - ".$value['fsubname']."</option>";
		}

		$e_data.="<table  width='100%' id = 'showteachsub' cellspacing='0' align='center' class='tr_ventor_row' cellpadding='0' border='0' >";
		$e_data.="<thead style='position:sticky; top:0; z-index:3'>";
		$e_data.="<tr>";
		$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:24px;position:sticky;border-right:0px;left:0px;border-radius: 0;'>Subject Identification</th>";
		$e_data.="<th colspan='{$ftotsub}' class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' style='border-radius: 0;'></th>";
		$e_data.="</tr>";
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv'>";	
		$e_data.="<td rowspan='2'class='headcol'  style='padding:2px; width:20px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;position:sticky;left:0px;background: white'><center>Sl.<br>No.</center></td>";
		$e_data.="<td rowspan='2'class='headcol'  style='padding:2px; width:50%;  border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;position:sticky;left:27px;background: white'><center>Reg No</center></td>";
		$e_data.="<td rowspan='2'class='headcol'  style='padding:2px; width:90%;  border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;position:sticky;left:177px;background: white'><center>Name</center></td>";
		
		if($univcode == '097')
			$e_data.="<td rowspan='2'class='headcol'  style='padding:2px; width:90%; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;position:sticky;left:177px;background: white'><center>Status</center></td>";
			
		for($i=1;$i<=$ftotsub;$i++)
		{
			$e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'><center>Subject {$i}</center></td>";
		}

		$e_data.="</tr>";
		$e_data.="</thead>";
		
		$k=1;
		$border_bottom="border-bottom:1px solid #C5DBEC;";
		foreach($results1 as $value)
		{
			
			$e_data.="<tr class='ui-widget-content jqgrow' style = 'height:25px;'>";
			$e_data.="<td  class='tbl_row_new'  align='center' style='{$border_bottom}z-index:1; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;position:sticky;left:0;background: white'>{$k}</td>";
			$e_data.="<td  class='tbl_row_new'  align='center' style='{$border_bottom}z-index:2; border-right:1px solid #C5DBEC; padding:2px;position:sticky;left:27px;background: white'>				<input  {$inp_class} type=text name='Regno' style='width:140px;border:none;text-align: center;' readonly id='reg_{$value[FREGNO]}' value='{$value[FREGNO]}'> </td>";
			$e_data.="<td  class='tbl_row_new'  align='center' style='{$border_bottom}z-index:3; border-right:1px solid #C5DBEC; padding:2px;position:sticky;left:177px;background: white'>				<input  {$inp_class} type=text name='Regno' style='width:140px;border:none;' readonly id='reg_{$value[FNAME]}' value='{$value[FNAME]}'> </td>";

			if($univcode == '097')
			{	
				$e_data.="<td  class='tbl_row_new'  align='center' style='{$border_bottom}; border-left:1px solid #C5DBEC;border-right:1px solid #C5DBEC; padding:2px;position:sticky;left:177px;background: white'>
				<input  {$inp_class} type=text name='Regno' style='width:140px;border:none;' readonly id='reg_{$value[status]}' value='{$value[status]}'> </td>";
			}

			for($i=1;$i<=$ftotsub;$i++)
			{
				$e_data.="<td  style='padding:2px; width:30px; border-left:0px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'>
				<select style='width:100px;border:none;' id = '$value[FREGNO]_$i' onchange = 'getupdate(this.id)'>";
				$e_data.=$opt;
				$e_data.="</select>
				<input type ='hidden' id = 'h_$value[FREGNO]_$i' value = ''>
				<input type ='hidden' id = 'o_$value[FREGNO]_$i' value = ''>
				</td>";
				
			}
			$k++;
			$e_data.="</tr>";

		}

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

	function saveSubRegData($aobj_context)
	{
		session_start();
		include("error_log.php");
		$collcode=$_SESSION['collcode'];
		$FLOGNAME = $_SESSION['usr']; 
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		$subarry = $aobj_context->mobj_data["subarry"];
		$fsubarry = json_decode($subarry);
		
		$check_adminsion_freeze = "select distinct d.fyear, d.fexamtype from regcandsum d
		where d.FDEGREE='{$degree}'";
		$lobj_check_adminsion_freeze = $aobj_context->mobj_db->getRow($check_adminsion_freeze);
		$fyear = $lobj_check_adminsion_freeze['fyear'];
		$fexamtype = $lobj_check_adminsion_freeze['fexamtype'];
		$regnoold = '';
		$regnonew = '';
		foreach($fsubarry as $value)
		{
			
			$reg_no = $value->regno;
			$regnonew = $value->regno;
			
			$subcode = $value->subcode;
			$osubcode = $value->osubcode;
			
			if($value->subcode != '--Select--')
			{
				if($osubcode == '')
				{	
					if($regnonew != $regnoold)
					{
						$query = "delete from regcanddet where fregno = '{$regnonew}'
						and fexamno = '{$exam}'";
						$res = $aobj_context->mobj_db->Execute($query);
						$regnoold = $regnonew;
					}

					$query="insert into regcanddet(FDEGREE,FEXAMNO,FCOLLCODE,FREGNO,FSUBCODE,FINSERTED,fyear,fexamtype)
							values ('{$degree}','{$exam}','{$collcode}','{$reg_no}','{$subcode}','T','{$fyear}','{$fexamtype}')";
				}else
				{
					$query = "update regcanddet set fsubcode = '{$subcode}'
					where fregno = '{$reg_no}' and fcollcode = '{$collcode}' 
					and fdegree = '{$degree}' 
					and fsubcode = '{$osubcode}'";
				}
				$lobj_insert_canddet_records = $aobj_context->mobj_db->Execute($query);
			}
			// var_dump($query);
		}
		// die();

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

	}

	function freezSubRegData($aobj_context)
	{
		session_start();
		include("error_log.php");
		$collcode=$_SESSION['collcode'];
		$FLOGNAME = $_SESSION['usr']; 
		$degree = $aobj_context->mobj_data["degree"];
		$exam = $aobj_context->mobj_data["degexam"];
		
		$query = "update regcandsum set ffreez = 'T'
		where fdegree = '{$degree}' and fexamno = '{$exam}'";
		$lobj_insert_canddet_records = $aobj_context->mobj_db->Execute($query);

		if($lobj_insert_canddet_records)
		{
			$rdata = "Updated Successfully.";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "Try after some time";
			echo($aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}

	}
	
?>