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

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

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



