<?php
class feedback_que_resultMgmt
{
	public $result_id;
	public $student_id;
	public $employee_id;
	public $subject_id;
	public $que_ids;
	public $answer_arr;
	public $login_id;
	public $createdon;


	function getAllRecords($limit = 0, $start = 0, $condition = "", $order_field = "", $order_type = "")
	{
		$qry = "SELECT * FROM feedback_que_result";

		if ($condition != "") {
			$qry .= $condition;
		}
		if ($order_field != "" && $order_type != "") {
			$qry .= " order by $order_field $order_type";
		}

		if (intval($limit) > 0 && intval($start) >= 0) {
			$qry .= " Limit $start , $limit";
		}

		$out = dbQuery($qry);
		if (dbRows($out) > 0) {
			return $out;
		}
		return $out;
	}


	function add()
	{
		$Qry1 = "";
		$Qry1 .= "result_id   ='" . Escape($this->result_id) . "',";
		$Qry1 .= "student_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "employee_id   ='" . Escape($this->employee_id) . "',";
		$Qry1 .= "subject_id   ='" . Escape($this->subject_id) . "',";
		$Qry1 .= "que_ids   ='" . Escape($this->que_ids) . "',";
		$Qry1 .= "answer_arr   ='" . Escape($this->answer_arr) . "',";
		$Qry1 .= "login_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "createdon   ='" . Escape(date('Y-m-d h:i:s')) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into feedback_que_result set " . $Qry1 . " ";
			dbQuery($qry);
			$this->result_id = dbInsertedId();
		}

	}

	function edit()
	{
		$Qry1 = "";
		$Qry1 .= "result_id   ='" . Escape($this->result_id) . "',";
		$Qry1 .= "student_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "employee_id   ='" . Escape($this->employee_id) . "',";
		$Qry1 .= "subject_id   ='" . Escape($this->subject_id) . "',";
		$Qry1 .= "que_ids   ='" . Escape($this->que_ids) . "',";
		$Qry1 .= "answer_arr   ='" . Escape($this->answer_arr) . "',";
		$Qry1 .= "login_id   ='" . Escape($this->student_id) . "',";
		$Qry1 .= "createdon   ='" . Escape($this->createdon) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update feedback_que_result set " . $Qry1 . " where  result_id=" . $this->result_id;
			dbQuery($qry);
		}

	}


	function delete()
	{
		$qry = "delete from feedback_que_result where result_id in (" . $this->result_id . ") ";
		dbQuery($qry);
	}





}/* Code For EXTJS START \n{
xtype: 'textfield',
name: 'result_id',
id:'result_id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'result_id:',
width:100
},
{
xtype: 'textfield',
name: 'student_id',
id:'student_id',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'student_id:',
width:100
},
{
xtype: 'textfield',
name: 'que_ids',
id:'que_ids',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'que_ids:',
width:100
},
{
xtype: 'textfield',
name: 'answer_arr',
id:'answer_arr',
allowBlank:false,
tabIndex:4,
labelSeparator:'',
fieldLabel :'answer_arr:',
width:100
},
{
xtype: 'textfield',
name: 'login_id',
id:'login_id',
allowBlank:false,
tabIndex:5,
labelSeparator:'',
fieldLabel :'login_id:',
width:100
},
{
xtype: 'textfield',
name: 'createdon',
id:'createdon',
allowBlank:false,
tabIndex:6,
labelSeparator:'',
fieldLabel :'createdon:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objfeedback_que_resultMgmt= new feedback_que_resultMgmt();
$objfeedback_que_resultMgmt->result_id=$_POST['result_id'];
$objfeedback_que_resultMgmt->student_id=$_POST['student_id'];
$objfeedback_que_resultMgmt->que_ids=$_POST['que_ids'];
$objfeedback_que_resultMgmt->answer_arr=$_POST['answer_arr'];
$objfeedback_que_resultMgmt->login_id=$_POST['login_id'];
$objfeedback_que_resultMgmt->createdon=$_POST['createdon'];
if($objfeedback_que_resultMgmt->result_id == "0" ||  $objfeedback_que_resultMgmt->result_id== ""){ 
$objfeedback_que_resultMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objfeedback_que_resultMgmt->delete();
 }else
 {$objfeedback_que_resultMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

?>