<?php

class Popup extends Database {

	protected $mSqlFile= 'module/laporan_induk_inventaris_2/business/PopupKelompok.sql.php';
	
	function __construct($connectionNumber=0) {
		parent::__construct($connectionNumber);
	}
		
	function GetData($offset, $limit, $bidang = '', $kelompok = '')
   {
      $bidang = intval($bidang);
      if ($bidang == 0)
         $sql = str_replace('%OPERATOR%', 'OR', $this->mSqlQueries['get_data']);
      else $sql = str_replace('%OPERATOR%', 'AND', $this->mSqlQueries['get_data']);
      
      $result = $this->Open($sql, array($bidang, "%$kelompok%", "%$kelompok%", $offset, $limit));
		return $result;
	}

	function GetCountData($bidang='', $kelompok='')
   {
      $bidang = intval($bidang);
      if ($bidang == 0)
         $sql = str_replace('%OPERATOR%', 'OR', $this->mSqlQueries['get_count_data']);
      else $sql = str_replace('%OPERATOR%', 'AND', $this->mSqlQueries['get_count_data']);
      
      $result = $this->Open($sql, array($bidang, "%$kelompok%", "%$kelompok%", $offset, $limit));
      if (!$result) {
			return 0;
		} else {
			return $result[0]['total'];
		}
	}
}
?>
