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


Current Path : /proc/thread-self/root/var/www/html/sikkim/custom_src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/sikkim/custom_src/student.php

<?php
require_once(_DIR_ . "/../../../aws/aws-autoloader.php");

use Aws\S3\S3Client;
use Aws\S3\Exception\S3Exception;


class applicationForm
{
	function __construct($aobj_context)
	{
		session_start();
		$this->aobj_context=$aobj_context;
		$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);	
		$this->aobj_context=$aobj_context;
		$this->ip=$_SERVER["REMOTE_ADDR"];
		$this->login_cnt=$_SESSION['login_cnt'];
	}
		 
	function SavestudentDetails()
	{
			$this->edit_app_code=trim($this->aobj_context->mobj_data["edit_app_code"]);
			$this->fdegree=trim($this->aobj_context->mobj_data["fdegree"]);
			$this->fcollcode=trim($this->aobj_context->mobj_data["fcollcode"]);
			$this->candidate_name= ucwords(trim($this->aobj_context->mobj_data["candidate_name"]));
			$this->gender=trim($this->aobj_context->mobj_data["gender"]);
			
			$this->roll_number=strtoupper(trim($this->aobj_context->mobj_data["roll_number"]));
			$this->nationality = trim($this->aobj_context->mobj_data["nationality"]);
			$this->nationalname = trim($this->aobj_context->mobj_data["nationalname"]);
			
			$this->father_name=trim($this->aobj_context->mobj_data["father_name"]);
			//$this->father_Occupation=trim($this->aobj_context->mobj_data["father_Occupation"]);
			$this->mother_name=trim($this->aobj_context->mobj_data["mother_name"]);
			//$this->mother_Occupation=trim($this->aobj_context->mobj_data["mother_Occupation"]);
			$this->category=trim($this->aobj_context->mobj_data["category"]);
			$this->dob=$this->aobj_context->mobj_data["dob"];
			$this->postal_address=trim($this->aobj_context->mobj_data["postal_address"]);
			
			$this->comm_addr1=trim($this->aobj_context->mobj_data["comm_addr1"]);
			
			
			$this->comm_addr2=trim($this->aobj_context->mobj_data["comm_addr2"]);
			
			
			$this->comm_addr3=trim($this->aobj_context->mobj_data["comm_addr3"]);
			
			
			$this->comm_addr4=trim($this->aobj_context->mobj_data["comm_addr4"]);
			
			
			$this->per_addr1=trim($this->aobj_context->mobj_data["per_addr1"]);
			$this->per_addr2=trim($this->aobj_context->mobj_data["per_addr2"]);
			$this->per_addr3=trim($this->aobj_context->mobj_data["per_addr3"]);
			$this->per_addr4=trim($this->aobj_context->mobj_data["per_addr4"]);
			
			$this->permanent_address=trim($this->aobj_context->mobj_data["permanent_address"]);
			$this->contact_no=trim($this->aobj_context->mobj_data["contact_no"]);
			$this->email_id=trim($this->aobj_context->mobj_data["email_id"]);
			$this->moi=trim($this->aobj_context->mobj_data["moi"]);
			$this->Religion=trim($this->aobj_context->mobj_data["Religion"]);
			$this->Blood_Groop=trim($this->aobj_context->mobj_data["Blood_Groop"]);
			
			$this->perstate = trim($this->aobj_context->mobj_data["perstate"]);
			$this->regnno = trim($this->aobj_context->mobj_data["regnno"]);
			//$this->draftno = trim($this->aobj_context->mobj_data["draftno"]);
			$this->sub_arr = trim($this->aobj_context->mobj_data["sub_arr"]);
			$this->honours = trim($this->aobj_context->mobj_data["honours"]);

			$this->univname = trim($this->aobj_context->mobj_data["univname"]);
			$this->level = trim($this->aobj_context->mobj_data["level"]);
			$this->year = trim($this->aobj_context->mobj_data["year"]);
			$this->rollno = trim($this->aobj_context->mobj_data["rollno"]);
			$this->percentage = trim($this->aobj_context->mobj_data["percentage"]);
			$this->Division = trim($this->aobj_context->mobj_data["Division"]);
			
			/* $this->draftamount = trim($this->aobj_context->mobj_data["draftamount"]);
			$this->draftdate=$this->aobj_context->mobj_data["draftdate"];
			
			$this->draftno = trim($this->aobj_context->mobj_data["draftno"]);
			$this->issbank = trim($this->aobj_context->mobj_data["issbank"]);
			$this->issbranch = trim($this->aobj_context->mobj_data["issbranch"]); */
			
			$this->lastinst = trim($this->aobj_context->mobj_data["lastinst"]); 
			$this->lastinstname = trim($this->aobj_context->mobj_data["lastinstname"]); 
			
			$this->lastexampas = trim($this->aobj_context->mobj_data["lastexampas"]); 
			$this->board = trim($this->aobj_context->mobj_data["board"]);
			$this->state = trim($this->aobj_context->mobj_data["state"]);
			
			$this->dcfee = trim($this->aobj_context->mobj_data["dcfee"]);
			$this->mcfee = trim($this->aobj_context->mobj_data["mcfee"]);
			$this->admfee = trim($this->aobj_context->mobj_data["admfee"]);
			$this->amount = trim($this->aobj_context->mobj_data["amount"]);
			$this->payment_type = trim($this->aobj_context->mobj_data["payment_type"]);
			$this->fdeggrp=trim($this->aobj_context->mobj_data["fdeggrp"]);


			if($this->roll_number == 'UNDEFINED' || $this->roll_number == '' || $this->roll_number == 'NULL' || strlen($this->roll_number) <8)
			{
				$arr='Roll No. can not be empty';					 
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
				return;
			}

			if(strlen($this->roll_number) ==8)
			{
				// $arr='Roll No. length sholuld be 8 characters';					 
				// echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
				// return;
			}else
			{
				$arr='Roll No. length sholuld be 8 characters';					 
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
				return;
			}

			if($this->contact_no == '9733171537' && $this->fcollcode == '1001')
			{

			}else if( $this->fcollcode == 'E010' || $this->fcollcode == 'E011' || $this->fcollcode == 'E012' )
			{

			}
			else
			{

				$arr='Last Date is Over';					 
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure"); 
				return;

			}

			
			$check_dup="SELECT fname,fdegree,fcollcode,frollno,
						date_format(fdob,'%d/%m/%Y') as fdob 
						from studadm where frollno = '{$this->roll_number}' 
						and fdeleted <> 'T'"; 

			$obj_check_dup=$this->aobj_context->mobj_db->GetRow($check_dup);				
			
			if($obj_check_dup)
			{
				$data="The Roll number ".$obj_check_dup['frollno']." has already been entered. \r\nstudent name : ".$obj_check_dup['fname']."\r\ncollege code : ".$obj_check_dup['fcollcode']."\r\ndegree : ".$obj_check_dup["fdegree"]."\rPlease enter the correct roll number.\r\n";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return false;
			} 


			if($this->fdeggrp =='lat'){
				$exm = 'C';
			}else{
				$exm = 'A';
			}

			// var_dump($exm);
			// die();
			
			
			if($this->perstate == 'others')
			{
				$state = $this->state;
				
			}
			else
			{
				$state = $this->perstate; 
			}
			if($this->level == 'others')
			{
				$leval = $this->lastexampas;
				
			}else
			{
				$leval = $this->level; 
			}
			
			if($this->univname == 'others')
			{
				$univname = $this->board;
				
			}else
			{
				$univname = $this->univname;
			}
			
			if($this->lastinst == 'others')
			{
				$FQUALINS = $this->lastinstname;
			}else
			{
				$FQUALINS = $this->lastinst;
			}
			
			if($this->nationality == 'others')
			{
				$nation = $this->nationalname;
			}else
			{
				$nation = $this->nationality;
			}
			$app_no = $this->fdegree.$this->fcollcode.$degree_slno;
			$sub_arr = explode($this->sub_arr);
			
			include_once("/JSON.php"); 
			$json = new Services_JSON();
			 
			$this->sub_arr = stripslashes($this->aobj_context->mobj_data["sub_arr"]);
			$mobj_jsondata = $json->decode($this->sub_arr);
			$sub_arr_data = get_object_vars($mobj_jsondata);
			
			$check_dup="select count(*) as dup_cnt from studadm
			where 
			FDOB='{$this->dob}'
			and FNAME='{$this->candidate_name}' 
			and FDEGREE = '{$this->fdegree}' 
			and FCOLLCODE = '{$this->fcollcode}' 
			and FEMAIL = '{$this->email_id}' and fdeleted <> 'T'";
			$obj_check_dup=$this->aobj_context->mobj_db->GetRow($check_dup);				
			
			if($obj_check_dup['dup_cnt']>0)
			{
				$data="You have already applied. Call Help Desk in case of any clarifications else reprint the Application.";
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				return false;
			} 
		
			$lquery ="  select FCADSTATUS, ifnull(fadmstop,'') as FADMSTOP from colldeg 
						where FCOLLCODE='{$this->fcollcode}' 
						and FDEGREE='{$this->fdegree}'";
			$check_adminsion_freeze=$this->aobj_context->mobj_db->GetRow($lquery);
					
			$degree = "";
			if($this->fdegree == 'BA14')
			{
				$degree = "10";
			}else if($this->fdegree == 'BSC14')
			{
				$degree = "11";
			}else if($this->fdegree == 'BCM14')
			{
				$degree = "12";
			}else if($this->fdegree == 'MED15')
			{
				$degree = "13";
			}else if($this->fdegree == 'BED15')
			{
				$degree = "14";
			}else if($this->fdegree == 'LLB14')
			{
				$degree = "15";
			}else if($this->fdegree == 'MSC14')
			{
				$degree = "16";
			}else if($this->fdegree == 'MA14')
			{
				$degree = "17";
			}
			
			if($this->honours == 'undefined')
			{
				$this->honours == '';
			}
			
			$lquery = "select right(concat('0000',ifnull(max(FSLNO),0)+01),4)  as  FSLNO from studadm
			where  FDEGREE='{$this->fdegree}' and FCOLLCODE='{$this->fcollcode}'";				
			$get_auto_no=$this->aobj_context->mobj_db->GetRow($lquery);
			$degree_slno=$get_auto_no['FSLNO'];
			
			$college_path=$this->aobj_context->main_src."/student_photos/{$this->fcollcode}";
			$folder_path=$this->aobj_context->main_src."/student_photos/{$this->fcollcode}/".replaceChars($this->fdegree);
			$file_name=basename($_FILES['student_entry_upload']['name']);
			$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
			$url = $this->aobj_context->main_src;
			$file_ext=$path_arr['extension'];
			
			$full_file_path= $folder_path.'/'.$this->roll_number.'.'.$file_ext;
			$image_path="student_photos/{$this->fcollcode}/".replaceChars($this->fdegree).'/'.$this->roll_number.'.'.$file_ext;
			$image_path1="018/student_photos/{$this->fcollcode}/".replaceChars($this->fdegree).'/'.$this->roll_number.'.'.$file_ext;
			if(!file_exists($college_path))
			{
				mkdir($college_path);
			}if(!file_exists($folder_path))
			{
				mkdir($folder_path);
			}

			$s3 = S3Client::factory(
				array(
					'credentials' => array(
						'key' => IAM_KEY,
						'secret' => IAM_SECRET
					),
					'version' => "latest",
					'region'  => 'ap-south-1'
				)
			);

			$photo_path="";
			if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
			{ 
				if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$full_file_path))
				{
					$photo_path=$image_path;
					
					try {
						$s3->putObject(['Bucket' => STUDENT_PHOTOS_BUCKET, 'Key' => $image_path1, 'SourceFile' => $full_file_path]);
						unlink($full_file_path);
					} catch (S3Exception $e) {
						$arr['message'] = 'Unable to upload photo';
						echo $aobj_context->mobj_output->ToJSONEnvelope($arr, -1, "failure");
						return;
					}

				}else
				{
					$arr='Kinldy Upload Valid Photo';					 
					echo $this->aobj_context->mobj_output->ToJSONEnvelope($lquery,-1,"failure"); 
					return;
				}
			}else 
			{
				$arr='Kinldy Upload  Photo';					 
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($lquery,-1,"failure"); 
				return;

			}
			
			//$app_no = $this->fdegree.$this->fcollcode.$degree_slno;
			
			$this->amount = trim($this->aobj_context->mobj_data["amount"]);
			$this->payment_type = trim($this->aobj_context->mobj_data["payment_type"]);
			
			$app_no = $this->fdegree.$this->fcollcode.$degree_slno;
			//$app_no = $degree.$this->fcollcode.$degree_slno; 
			$lquery = "insert into studadm( FSLNO,FDEGREE,FEXAMNO,FCOLLCODE,FNAME,FFATNAME,FMOTNAME,FROLLNO,
			FDOB,FSEX,FCASTE,FNATIONAL,FENGLISH,FCURRADD1,FCURRADD2,FCURRADD3,FCURRADD4,
			FPERMADD1,FPERMADD2,FPERMADD3,FPERMADD4,FPHOTOPATH,FRELIGION,FFAT_OCC,FMOT_OCC,
			FEMAIL,FCONTACT_NO,FBLOOD_GROUP,FLOGDATE, FDELETED,FAPPNO,FFEEDET,FREGNNO,FSTATE,FQUALUNIV,FQUALDEG,
			FQUALYEAR,FQUALREG,FQUALPR,FQUALCLASS,FQUALINS,FAMOUNT,FPAYMENTTYPE,fadmfee,fdcfee,fmcfee) 
			values('{$degree_slno}','{$this->fdegree}','{$exm}', '{$this->fcollcode}', '{$this->candidate_name}',
			'{$this->father_name}','{$this->mother_name}','{$this->roll_number}','{$this->dob}','{$this->gender}', 
			'{$this->category}', '{$nation}', '{$this->moi}','{$this->comm_addr1}',
			'{$this->comm_addr2}','{$this->comm_addr3}','{$this->comm_addr4}','{$this->per_addr1}',
			'{$this->per_addr2}','{$this->per_addr3}','{$this->per_addr4}','{$photo_path}',
			'{$this->Religion}', '{$this->father_Occupation}','{$this->mother_Occupation}',
			'{$this->email_id}','{$this->contact_no}','{$this->Blood_Groop}', NOW(),'F',
			'{$app_no}','{$this->draftno}','{$this->regnno}','{$state}','{$univname}'
			,'{$leval}','{$this->year}','{$this->rollno}','{$this->percentage}','{$this->Division}'
			,'{$FQUALINS}','{$this->amount}','{$this->payment_type}','{$this->admfee}','{$this->dcfee}','{$this->mcfee}')"; 
			
			$lobj_rs = $this->aobj_context->mobj_db->Execute($lquery);

			if($lobj_rs)
			{
				for($k=0;$k<count($sub_arr_data);$k++)
				{
					$insert_options ="insert into `options`(FDEGREE,FEXAMNO,FCOLLCODE,FSLNO,FSUBCODE,FDELETED,FAPPNO,FHONOUR)
					values('{$this->fdegree}','{$exm}', '{$this->fcollcode}','{$degree_slno}',
					'{$sub_arr_data[$k]->sub_code}','F','{$app_no}','{$this->honours}')";
					$lobj_insert_options = $this->aobj_context->mobj_db->Execute($insert_options);
				}
			}
		
			if($lobj_rs) 
			{
				$data='Student Record inserted Successfully';
				$arr['message']=$data;
				$arr['app_no']=$app_no;
				$arr['fslno']=$degree_slno;
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
				return;
			}	
			else
			{
				$arr='Insertion Failed';					 
				echo $this->aobj_context->mobj_output->ToJSONEnvelope($lquery,-1,"failure"); 
				return;
			}

	}

	function getcollname()
	{		
		$this->lstr_query_string=trim($this->aobj_context->mobj_data["lstr_query_string"]);
		
		if($this->lstr_query_string == 'ug')
		{	
			$cond = "where fcollcode in('1001',
			'1001',
			'1001',
			'1001',
			'1001',
			'1002',
			'1002',
			'1002',
			'1003',
			'1003',
			'1003',
			'1004',
			'1006',
			'1009',
			'1011',
			'1012',
			'1012',
			'1013',
			'1014',
			'1014',
			'1014',
			'1015',
			'1016',
			'1016',
			'1017',
			'1018',
			'1019')";
		}

		if($this->lstr_query_string == 'suug')
		{	
			$cond = "where fcollcode in(
			'P007',
			'P007',
			'P018',
			'P034',
			'P034')";
		}
		
		if($this->lstr_query_string == 'pg')
		{	
			$cond = "where fcollcode in(
			'1007',
			'1007',
			'1008',
			'1008',
			'1009',
			'1010',
			'1018',
			'E001',
			'E002',
			'E003',
			'E004',
			'E005',
			'E006',
			'E007',
			'E008',
			'E009',
			'E010',
			'E011',
			'E012')";
		}	

		if($this->lstr_query_string == 'supg')
		{	
			$cond = "where fcollcode in('P002',
			'P003',
			'P004',
			'P007',
			'P007',
			'P016',
			'P018',
			'P022',
			'P022',
			'P023',
			'P024',
			'P024',
			'P025',
			'P026',
			'P027',
			'P028',
			'P029',
			'P030',
			'P031',
			'P032',
			'P033',
			'P033',
			'P034',
			'P035',
			'P036',
			'P037',
			'P038',
			'P039',
			'P040',
			'P041',
			'P042',
			'P043',
			'P044',
			'P045',
			'P046',
			'P047')";
		}	
	
		if($this->lstr_query_string == 'mphil')
		$cond = "where fcollcode in('1008')";

		if($this->lstr_query_string == 'sumphil')
		{
			$cond = "where fcollcode in('P002',
			'P002',
			'P003',
			'P003',
			'P004',
			'P007',
			'P007',
			'P016',
			'P018',
			'P018',
			'P022',
			'P022',
			'P023',
			'P024',
			'P025',
			'P025',
			'P026',
			'P026',
			'P027',
			'P027',
			'P028',
			'P029',
			'P030',
			'P030',
			'P031',
			'P032',
			'P033',
			'P035',
			'P036',
			'P037',
			'P037',
			'P038',
			'P040',
			'P040',
			'P041',
			'P041',
			'P042',
			'P042',
			'P043',
			'P043',
			'P044')";
		}	

		

		if($this->lstr_query_string == 'lat'){
			$cond = "where fcollcode in('1009','1015','1016')";

		}
		
		
		
		$lquery = "SELECT FCOLLCODE AS int_code,
				   CONCAT(FCOLLNAME,', ',FTOWN,' - ',FCOLLCODE) AS val FROM college
				   {$cond} 
				   order by FCOLLNAME";
		//var_dump($lquery);		   
		$tempres = $this->aobj_context->mobj_db->GetAll($lquery);
		$arr['college']=$tempres;
		
		$lquery = "SELECT FCATEGORY AS int_code,
				   CONCAT(FDESCPN,' - ',FCATEGORY) AS val FROM category where fdeleted <> 'T'";
		$tempres=$this->aobj_context->mobj_db->GetAll($lquery);
		$arr['category']=$tempres;
		
		$lquery = "SELECT FSTATENAME AS int_code, FSTATENAME AS val FROM masstate ";
		$tempres = $this->aobj_context->mobj_db->GetAll($lquery);
		$arr['statename']=$tempres;
		
		$lquery = "SELECT CONCAT(FCOLLNAME,', ',FTOWN) AS int_code,
				   CONCAT(FCOLLNAME,', ',FTOWN) AS val FROM college
				   where FCOLLCODE not like '9%' and FCOLLCODE not in ('P001','P005','P006','P008','P009','P010','P011','P012','P013','P014','P015'
				   ,'P019','P017','P020','P021','U001') order by fcollcode";
				   
		$tempres = $this->aobj_context->mobj_db->GetAll($lquery);
		$arr['lastinst']=$tempres;
		
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	
	function getdegname($aobj_context)
	{
		$this->fcollcode=trim($this->aobj_context->mobj_data["fcollcode"]);
		$this->deggrp=trim($this->aobj_context->mobj_data["deggrp"]);
		$cnd = "";

		if($this->deggrp == 'ug' || $this->deggrp == 'suug')
		{
			$cnd = "and (colldeg.fdegree like 'b%'  or colldeg.fdegree like 'l%' or colldeg.fdegree like 'c%') and  colldeg.fdegree not like 'bed%'";
		}

		if($this->deggrp == 'pg' || $this->deggrp == 'supg' )
		{
			$cnd = "and (colldeg.fdegree like 'm%' or  colldeg.fdegree like 'p%' or  colldeg.fdegree like 'bed%' or  colldeg.fdegree like 'llm%' or  colldeg.fdegree like 'ttm%') and colldeg.fdegree not like 'mpl%' and colldeg.fdegree not like 'phd%'
			and colldeg.fdegree not like 'ph%'";
		}

		if($this->deggrp == 'mphil' || $this->deggrp == 'sumphil')
		{
			$cnd = "and (colldeg.fdegree like 'mpl%' or colldeg.fdegree like 'phd%' or colldeg.fdegree like 'ph%')";
		}

		if($this->deggrp == 'lat' &&  ($this->fcollcode == '1009' || $this->fcollcode == '1015') )
		{
			$cnd = "and (colldeg.fdegree like 'b%')";
		}


		/* $lsql="SELECT DISTINCT colldeg.FDEGREE AS int_code,
		CONCAT(degree.FDESCPN,' - ',colldeg.FDEGREE) AS val FROM degree,colldeg 
		WHERE degree.FDEGREE = colldeg.FDEGREE AND colldeg.fcollcode = '{$this->fcollcode}' 
		and degree.fadmdeg = 'T'"; */
		
		$lsql="SELECT DISTINCT colldeg.FDEGREE AS int_code,
		concat(colldeg.FDEGREE,' - ',degree.FDESCPN) AS val FROM degree,colldeg 
		WHERE degree.FDEGREE = colldeg.FDEGREE AND colldeg.fcollcode = '{$this->fcollcode}' and colldeg.FDELETED <> 'T'
		and degree.fadmdeg = 'T' $cnd"; 
		//var_dump($lsql);
		$up_obj=$this->aobj_context->mobj_db->GetAll($lsql);
	    $arr['degree']=$up_obj;
		
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	
	function checkregno($aobj_context)
	{
		$this->roll_number=trim($this->aobj_context->mobj_data["roll_number"]);
		//var_dump($this->fcollcode);
		/* $lsql="SELECT DISTINCT colldeg.FDEGREE AS int_code,
		CONCAT(degree.FDESCPN,' - ',colldeg.FDEGREE) AS val FROM degree,colldeg 
		WHERE degree.FDEGREE = colldeg.FDEGREE AND colldeg.fcollcode = '{$this->fcollcode}' 
		and degree.fadmdeg = 'T'"; */
		
		$lsql="SELECT fname,fdegree,fcollcode,frollno,
		date_format(fdob,'%d/%m/%Y') as fdob 
		from studadm where frollno = '{$this->roll_number}' and fdeleted <> 'T'"; 
		
		$results = $this->aobj_context->mobj_db->GetRow($lsql);	
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($results,0,"success"); 
		return;
	}
	

	function checkadmfee($aobj_context)
	{
		$this->fdegree=trim($this->aobj_context->mobj_data["fdegree"]);
		$this->fcollcode=trim($this->aobj_context->mobj_data["fcollcode"]);
		//var_dump($this->fcollcode);
		/* $lsql="SELECT DISTINCT colldeg.FDEGREE AS int_code,
		CONCAT(degree.FDESCPN,' - ',colldeg.FDEGREE) AS val FROM degree,colldeg 
		WHERE degree.FDEGREE = colldeg.FDEGREE AND colldeg.fcollcode = '{$this->fcollcode}' 
		and degree.fadmdeg = 'T'"; */
		
		$lsql="select ifnull(fadmfee,'') as fadmfee 
		from colldeg where fdegree = '{$this->fdegree}' and fcollcode = '{$this->fcollcode}';"; 
		
		$results = $this->aobj_context->mobj_db->GetRow($lsql);	
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($results,0,"success"); 
		return;
	}
	
	function disp_sub($aobj_context)
	{
		$this->fdegree=trim($this->aobj_context->mobj_data["fdegree"]);
		$this->fcollcode=trim($this->aobj_context->mobj_data["fcollcode"]);
		$this->fdeggrp=trim($this->aobj_context->mobj_data["fdeggrp"]);

		if($this->fdeggrp =='lat'){
			$exm = 'C';
		}else{
			$exm = 'A';
		}
	
		$lquery=" select FTOTSUB from degree 
		where FDEGREE= '{$this->fdegree}' and FEXAMNO='{$exm}'";

		// var_dump($lquery);
		
		$tempres=$this->aobj_context->mobj_db->GetRow($lquery);
		$total_sub=$tempres['FTOTSUB'];
		
		$lquery="select FSUBCODE,FSUBNAME,FSUBSHORT ,FMANDATORY from degree d 
				 inner join subject s on s.FDEGREE=d.FDEGREE and d.FEXAMNO=s.FEXAMNO
				 where d.FDEGREE='{$this->fdegree}' and s.FEXAMNO='{$exm}' and 
				 FMANDATORY='T' group by  FSUBCODE order by FSUBNAME";	
		$get_true_sub_names = $this->aobj_context->mobj_db->getAll($lquery);
		
		$remaining_count=$total_sub-count($get_true_sub_names);
	if($this->fdegree == 'BA18' || $this->fdegree == 'BSC18')
			$colspan='4';
		else
			$colspan='3';
		
		$e_data.="<div class='tabscroll'><table class='tr_ventor_row'  cellspacing='1' cellpadding='0' border='1' >";
		$e_data.="<th align='left' colspan = {$colspan} class='ui-jqgrid-titlebar ui-widget-header ui-corner-tl ui-corner-tr ui-helper' 
					style='font-size:14px; background-color:#4d90fe; color:#FFF;padding-left:6px;clore:white; height:24px;'> Papers Appearing (For any extra paper entries select paper as ‘DUMMY’ from paper drop down list)</th>";
		$e_data.="<tr >";
		if($this->fdegree == 'BA18' || $this->fdegree == 'BSC18')
		{
			$e_data.="<td  style='padding:2px;  border-right:1px solid #C5DBEC; 
					border-bottom:1px solid #C5DBEC;font-size:14px;'><center>Honours Subject<br>(Mandatory only for BA and BSC courses)</center></td>";			
		}
		$e_data.="<td  style='padding:2px; width:300px; border-left:1px solid #C5DBEC; border-right:1px solid #C5DBEC; 
					border-bottom:1px solid  #C5DBEC; font-size:14px;'><center>Paper Name (*If using mobile phone, 
					rotate screen to view full table)</center></td>";
		$e_data.="<td  style='padding:2px;  border-right:1px solid #C5DBEC;  
					border-bottom:1px solid #C5DBEC;font-size:14px;'><center>Paper Code</td>";
		$e_data.="<td  style='padding:2px;  border-right:1px solid #C5DBEC; 
					border-bottom:1px solid #C5DBEC;font-size:14px;'><center>Short Name</center></td>";
		
		$e_data.="</tr>";
		$k=0;
		$id=0;	
		foreach($get_true_sub_names as $key=>$value)
		{
			 $e_data.="<tr style='font-size:12px;' class='ui-widget-content jqgrow'>";
			 if($this->fdegree == 'BA18' || $this->fdegree == 'BSC18')
				$e_data.="<td class='tbl_row_new' id='honours' align='center'  style='border-right:1px solid #C5DBEC; padding:2px;'><input type='checkbox' tabindex=-1  disabled name = 'honour'  style = 'border:none;align:center;' id='honours_{$id}' onclick = 'CMS.checkhonours(this.id)' value='' ></td>";
			 $e_data.="<td class='tbl_row_new'  align='center' style='border-left:1px solid #C5DBEC; 
						text-align:center;border-right:1px solid #C5DBEC; padding:2px;'><input  tabindex=-1  {$inp_class} type=text style='border:none;width:400px;' readonly id='se_sub_code_{$id}' value='{$value[FSUBNAME]}'></td>";
			 $e_data.="<td class='tbl_row_new' align='center' style='border-right:1px solid #C5DBEC;
						padding:2px;'><input type=text style='border:none;' {$inp_class}  tabindex=-1  readonly id='fsubcode_{$id}' value='{$value[FSUBCODE]}'></td>";
			 $e_data.="<td  class='tbl_row_new' style='border-right:1px solid #C5DBEC; 
						padding:2px;'><input type=text style='border:none;' {$inp_class} id='se_sub_name_{$id}'  tabindex=-1   readonly value='{$value[FSUBSHORT]}'> </td>";
			
			 $e_data.="</tr>";
			 $k++;
			 $id++;
		}
		$name=''; 	
		$lquery="select distinct FSUBCODE,CONCAT(FSUBSHORT,' - ',FSUBNAME) AS FSUBNAME ,FMANDATORY from degree d 
				 inner join subject s on s.FDEGREE=d.FDEGREE and d.FEXAMNO=s.FEXAMNO
				 where d.FDEGREE='{$this->fdegree}' and s.FEXAMNO='{$exm}' and 
				 FMANDATORY='F' group by  FSUBCODE order by FSUBNAME";
				
		$lobj_last_slno_execution = $this->aobj_context->mobj_db->getAll($lquery);	
		$option="";
		$option.="<option value='none'>Select Subject</option>"; 
		foreach($lobj_last_slno_execution as $key=>$value)
		{
			$option.="<option style = 'width:400px;' value={$value[FSUBCODE]} >{$value[FSUBNAME]}</option>";
		}	

		for($j=0;$j<$remaining_count;$j++)
		{				 
			if($k%2==0)
			{
				$class='tbl_row';
				$inp_class='tbl_row_input';
			}
			else
			{
				$input_class='tbl_row1'; 
				$inp_class='tbl_row1_input';
			}  
			if($j==0)
				$name="name='focus'";
			else
				$name='';
		
			$e_data.="<tr style='font-size:12px;'  >";
			if($this->fdegree == 'BA18' || $this->fdegree == 'BSC18')
				$e_data.="<td class='tbl_row_new' id='honours' align='center'  style='border-right:1px solid #C5DBEC; padding:2px;'><input type='checkbox' tabindex=-1  name = 'honour'  style = 'border:none;align:center;' id='honours_{$id}' onclick = 'CMS.checkhonours(this.id)' value='' ></td>";
			$e_data.="<td class='tbl_row_new'   align='center' style='border-left:1px;width:400px; solid #C5DBEC; border-right:1px solid #C5DBEC; padding:1px;'><select style = 'width:400px;' id='fsubname_{$id}' class='subname' onchange= 'CMS.getsubcode(this.id,this.value);' class='form-control'>{$option}</select> </td>";
			$e_data.="<td class='tbl_row_new'  id='fsubcode' align='center'   style='border-right:1px solid #C5DBEC;  padding:2px;'><input type='text'  tabindex=-1  readonly style = 'border:none;' id='fsubcode_{$id}' value=''  ></td>";
			$e_data.="<td class='tbl_row_new' id='fsubshort'  style='border-right:1px solid #C5DBEC; padding:2px;'><input type='text' tabindex=-1  readonly  style = 'border:none;' id='fsubshort_{$id}' value=''  ></td>";
			
			$e_data.="</tr>";
			$k++;
			$id++;
		} 	
		
		$e_data.="</table><div>";
		$arr['html']=$e_data;
		$arr['table_data']=$get_true_sub_names;
		$arr['remaining_count']=$remaining_count;
		$arr['total_count']=$id;

		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success"); 
		return;
	}
	
	function ValidatePrintCertificateApplicationData()
	{
		$candidate_name=trim($this->aobj_context->mobj_data["candidate_name"]);
		$dob=trim($this->aobj_context->mobj_data["dob"]);
		$app_no=trim($this->aobj_context->mobj_data["app_no"]);
		$qry="SELECT  FAPPNO,ifnull(FPAYMENTSTATUS,'') as FPAYMENTSTATUS,famount from studadm
			WHERE FDOB='{$dob}' AND FAPPNO='{$app_no}'";
		$up_obj=$this->aobj_context->mobj_db->GetRow($qry);
		$FAPPNO=$up_obj['FAPPNO'];
		$FPAYMENTSTATUS = $up_obj['FPAYMENTSTATUS'];
		$famount = $up_obj['famount'];		

		if(empty($FAPPNO))
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
		else
		{
			$arr['app_no']=$FAPPNO;
			$arr['FPAYMENTSTATUS']=$FPAYMENTSTATUS;
			$arr['famount']=$famount;			
			echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
		}	
	}	

	function getsubcode($aobj_context)
	{
		$this->fsubname=trim($this->aobj_context->mobj_data["fsubname"]);
		$this->fdegree=trim($this->aobj_context->mobj_data["fdegree"]);
		$this->fdeggrp=trim($this->aobj_context->mobj_data["fdeggrp"]);

		if($this->fdeggrp =='lat'){
			$exm = 'C';
		}else{
			$exm = 'A';
		}
		
		$lquery ="select distinct FSUBCODE,FSUBSHORT from degree d 
				 inner join subject s on s.FDEGREE=d.FDEGREE and d.FEXAMNO=s.FEXAMNO
				 where s.fsubcode='{$this->fsubname}' and s.FEXAMNO='{$exm}' and d.fdegree = '{$this->fdegree}'";
		$tempres=$this->aobj_context->mobj_db->GetRow($lquery);
		$arr['FSUBCODE']=$tempres['FSUBCODE'];
		$arr['FSUBSHORT']=$tempres['FSUBSHORT'];
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
	}
	
	function GetpaymentLinkForAppNo()
	{
		$app_no=trim($this->aobj_context->mobj_data["app_no"]);
		$fslno=trim($this->aobj_context->mobj_data["fslno"]);	
		$fcollcode=trim($this->aobj_context->mobj_data["fcollcode"]);
		$fdegree=trim($this->aobj_context->mobj_data["fdegree"]);
		$fpaymenttype=trim($this->aobj_context->mobj_data["fpaymenttype"]);
		$famount=trim($this->aobj_context->mobj_data["famount"]);
		
		if($fpaymenttype == 'DEBIT/CREDIT/NET BANKING' &&  $famount >0)
		{
			$html=' <div style="text-align:center;margin-top:150px">	<h2 class="col-md-offset-1" style="color:green;text-align:center;"> Successfully Applied. Your Application No. is - '.$app_no.' <br>Please Keep this number for all future correspondance with University.</h2> 
						<h2 style="color:green;text-align:center;margin-left:100px"><u>Please click below to take printout and submit to College or Department</u><div class="form-group">
												<button class="btn blue" onclick=\'CMS.MakeOnlinePayment("'.$app_no.'");\' type="button"><i class="fa fa-tasks"></i> Make Payment</button>	
										</div> </h2>
					</div>';
			
		}else
		{		
	
			$html=' <div style="text-align:center;margin-top:150px">	<h2 class="col-md-offset-1" style="color:green;text-align:center;"> Successfully Applied. Your Application No. is - '.$app_no.' <br>Please Keep this number for all future correspondance with University.</h2> 
						<h2 style="color:green;text-align:center;margin-left:100px"><u>Please click below to take printout and submit to College or Department</u><div class="form-group">
												<button class="btn blue" onclick=\'CMS.applicationForm("'.$app_no.'","'.$fcollcode.'","'.$fdegree.'","'.$fslno.'");\' type="button"><i class="fa fa-tasks"></i> Print Application</button>	
										</div> </h2>
					</div>';
		}		
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($html,0,"success"); 
		return;
	}	
	
	function getappno()
	{
		$approllno = trim($this->aobj_context->mobj_data["approllno"]);
		
		$lquery ="select fappno from studadm where frollno = '{$approllno}' and fdeleted <> 'T'";
		$tempres=$this->aobj_context->mobj_db->GetRow($lquery);
		$result = $tempres['fappno'];
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
	}
	function getprefix()
	{
		$fcollcode = trim($this->aobj_context->mobj_data["fcollcode"]);
		$fdegree = trim($this->aobj_context->mobj_data["fdegree"]);
		$deggrp = trim($this->aobj_context->mobj_data["deggrp"]);
		
		$lquery ="select ifnull(fprefix,'') as fprefix 
		from colldeg where fcollcode = '{$fcollcode}' and fdegree = '{$fdegree}'";
		$tempres=$this->aobj_context->mobj_db->GetRow($lquery);

		if($deggrp == 'lat' && $fcollcode == '1009' && $fdegree =='BPH17'){
			$result = '20HPH';	
		}elseif($deggrp == 'lat' && $fcollcode == '1015' && $fdegree =='BPH17'){
			$result = '20GPC';	
		}elseif($deggrp == 'lat' && $fcollcode == '1016' && $fdegree =='CSE20'){
			$result = '20CSEC';	
		}elseif($deggrp == 'lat' && $fcollcode == '1016' && $fdegree =='CVL20'){
			$result = '20CVLC';	
		}else{
			$result = $tempres['fprefix'];
		}



		// var_dump($tempres);
		
		echo $this->aobj_context->mobj_output->ToJSONEnvelope($result,0,"success");
	}
		
}
function GetpaymentLinkForAppNo($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->GetpaymentLinkForAppNo();
}
function ValidatePrintCertificateApplicationData($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->ValidatePrintCertificateApplicationData();
}
function getcollname($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->getcollname();
}
function getdegname($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->getdegname();
}

