Mister Spy Say ="Hello Kids ... :D"
___ ____ _ _____
| \/ (_) | | / ___|
| . . |_ ___| |_ ___ _ __ \ `--. _ __ _ _
| |\/| | / __| __/ _ \ '__| `--. \ '_ \| | | |
| | | | \__ \ || __/ | /\__/ / |_) | |_| |
\_| |_/_|___/\__\___|_| \____/| .__/ \__, |
| | __/ |
|_| |___/
Bot Mister Spy V3
Mister Spy
Mister Spy
<?php
require_once('class.db.php');
require_once('class.dbaccess.php');
require_once('class.contenidocalendario.php');
require_once('class.filter.php');
require_once('class.page.php');
class ContenidoCalendarios extends DBAccess implements IFilterable
{
public function ParseFilter(array $filter)
{
$sql = '';
if (isset($filter['calendarioID']) && $filter['calendarioID'] != "")
$sql.= " AND c.calendarioID = " . DB::Number($filter['calendarioID']);
if (isset($filter['tipoID']) && $filter['tipoID'] != "")
$sql.= " AND c.tipoID = " . DB::Number($filter['tipoID']);
if (isset($filter['fecha']) && $filter['fecha'] != "")
$sql.= " AND DATE(c.fecha_desde) = DATE(" . DB::Date($filter['fecha']) . ")";
if (isset($filter['fecha_desde']) && $filter['fecha_desde'] != "")
$sql.= " AND DATE(c.fecha_desde) >= DATE(" . DB::Date($filter['fecha_desde']) . ")";
if (isset($filter['fecha_hasta']) && $filter['fecha_hasta'] != "")
$sql.= " AND DATE(c.fecha_hasta) <= DATE(" . DB::Date($filter['fecha_hasta']) . ")";
return $sql;
}
public function GetPagesCount(Page $oPage, $filter = false)
{
$CountRows = $this->GetCountRows($filter);
$Count = ceil($CountRows / $oPage->Size);
return $Count;
}
public function GetAll(array $filter = NULL, Page $oPage = NULL)
{
$sql = " SELECT c.*, ct.nombre AS tipo";
$sql.= " FROM calendarios c";
$sql.= " LEFT JOIN calendarios_tipos ct ON c.tipoID = ct.tipoID";
$sql.= " WHERE 1";
if ($filter)
$sql.= " " . $this->ParseFilter($filter);
$sql.= " ORDER BY";
$sql.= " YEAR(fecha_desde) DESC,";
$sql.= " MONTH(fecha_desde) DESC,";
$sql.= " DAY(fecha_desde) DESC";
if ($oPage != NULL)
$sql.= " " . Pageable::ParsePage($oPage);
if ( !($oRes = $this->GetQuery($sql)) )
return false;
$arr = array();
while ($oRow = $oRes->GetRow())
{
$oContenidoCalendario = new ContenidoCalendario();
$oContenidoCalendario->ParseFromArray($oRow);
array_push($arr, $oContenidoCalendario);
$oRes->MoveNext();
}
return $arr;
}
public function GetAllVigentes($filter)
{
}
public function GetAllVigentesByFecha($Fecha)
{
}
public function GetById($calendarioID)
{
$sql = " SELECT c.*, ct.nombre AS tipo";
$sql.= " FROM calendarios c";
$sql.= " LEFT JOIN calendarios_tipos ct ON c.tipoID = ct.tipoID";
$sql.= " WHERE c.calendarioID = " . DB::Number($calendarioID);
if ( !($oRes = $this->GetQuery($sql)) )
return false;
if ( !($oRow = $oRes->GetRow()) )
return false;
$oContenidoCalendario = new ContenidoCalendario();
$oContenidoCalendario->ParseFromArray($oRow);
return $oContenidoCalendario;
}
public function GetCountRows(array $filter = NULL)
{
$sql = " SELECT c.*";
$sql.= " FROM calendarios c";
$sql.= " WHERE 1";
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