<?php 
	class dataOperator extends mysql{
		
		function get_operator_for_login($type,$namaOperator, $Pwd){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT KodeOperator, NamaOperator, Akses, isAktif
					FROM   tboperator
					WHERE  namaOperator = '".$namaOperator."' and Pwd = '".$Pwd."' and isAktif = '1'";
 			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		
		function get_operator_for_login_kode($kolom,$namaOperator, $Pwd){
			if($this->cek_result != "on"){
			$sql = "select * from tboperator WHERE  namaOperator = '".$namaOperator."' and Pwd = '".$Pwd."' and isAktif = '1'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
		
		function get_data_operator_aktif_all($kolom,$a,$type){
			if($type == '') return trim ($this->sql_order_seek($sql,$kolom,$a));
			$sql = "SELECT KodeOperator, NamaOperator, Akses, isAktif
					FROM   tboperator
					WHERE  isAktif = '1'";
							
			$this->query = $this->execute($sql,'');
			if ($type == 'jumlah') return $this->sql_order_count($sql);
		}
		
		function get_operator_single_by_id($kolom,$id){
			if($this->cek_result != "on"){
			$sql = "select * from tboperator where kodeOperator='".$id."'";
			$this->result = $this->execute($sql,'order');
			$this->cek_result = "on";
			return trim($this->result[$kolom]);
			}
				else return trim($this->result[$kolom]);
		}
				
		function add_data_operator($NamaOperator,$Pwd,$Akses){
		    $sql = "call addOperator('".$NamaOperator."','".$Pwd."','".$Akses."')";
		    $this->query = $this-> execute($sql,''); 
		}
		
		function edit_data_operator($KodeOperator, $NamaOperator, $Pwd, $Akses){
		    $sql = "UPDATE tboperator set namaOperator = '".$NamaOperator."', Pwd ='".$Pwd."', Akses = '".$Akses."'
					Where kodeOperator ='".$KodeOperator."'";
		    $this->query = $this-> execute($sql,''); 
		}
		
		function nonaktif_data_operator($KodeOperator, $Status){
		    $sql = "UPDATE tboperator set isAktif = '".$Status."' Where kodeOperator ='".$KodeOperator."'";
		    $this->query = $this-> execute($sql,''); 
		}
				
	}
?>