Location: PHPKode > projects > PortWatcher > PortWatcher/paginator_html.php
<?php 
// ==================================================================
  //  Author: Ted Kappes (hide@address.com)
  //  Web:   http://tkap.org/paginator/
  //  Name:   Paginator_html
  //   Desc:   Class extension for Paginator. Adds pre-made link sets.
  //
  // 7/21/2003
  //
  //  Please send me a mail telling me what you think of Paginator
  //  and what your using it for. [ hide@address.com]
  //
// ==================================================================
      
  class Paginator_html extends Paginator { 
      
        //outputs a link set like this 1 of 4 of 25 First | Prev | Next | Last |              
        function firstLast()
        {        
           if($this->getCurrent()==1) {
             $first = "First | ";
           } else { 
             $first="<a href=\"" .  $this->getPageName() . "?".$this->string."page=" . $this->getFirst() . "\">First</a> |"; 
           }
  
           if($this->getPrevious()) {
             $prev = "<a href=\"" .  $this->getPageName() . "?".$this->string."page=" . $this->getPrevious() . "\">Prev</a> | ";
           } else { 
             $prev="Prev | "; 
           }
    
           if($this->getNext()) {
             $next = "<a href=\"" . $this->getPageName() . "?".$this->string."page=" . $this->getNext() . "\">Next</a> | ";
           } else { 
             $next="Next | ";  
           } 
    
           if($this->getLast()) {
             $last = "<a href=\"" . $this->getPageName() . "?".$this->string."page=" . $this->getLast() . "\">Last</a> | ";
           } else { 
             $last="Last | "; 
           }
           echo $this->getFirstOf() . " of " .$this->getSecondOf() . " of " . $this->getTotalItems() . " ";
           echo $first . " " . $prev . " " . $next . " " . $last;
        } 
        //outputs a link set like this Previous 1 2 3 4 5 6 Next   
        function previousNext() {

          if($this->getCurrent()==1) {
            $content .= "";
          } else { 
            $content .="<a href=\"javascript:submitForm('" .  $this->getPageName() . "?".$this->string."page=" . $this->getFirst() . "')\"><img border='0' src='/portwatcher/img/arrow-left-double.gif'></a>"; 
          }
 
          if($this->getPrevious()) {
            $content .= "<a href=\"javascript:submitForm('" . $this->getPageName() . "?".$this->string."page=" . $this->getPrevious() . "')\"><img border='0' src='/portwatcher/img/arrow-left.gif'></a> ";
          }
          $links = $this->getLinkArr();
          foreach($links as $link) {
            if($link == $this->getCurrent()) {
              $content .= "<input type='text' size='2' name='page_f' value='$link'>";
            } else { 
              #$content .= "<a href=\"javascript:submitForm('" . $this->getPageName() . "?".$this->string."page=$link')\">" . $link . "</a> ";
            }
          } 
          if($this->getNext()) {
            $content .= "<a href=\"javascript:submitForm('" . $this->getPageName() . "?".$this->string."page=" . $this->getNext() . "')\"><img border='0' src='/portwatcher/img/arrow-right.gif'></a> ";
          }
          if($this->getLast()) {
             $content .= "<a href=\"javascript:submitForm('" . $this->getPageName() . "?".$this->string."page=" . $this->getLast() . "')\"><img border='0' src='/portwatcher/img/arrow-right-double.gif'></a>";
           } else { 
             $content .=""; 
             #$this->getLast() = $link;
           }
           if($this->getLast()){
             $content .="&nbsp;<b> OF ".$this->getLast() ."</b>";
           }else{
             $content .="&nbsp;<b> OF ".$link."</b>";
           } 
          return $content;
        }  
  }//ends class


         ?>
         
Return current item: PortWatcher