Location: PHPKode > scripts > Yet Another Pager > yet-another-pager/CYap_PageJump.php
<?PHP
/**
 * CYap_Page_Jump.php
 * @copyright CYap_PageJump.php is part of Yap project {@link http://www.andrioli.com/en/yap.html} and it is LGPL
 * @author    Andrioli Darvin <darvin (inside) andrioli (dot) com>
 * @version   $Header: d:\cvs/classistd/yap/CYap_PageJump.php,v 1.10 2008/03/10 12:15:46 darvin Exp $
 *
 *
 */
/*
 * +-------------------------------------------------------------------------+
 * | Yap                                                                     |
 * +-------------------------------------------------------------------------+
 * | Copyright (c) 2003-2008 Andrioli Darvin                                 |
 * | Email         <darvin (inside) andrioli (dot) com>                      |
 * | Web           http://www.andrioli.com/en/yap.html                       |
 * | Download      http://www.phpclasses.org/browse.html/package/1391.html   |
 * |                                                                         |
 * +-------------------------------------------------------------------------+
 * | This library is free software; you can redistribute it and/or modify    |
 * | it under the terms of the GNU Lesser General Public License as          |
 * | published by the Free Software Foundation; either version 2 of the      |
 * | License, or (at your option) any later version.                         |
 * |                                                                         |
 * | This library is distributed in the hope that it will be useful, but     |
 * | WITHOUT ANY WARRANTY; without even the implied warranty of              |
 * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU        |
 * | Lesser General Public License for more details.                         |
 * |                                                                         |
 * | You should have received a copy of the GNU Lesser General Public        |
 * | License along with this library; if not, write to the Free Software     |
 * | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
 * +-------------------------------------------------------------------------+
 */

/**
 * Show the table, first, previous, next,last page
 * @package CYap
 */
class CYap_MoveToPage
{
/**
 * Language text
 * @var array $Lang
 */
var $Lang;
/**
 * Start the class.
 * @param string $Lang, Language file
 */
function CYap_MoveToPage($Lang)
{
$this->Lang=parse_ini_file($Lang);
}

function Draw($LinkTbl)
{

echo "<table border=1 align=center>\n
      <tr><td>";

if(array_key_exists('FirstPage',$LinkTbl))
  { echo "<a href=".$LinkTbl['FirstPage']." onMouseOver=\"YapToolTip('".$this->Lang['TipFirst']."')\" onMouseOut=\"YapToolTip()\" >".$this->Lang['First']."</a>"; }
else           { echo "&nbsp"; }
echo "</td><td>";

if(array_key_exists('PrevPage',$LinkTbl))
  { echo "<a href=".$LinkTbl['PrevPage']." onMouseOver=\"YapToolTip('".$this->Lang['TipPrevious']."')\" onMouseOut=\"YapToolTip()\" >".$this->Lang['Previous']."</a>"; }
else           { echo "&nbsp"; }
echo "</td><td>";

echo "<a href='".$LinkTbl['Exit']."' onMouseOver=\"YapToolTip('".$this->Lang['TipExit']."')\" onMouseOut=\"YapToolTip()\"  >".$this->Lang['Exit']."</a>";
echo "</td><td>";

// In detailmode I give the link to the 'normal' mode
if(array_key_exists('DetailMode',$LinkTbl))
  {
  echo "<a href=".$LinkTbl['DetailMode']." onMouseOver=\"YapToolTip('".$this->Lang['TipTableView']."')\" onMouseOut=\"YapToolTip()\" >".$this->Lang['TableView']."</a>";
  echo "</td><td>";
  }

if(array_key_exists('NextPage',$LinkTbl))
  { echo "<a href=".$LinkTbl['NextPage']." onMouseOver=\"YapToolTip('".$this->Lang['TipNext']."')\" onMouseOut=\"YapToolTip()\" >".$this->Lang['Next']."</a>"; }
else           { echo "&nbsp"; }
echo "</td><td>";

if(array_key_exists('LastPage',$LinkTbl))
  { echo "<a href=".$LinkTbl['LastPage']." onMouseOver=\"YapToolTip('".$this->Lang['TipEnd']."')\" onMouseOut=\"YapToolTip()\" >".$this->Lang['End']."</a>"; }
else           { echo "&nbsp"; }
echo "</td>\n</tr></table>";
}

}

/**
 * draw the table that allows to jump to the page number x
 * @package CYap
 */
class CYap_PageNumber
{
/**
 * Language text
 * @var array $Lang
 */
var $Lang;
/**
 * Start the class.
 * @param string $Lang, Language file
 */
function CYap_PageNumber($Lang)
{
$this->Lang=parse_ini_file($Lang);
}

function Draw($min,$max,$current)
{
// Open the tabel
echo "<table border=1 align=center>\n
      <tr><td>".$this->Lang['GotoPage'].":  ";

// Page number loop
for($i=$min;$i<$max+1;$i++)
   {
   if($i==$current)
     // Current page
     echo "[$i]  ";
   else
     echo "<a href=".$_SERVER["PHP_SELF"]."?ev=YAP_TOPAGE&pag=".$i.">".$i."</a>  ";
   }

echo "</td>\n</tr></table>";
}

}

?>
Return current item: Yet Another Pager