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

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

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



