<?php
session_start();
// ============
include("../../php_crud/my_class.php");
$obj=new my_class();
// ============
extract($_POST);
$branchid = $_SESSION['LOGIN_BRANCH'];

// ========================

if($operation=='insert'){
/*foreach($obj->View_colmn_By_Cond("_int_subject","_id,_ct_asign_mark,_ct_pass_mark","_class_id='$class_id' AND _dept_id='$dept_id' AND _status='A' ORDER BY _order_no") as $sub_info){
	extract($sub_info);
	echo "id=".$sub_info['_id']." asign_mark=".$sub_info['_ct_asign_mark'].
		" pass_mark=".$sub_info['_ct_pass_mark']."---";
}*/
$form_data=array(
		
		//'_dep_id'=>$dept_id,
		//'_sub_id'=>$sub_id,
		'_ct_name'=>$ct_name,
		//'_assign_mark'=>$assign_mark,
		'_exam_term'=>$exam_term,
		//'_pass_mark'=>$pass_mark,
		'_status'=>1,
		'_entry_by'=>$_SESSION['LOGIN_USERID'],
		'_br_id'=>$branchid,
		'_entry_date'=>date("Y:m:d h:i:s")
		);

$entry1=$obj->Insert_Data_By_Cond("_ct_class_test_add", $form_data,"_ct_name='$ct_name'");

if($entry1){echo 'Save Success';}
}

if($operation=='update'){

$form_data=array(
		
		//'_dep_id'=>$dept_id,
		//'_sub_id'=>$sub_id,
		'_exam_term'=>$exam_term,
		'_ct_name'=>$ct_name,
		//'_assign_mark'=>$assign_mark,
		//'_pass_mark'=>$pass_mark,
		'_status'=>$ct_status,
		//'_status'=>1,
		'_update_by'=>$_SESSION['LOGIN_USERID'],
		'_br_id'=>$branchid
		);

$update=$obj->update_Data("_ct_class_test_add", $form_data,"_id='$id'");

if($update){echo 'Updated Successfully';}
}

if($operation=='delete'){

     $form_data22=array(
     	'_update_by'=>$_SESSION['LOGIN_USERID'],
		'_status'=>0
		);

	$update=$obj->update_Data("_ct_class_test_add",$form_data22,"_id='$id'");
		
        if($update){
				echo "class test deleted";
			}
			else{
				echo "Failed";
			}
	
}

if($operation=='get_ct_mark'){
	$sub_ct_mark=$obj->Details_By_Cond("_int_subject","_id='$sub_id'");
	$ct_assign_mark=$sub_ct_mark['_ct_asign_mark'];
	$ct_pass_mark=$sub_ct_mark['_ct_pass_mark'];
	
	echo $ct_assign_mark."#".$ct_pass_mark;
}
if($operation=='edit_ct_mark'){
	$sub_ct_mark=$obj->Details_By_Cond("_int_subject","_id='$sub_id'");
	$ct_assign_mark=$sub_ct_mark['_ct_asign_mark'];
	$ct_pass_mark=$sub_ct_mark['_ct_pass_mark'];
	
	echo $ct_assign_mark."#".$ct_pass_mark;
}