function getsubcode($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->getsubcode();
}

function checkregno($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->checkregno();
}
function checkadmfee($aobj_context)
{ 
$obj=new applicationForm($aobj_context);
$obj->checkadmfee();
}

function disp_sub($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->disp_sub();
}

function SavestudentDetails($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->SavestudentDetails();
}
function getappno($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->getappno();
}
function getprefix($aobj_context)
{ 
	$obj=new applicationForm($aobj_context);
	$obj->getprefix();
}
function DiaplayUserSelectedPhoto($aobj_context)
{
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC); 
	session_start();
	 
	 
	$folder_path=$aobj_context->main_src."/student_photos/";
	$file_name=replaceChars(basename($_FILES['student_entry_upload']['name']));
	$path_arr=pathinfo($_FILES['student_entry_upload']['name']);
	$file_ext=$path_arr['extension'];
	//var_dump($file_ext);
	$temp_path = $aobj_context->main_src."/student_photos/temp";
	if(!file_exists($temp_path))
	{
		mkdir($temp_path);
	}
	$file_path="/{$collcode}_{$user_id}_{$file_name}";
 	$temp_path.=$file_path;

	//var_dump($imsize);
		if(isset($_FILES['student_entry_upload']['name']) && $_FILES['student_entry_upload']['name'] != '')         
		{ 
		$size=($_FILES['student_entry_upload']['size']/1024);
		if($size>1024)
		{
		$data="Please Upload the Photo of size less than 1 MB";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,-2,"success"); 
			return;
		}
		if(move_uploaded_file($_FILES['student_entry_upload']['tmp_name'],$temp_path))
		{
			$data="student_photos/temp/{$file_path}";
			echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success"); 
			return;
		}
			}
			//echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure"); 
				//return;	
}

function replaceChars($name)
{
	$spl_char = array("*","/","~","!","@","#","$","%","^","&",":",";","?","/","\\","_","-","'"," ","");
	$link_name = strtolower(str_replace($spl_char,"_",$name));
	return str_ireplace("__","_",$link_name);
}

?>