<?php 
 class    lms_operatorMgmt
{ 
public  $operator_id;
public  $operator_name;
public  $operator_address;
public  $operator_phone;
public  $operator_mobile;
public  $operator_email;
public  $operator_panno;
public  $operator_aadharno;
public  $operator_otherid;
public  $operator_joindate;
public  $operator_photo;
public  $company_id;


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

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 .= "operator_id   ='"  .Escape($this->operator_id)."',";
$Qry1 .= "operator_name   ='"  .Escape($this->operator_name)."',";
$Qry1 .= "operator_address   ='"  .Escape($this->operator_address)."',";
$Qry1 .= "operator_phone   ='"  .Escape($this->operator_phone)."',";
$Qry1 .= "operator_mobile   ='"  .Escape($this->operator_mobile)."',";
$Qry1 .= "operator_email   ='"  .Escape($this->operator_email)."',";
$Qry1 .= "operator_panno   ='"  .Escape($this->operator_panno)."',";
$Qry1 .= "operator_aadharno   ='"  .Escape($this->operator_aadharno)."',";
$Qry1 .= "operator_otherid   ='"  .Escape($this->operator_otherid)."',";
$Qry1 .= "operator_joindate   ='"  .Escape($this->operator_joindate)."',";
$Qry1 .= "operator_photo   ='"  .Escape($this->operator_photo)."',";
$Qry1 .= "company_id   ='"  .Escape($this->company_id)."',";
if($Qry1 != ""){
$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
$qry = "insert into lms_operator set " . $Qry1 . " ";
dbQuery($qry);
$this->operator_id=dbInsertedId();
} 

}

function edit(){
 $Qry1 = "";
$Qry1 .= "operator_id   ='"  .Escape($this->operator_id)."',";
$Qry1 .= "operator_name   ='"  .Escape($this->operator_name)."',";
$Qry1 .= "operator_address   ='"  .Escape($this->operator_address)."',";
$Qry1 .= "operator_phone   ='"  .Escape($this->operator_phone)."',";
$Qry1 .= "operator_mobile   ='"  .Escape($this->operator_mobile)."',";
$Qry1 .= "operator_email   ='"  .Escape($this->operator_email)."',";
$Qry1 .= "operator_panno   ='"  .Escape($this->operator_panno)."',";
$Qry1 .= "operator_aadharno   ='"  .Escape($this->operator_aadharno)."',";
$Qry1 .= "operator_otherid   ='"  .Escape($this->operator_otherid)."',";
$Qry1 .= "operator_joindate   ='"  .Escape($this->operator_joindate)."',";
$Qry1 .= "operator_photo   ='"  .Escape($this->operator_photo)."',";
$Qry1 .= "company_id   ='"  .Escape($this->company_id)."',";
if($Qry1 != ""){ 
$Qry1 = substr($Qry1, 0, strlen($Qry1)-1);
$qry = "update lms_operator set " . $Qry1 . " where  operator_id=".$this->operator_id;
dbQuery($qry);
}

 } 


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





}/* Code For EXTJS START \n{
 xtype: 'textfield',
name: 'operator_id',
id:'operator_id',
allowBlank:false,
tabIndex:1,
labelSeparator:'',
fieldLabel :'operator_id:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_name',
id:'operator_name',
allowBlank:false,
tabIndex:2,
labelSeparator:'',
fieldLabel :'operator_name:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_address',
id:'operator_address',
allowBlank:false,
tabIndex:3,
labelSeparator:'',
fieldLabel :'operator_address:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_phone',
id:'operator_phone',
allowBlank:false,
tabIndex:4,
labelSeparator:'',
fieldLabel :'operator_phone:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_mobile',
id:'operator_mobile',
allowBlank:false,
tabIndex:5,
labelSeparator:'',
fieldLabel :'operator_mobile:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_email',
id:'operator_email',
allowBlank:false,
tabIndex:6,
labelSeparator:'',
fieldLabel :'operator_email:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_panno',
id:'operator_panno',
allowBlank:false,
tabIndex:7,
labelSeparator:'',
fieldLabel :'operator_panno:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_aadharno',
id:'operator_aadharno',
allowBlank:false,
tabIndex:8,
labelSeparator:'',
fieldLabel :'operator_aadharno:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_otherid',
id:'operator_otherid',
allowBlank:false,
tabIndex:9,
labelSeparator:'',
fieldLabel :'operator_otherid:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_joindate',
id:'operator_joindate',
allowBlank:false,
tabIndex:10,
labelSeparator:'',
fieldLabel :'operator_joindate:',
width:100
},
{
 xtype: 'textfield',
name: 'operator_photo',
id:'operator_photo',
allowBlank:false,
tabIndex:11,
labelSeparator:'',
fieldLabel :'operator_photo:',
width:100
},
{
 xtype: 'textfield',
name: 'company_id',
id:'company_id',
allowBlank:false,
tabIndex:12,
labelSeparator:'',
fieldLabel :'company_id:',
width:100
},
Code For EXTJS END */




/* Code For Save File START 


$objlms_operatorMgmt= new lms_operatorMgmt();
$objlms_operatorMgmt->operator_id=$_POST['operator_id'];
$objlms_operatorMgmt->operator_name=$_POST['operator_name'];
$objlms_operatorMgmt->operator_address=$_POST['operator_address'];
$objlms_operatorMgmt->operator_phone=$_POST['operator_phone'];
$objlms_operatorMgmt->operator_mobile=$_POST['operator_mobile'];
$objlms_operatorMgmt->operator_email=$_POST['operator_email'];
$objlms_operatorMgmt->operator_panno=$_POST['operator_panno'];
$objlms_operatorMgmt->operator_aadharno=$_POST['operator_aadharno'];
$objlms_operatorMgmt->operator_otherid=$_POST['operator_otherid'];
$objlms_operatorMgmt->operator_joindate=$_POST['operator_joindate'];
$objlms_operatorMgmt->operator_photo=$_POST['operator_photo'];
$objlms_operatorMgmt->company_id=$_POST['company_id'];
if($objlms_operatorMgmt->operator_id == "0" ||  $objlms_operatorMgmt->operator_id== ""){ 
$objlms_operatorMgmt->add(); 
} 
else{
if($_REQUEST[act] == "del")
 {$objlms_operatorMgmt->delete();
 }else
 {$objlms_operatorMgmt->edit();
}
echo'{"success":"true"}'; 
 }

Code For Save File END */

  ?>