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 : 13.58.245.158


Current Path : /var/www/oasis/custom_src_old/
Upload File :
Current File : /var/www/oasis/custom_src_old/practical_marks_misc.php

<?php
class practical_marks_misc
{
	public $aobj_context;
	public $college_name;	
	public $town;	
	public $address;	
	public $Degree_name;	

	function __construct($aobj_context)
	{
		 require_once($aobj_context->main_src.'src/format.php');
		$this->aobj_context=$aobj_context;
		$this->collcode=$_SESSION['collcode'];		 
	}
	
	function SavePracticalEntryMarksmisc()
	{
		session_start();	
		include_once($this->aobj_context."/src/JSON.php"); 
		$json = new Services_JSON();
		$collegecode = $_SESSION['collcode'];
		$usr = $_SESSION['usr'];

		$VivaSubcode = $this->aobj_context->mobj_data["VivaSubcode"];
		$Subcode = $this->aobj_context->mobj_data["Subcode"];
		$Degcode = $this->aobj_context->mobj_data["Degcode"];
		$Examno = $this->aobj_context->mobj_data["Examno"];
		
		$regno_arr = stripslashes($this->aobj_context->mobj_data["regno_arr"]);
		$mobj_jsondata = $json->decode($regno_arr);
		$regno_arr = get_object_vars($mobj_jsondata);
		
		$query = "select fmeyear, fmeexamtyp from degree where fdegree = '{$Degcode}' and fexamno = '{$Examno}'";
		$result = $this->aobj_context->mobj_db->GetRow($query);

		$fmeyear = $result['fmeyear'];
		$fmeexamtyp = $result['fmeexamtyp'];
		$query = "select fname,fcollcode from student where fregno = ''";
		$result = $this->aobj_context->mobj_db->GetRow($query);
		$fcollcode = $result['fcollcode'];
		
		$value = array(); 
		$value2 = array();
		
		for($k=1;$k<=count($regno_arr);$k++)
		{
			$query = "select fname,fcollcode from student where fregno = '{$regno_arr[$k]->regno}'";
			$result = $this->aobj_context->mobj_db->GetRow($query);
			$fcollcode = $result['fcollcode'];
			$query1 = "select count(*) as cnt from marks_pr_misc where fregno = '{$regno_arr[$k]->regno}' and fsubcode = '{$Subcode}' and fexamno = '{$Examno}' ";
			$result1 = $this->aobj_context->mobj_db->GetRow($query1);

			if($result1['cnt'] == 1)
			{
				$query2 = "update marks_pr_misc set fmarks11 = '{$regno_arr[$k]->marks}' 
						  where fregno = '{$regno_arr[$k]->regno}' and fsubcode = '{$Subcode}' and fexamno = '{$Examno}' and fdegree = '{$Degcode}'";
				$result2 = $this->aobj_context->mobj_db->Execute($query2);
				if($VivaSubcode != '')
				{
					$query3 = "update marks_pr_misc set fmarks11 = '{$regno_arr[$k]->vivamarks}' 
						  where fregno = '{$regno_arr[$k]->regno}' and fsubcode = '{$VivaSubcode}' and fexamno = '{$Examno}' and fdegree = '{$Degcode}'";
						$result3 = $this->aobj_context->mobj_db->Execute($query3);
				}
			}else
			{
				$value[] = "('{$Degcode}', '{$Examno}', '{$fcollcode}', '{$collegecode}', '{$regno_arr[$k]->regno}', '{$Subcode}',
				'P', '{$regno_arr[$k]->marks}','{$usr}', now(), '{$fmeyear}', '{$fmeexamtyp}')";

				if($VivaSubcode != '')
				{
					$value2[] = "('{$Degcode}', '{$Examno}', '{$fcollcode}', '{$collegecode}', '{$regno_arr[$k]->regno}', '{$VivaSubcode}',
					'P', '{$regno_arr[$k]->vivamarks}','{$usr}', now(), '{$fmeyear}', '{$fmeexamtyp}')";
				}
			}
		}
	
		$query = "insert into marks_pr_misc(fdegree, fexamno, fcollcode, focollcode, fregno, fsubcode,
		fpresent, fmarks11, flogname, flogdate, fyear, fexamtype)VALUES".implode(',', $value);
		
		$result = $this->aobj_context->mobj_db->Execute($query);

		if($VivaSubcode != '')
		{	
			$query = "insert into marks_pr_misc(fdegree, fexamno, fcollcode, focollcode, fregno, fsubcode,
			fpresent, fmarks11, flogname, flogdate, fyear, fexamtype)VALUES".implode(',', $value2);
			$result = $this->aobj_context->mobj_db->Execute($query);
		}
		
		if($result || $result2)
		{
			$rdata = "Updated Successfully.";
			print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,0,"success"));
			return $rdata;
		}
		else
		{
			$rdata = "No Updation / Add..!";
			print_r($this->aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure"));  
			return $rdata;			
		}			
		 	
	}
	
	function checksubfreez()
	{
		session_start();	
		$collegecode = $_SESSION['collcode'];
		$Subcode = $this->aobj_context->mobj_data["subcode"];
		$Degcode = $this->aobj_context->mobj_data["degcode"];
		$Examno = $this->aobj_context->mobj_data["examno"];
		$vivasubcode = $this->aobj_context->mobj_data["vivasubcode"];
		
		$col_span=3;	
		$query = "SELECT pr.fregno,s.fname,pr.fmarks11 FROM marks_pr_misc pr,student s WHERE pr.fregno = s.fregno AND pr.fdegree = s.fdegree
				 AND pr.FDEGREE='{$Degcode}' AND pr.FEXAMno ='{$Examno}' AND pr.FSUBCODE='{$Subcode}' group by pr.fregno order by pr.fregno";				
		$lobj_get_records = $this->aobj_context->mobj_db->GetAll($query);

		if($vivasubcode != '')
		{
			$query = "SELECT pr.fregno,s.fname,pr.fmarks11 FROM marks_pr_misc pr,student s WHERE pr.fregno = s.fregno AND pr.fdegree = s.fdegree
				 AND pr.FDEGREE='{$Degcode}' AND pr.FEXAMno ='{$Examno}' AND pr.FSUBCODE='{$vivasubcode}' group by pr.fregno order by pr.fregno";						
			$obj_get_viva_records = $this->aobj_context->mobj_db->GetAll($query);
			$col_span=4;
		}
		
		 
		
		$viva_td_header="";
		$this->viva_details_arr=array();
		if($vivasubcode != '')
		{
			$viva_td_header=" <td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Viva {$vivasubcode}</center></td>";
			foreach($obj_get_viva_records as $k=>$v)
			{
				$this->viva_details_arr[$v['fregno']]=$v['fmarks11'];
			}
		}	
			
		$e_data.="<table  width='600px;' id = 'table1' cellspacing='0' style = 'margin-left:45px;' class='tr_ventor_row' cellpadding='0' border='0' >";
		$e_data.="<th align='left' colspan='{$col_span}' 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 Entry</th>";			
		$e_data.="<tr class='ui-state-default ui-jqgrid-hdiv' >";	
		$e_data.="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Reg. No.</center></td>";
		$e_data.="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Student Name</center></td>";
		$e_data.="<td  style='padding:2px; width:60px; border-left:1px solid #C5DBEC;'><center>Practical {$Subcode}</center></td>";
		$e_data.=$viva_td_header;
		$e_data.="</tr>";

		$k=1;
		$cnt = 1;
		$border_bottom="";
		
		foreach($lobj_get_records as $key=>$value)
		{
		
			$FREGNO=$value['fregno'];
			$pract_marks=$value['fmarks11'];
			if($k==count($lobj_get_records))
			$border_bottom="border-bottom:1px solid #C5DBEC;";	
			 
			$e_data.="<tr class='ui-widget-content jqgrow'>";
			$e_data.="<td     style='padding:2px; width:50px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; border-bottom:1px solid #C5DBEC;'> <input type = 'text' id= '{$cnt}AT1' style = 'width:80px;text-align:center;' value = '{$value['fregno']}' onkeydown = 'getstudentname(this.id,event)' name='prmicmarks'/>  </td>";
			$e_data.="<td   align='left' style='{$border_bottom};border-right:1px solid #C5DBEC; padding:2px;' id='mes_std_name_{$value[FREGNO]}' > <input type = 'text' id= '{$cnt}AT2' value = '{$value['fname']}' style = 'width:470px' readonly>  </td>";
			$e_data.="<td    align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> <input type = 'text' id= '{$cnt}AT3'  style = 'width:50px;text-align:center;' value = '{$pract_marks}' onkeypress='return acceptNumbersOnlyForModule(event);' onchange = 'getchangecnt(this.id)'> <input type = 'hidden' id = 'H{$cnt}AT3' value = 'A' ></td>";

			if(!empty($obj_get_viva_records))
			{
				$viva_marks=$this->viva_details_arr[$FREGNO];
				$e_data.="<td   align='center' style='{$border_bottom};border-right:1px solid #C5DBEC;  padding:2px;'> <input type = 'text' id= '{$cnt}AT4'  style = 'width:50px;text-align:center;' value='{$viva_marks}' onkeypress='return acceptNumbersOnlyForModule(event);' onchange = 'getchangecnt(this.id)' > <input type = 'hidden' id = 'H{$cnt}AT4' value = 'A' ></td>";
			}
			$e_data.="</tr>";
			
			$k++;
			++$cnt;
		}
		$e_data.="</table>";
		if($lobj_get_records)
		{
			$rdata='';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($e_data,0,"Failure");
			return;	
			
		}else
		{
			$rdata='';
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($e_data,-1,"Failure");

		}
	}
	
	function getstudentname()
	{
		$College_Code = $_SESSION['collcode'];	
		$regno = $this->aobj_context->mobj_data["regno"];
		$id = $this->aobj_context->mobj_data["id"];
		$subcode = $this->aobj_context->mobj_data["subcode"]; 
		
		$query = "select fname,fregno from student where fregno = '{$regno}'";
		$result = $this->aobj_context->mobj_db->getRow($query);
		if(count($result) == 0)
		{
			$rdata = "Invalid Register no.";
			$arr['id'] = $id;
			$arr['data'] = $rdata;
			print_r($this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));  
			return $rdata;
		}
		
		$arr['name'] = $result['fname'];
		$arr['id'] = $id;
		
		//
		$query = "select fregno from marks_pr where fregno = '{$regno}' and fsubcode = '{$subcode}' ";
		$result = $this->aobj_context->mobj_db->getRow($query);
		
		if(count($result) > 0)
		{
			$query = "select * from marks_pr where fregno = '{$regno}' and fsubcode = '{$subcode}' and ifnull(fbatch,'') = '' and FCOLLCODE != '{$College_Code}'";

			$result2 = $this->aobj_context->mobj_db->getRow($query);
			
			if(count($result2) == 0)
			{
				$rdata = "Batch already prepared. Misc. marks entry not allowed.";
				$arr['id'] = $id;
				$arr['data'] = $rdata;
				print_r($this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"Failure"));  
				return $rdata;
			}else 
			{
				print_r($this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Failure"));  
				return $name;
			}
		}
		else 
		{
			print_r($this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"Failure"));  
			return $name;
		}
	}
}	
	
function getstudentname($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new practical_marks_misc($aobj_context);  
	$class_obj->getstudentname(); 
}

function SavePracticalEntryMarksmisc($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new practical_marks_misc($aobj_context);  
	$class_obj->SavePracticalEntryMarksmisc();
}

function checksubfreez($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$class_obj=new practical_marks_misc($aobj_context);  
	$class_obj->checksubfreez();
}
?>