<?php
class cms_feedbackquestionMgmt
{
	public $id;
	public $collage_id;
	public $feedback_type;
	public $question;
	public $ans_a;
	public $ans_b;
	public $ans_c;
	public $ans_d;
	public $rigth_ans;
	public $active;
	public $login_id;
	public $createdon;


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

		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 .= "id   ='" . Escape($this->id) . "',";
		$Qry1 .= "collage_id   ='" . Escape($this->collage_id) . "',";
		$Qry1 .= "feedback_type   ='" . Escape($this->feedback_type) . "',";
		$Qry1 .= "question   ='" . Escape($this->question) . "',";
		$Qry1 .= "ans_a   ='" . Escape($this->ans_a) . "',";
		$Qry1 .= "ans_b   ='" . Escape($this->ans_b) . "',";
		$Qry1 .= "ans_c   ='" . Escape($this->ans_c) . "',";
		$Qry1 .= "ans_d   ='" . Escape($this->ans_d) . "',";
		$Qry1 .= "rigth_ans   ='" . Escape($this->rigth_ans) . "',";
		$Qry1 .= "active   ='" . Escape($this->active) . "',";
		$Qry1 .= "login_id   ='" . Escape($this->login_id) . "',";
		$Qry1 .= "createdon   ='" . Escape($this->createdon) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "insert into cms_feedbackquestion set " . $Qry1 . " ";
			dbQuery($qry);
			$this->id = dbInsertedId();
		}

	}

	function edit()
	{
		$Qry1 = "";
		$Qry1 .= "id   ='" . Escape($this->id) . "',";
		$Qry1 .= "collage_id   ='" . Escape($this->collage_id) . "',";
		$Qry1 .= "feedback_type   ='" . Escape($this->feedback_type) . "',";
		$Qry1 .= "question   ='" . Escape($this->question) . "',";
		$Qry1 .= "ans_a   ='" . Escape($this->ans_a) . "',";
		$Qry1 .= "ans_b   ='" . Escape($this->ans_b) . "',";
		$Qry1 .= "ans_c   ='" . Escape($this->ans_c) . "',";
		$Qry1 .= "ans_d   ='" . Escape($this->ans_d) . "',";
		$Qry1 .= "rigth_ans   ='" . Escape($this->rigth_ans) . "',";
		$Qry1 .= "active   ='" . Escape($this->active) . "',";
		$Qry1 .= "login_id   ='" . Escape($this->login_id) . "',";
		$Qry1 .= "createdon   ='" . Escape($this->createdon) . "',";
		if ($Qry1 != "") {
			$Qry1 = substr($Qry1, 0, strlen($Qry1) - 1);
			$qry = "update cms_feedbackquestion set " . $Qry1 . " where  id=" . $this->id;
			dbQuery($qry);
		}

	}


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





}/* Code For EXTJS START \n{
xtype: 'textfield',
name: 'id',
id:'id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'id:',
width:100
},
{
xtype: 'textfield',
name: 'collage_id',
id:'collage_id',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'collage_id:',
width:100
},
{
xtype: 'textfield',
name: 'feedback_type',
id:'feedback_type',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'feedback_type:',
width:100
},
{
xtype: 'textfield',
name: 'question',
id:'question',
allowBlank:false,
tabIndex:4,
labelSeparator:'',
fieldLabel :'question:',
width:100
},
{
xtype: 'textfield',
name: 'ans_a',
id:'ans_a',
allowBlank:false,
tabIndex:5,
labelSeparator:'',
fieldLabel :'ans_a:',
width:100
},
{
xtype: 'textfield',
name: 'ans_b',
id:'ans_b',
allowBlank:false,
tabIndex:6,
labelSeparator:'',
fieldLabel :'ans_b:',
width:100
},
{
xtype: 'textfield',
name: 'ans_c',
id:'ans_c',
allowBlank:false,
tabIndex:7,
labelSeparator:'',
fieldLabel :'ans_c:',
width:100
},
{
xtype: 'textfield',
name: 'ans_d',
id:'ans_d',
allowBlank:false,
tabIndex:8,
labelSeparator:'',
fieldLabel :'ans_d:',
width:100
},
{
xtype: 'textfield',
name: 'rigth_ans',
id:'rigth_ans',
allowBlank:false,
tabIndex:9,
labelSeparator:'',
fieldLabel :'rigth_ans:',
width:100
},
{
xtype: 'textfield',
name: 'active',
id:'active',
allowBlank:false,
tabIndex:10,
labelSeparator:'',
fieldLabel :'active:',
width:100
},
{
xtype: 'textfield',
name: 'login_id',
id:'login_id',
allowBlank:false,
tabIndex:11,
labelSeparator:'',
fieldLabel :'login_id:',
width:100
},
{
xtype: 'textfield',
name: 'createdon',
id:'createdon',
allowBlank:false,
tabIndex:12,
labelSeparator:'',
fieldLabel :'createdon:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objcms_feedbackquestionMgmt= new cms_feedbackquestionMgmt();
$objcms_feedbackquestionMgmt->id=$_POST['id'];
$objcms_feedbackquestionMgmt->collage_id=$_POST['collage_id'];
$objcms_feedbackquestionMgmt->feedback_type=$_POST['feedback_type'];
$objcms_feedbackquestionMgmt->question=$_POST['question'];
$objcms_feedbackquestionMgmt->ans_a=$_POST['ans_a'];
$objcms_feedbackquestionMgmt->ans_b=$_POST['ans_b'];
$objcms_feedbackquestionMgmt->ans_c=$_POST['ans_c'];
$objcms_feedbackquestionMgmt->ans_d=$_POST['ans_d'];
$objcms_feedbackquestionMgmt->rigth_ans=$_POST['rigth_ans'];
$objcms_feedbackquestionMgmt->active=$_POST['active'];
$objcms_feedbackquestionMgmt->login_id=$_POST['login_id'];
$objcms_feedbackquestionMgmt->createdon=$_POST['createdon'];
if($objcms_feedbackquestionMgmt->id == "0" ||  $objcms_feedbackquestionMgmt->id== ""){ 
$objcms_feedbackquestionMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objcms_feedbackquestionMgmt->delete();
 }else
 {$objcms_feedbackquestionMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

?>