<?php 
 class    lms_bookregisterMgmt
{ 
public  $register_id;
public  $register_name;
public  $blnBackup;


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

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;
}


function add(){
$Qry1 = "";
$Qry1 .= "register_id   ='"  .Escape($this->register_id)."',";
$Qry1 .= "register_name   ='"  .Escape($this->register_name)."',";
$Qry1 .= "blnBackup   ='"  .Escape($this->blnBackup)."',";
if($Qry1 != ""){
$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
$qry = "insert into lms_bookregister set " . $Qry1 . " ";
dbQuery($qry);
$this->register_id=dbInsertedId();
} 

}

function edit(){
 $Qry1 = "";
$Qry1 .= "register_id   ='"  .Escape($this->register_id)."',";
$Qry1 .= "register_name   ='"  .Escape($this->register_name)."',";
$Qry1 .= "blnBackup   ='"  .Escape($this->blnBackup)."',";
if($Qry1 != ""){ 
$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
$qry = "update lms_bookregister set " . $Qry1 . " where  register_id=".$this->register_id;
dbQuery($qry);
}

 } 


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





}/* Code For EXTJS START \n{
 xtype: 'textfield',
name: 'register_id',
id:'register_id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'register_id:',
width:100
},
{
 xtype: 'textfield',
name: 'register_name',
id:'register_name',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'register_name:',
width:100
},
{
 xtype: 'textfield',
name: 'blnBackup',
id:'blnBackup',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'blnBackup:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objlms_bookregisterMgmt= new lms_bookregisterMgmt();
$objlms_bookregisterMgmt->register_id=$_POST['register_id'];
$objlms_bookregisterMgmt->register_name=$_POST['register_name'];
$objlms_bookregisterMgmt->blnBackup=$_POST['blnBackup'];
if($objlms_bookregisterMgmt->register_id == "0" ||  $objlms_bookregisterMgmt->register_id== ""){ 
$objlms_bookregisterMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objlms_bookregisterMgmt->delete();
 }else
 {$objlms_bookregisterMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

  ?>