<?php
require "commonincludefiles.php";
error_reporting(1);
if ($_SESSION["VedantnrCollegeId"] != "" && isset($_SESSION["VedantnrCollegeId"])) {
	$objattempt = new attemptCertificateMgmt();
	$objattempt->attemptcertificate_id  		= $_REQUEST['attemptcertificate_id'];
	$objattempt->branch_id     		= $_REQUEST['branch_hidden'];
	$objattempt->year_id       		= $_REQUEST['year_hidden'];
	$objattempt->branchyear_id 		= $_REQUEST['branchyear_hidden'];
	$objattempt->semester_id   		= $_REQUEST['semester_hidden'];
    $objattempt->certificate_no 		= $_REQUEST['certificate_no'];
	$objattempt->student_id 			= $_REQUEST['student_hidden'];
	$objattempt->student_gturegno 	= $_REQUEST['student_gturegno'];
	$objattempt->attemptcertificate_date 	= $_REQUEST['attemptcertificate_date'];
	$objattempt->year_class 	= $_REQUEST['year_class'];
	$objattempt->passingyear 	= $_REQUEST['passingyear'];
	$objattempt->noofattempt 	= $_REQUEST['noofattempt'];
	$objattempt->college_id 			    = 	$_SESSION['VedantnrCollegeId'];

	if ($objattempt->attemptcertificate_id == 0 || $objattempt->attemptcertificate_id == "" ) {
		// Add Part
		$objattempt->add();

		if ($objattempt->attemptcertificate_id == 0) {
			echo '{"success":"false","msg":"duplicate"}';
		} else {
			echo '{"success":"true","msg":"success"}';
		}
	
	} else {
		// Edit Part
		$objattempt->edit();
		echo '{"success":"true","msg":"success"}';
	}
} else {
	echo '{"success":"false","msg":"session expiry"}';
}



