Thank you to anyone who has already donated - your generous donations helped make three months of treatment possible.

My brother Nate continues to fight stage IV Hodgkin's lymphoma. He's just 31, with a wife and baby girl. They have no active income (since he's been unable to return to work), no insurance, and cannot afford the treatment he needs. Nate and his family need your help. Please consider a donation, every dollar helps. Thanks.



			
<?php
class PaginatedByPage extends Extension { 

   protected $pageNumGetVar = "page"; 

   public function PageNums($maxPages = 0){ 
      $ret = new DataObjectSet();
      if($maxPages) { 
         $startPage = ($this->owner->CurrentPage() - floor($maxPages / 2)) - 1; 
         $endPage = $this->owner->CurrentPage() + floor($maxPages / 2);

         if($startPage < 0) { 
            $startPage = 0; 
            $endPage = $maxPages; 
         } 
         if($endPage > $this->owner->TotalPages()) { 
            $endPage = $this->owner->TotalPages(); 
            $startPage = max(0, $endPage - $maxPages); 
         }

      } else { 
         $startPage = 0; 
         $endPage = $this->owner->TotalPages(); 
      }

      for($i=$startPage; $i < $endPage; $i++){ 
         if($i == 0) { 
         // $link = Should be just the url without parameters. 
// How is this done? 
            $link = HTTP::setGetVar($this->pageNumGetVar, $i + 1); 
         } else { 
            $link = HTTP::setGetVar($this->pageNumGetVar, $i + 1); 
         } 
         $thePage = new ArrayData(array( 
               "PageNum" => $i+1, 
               "Link" => $link, 
               "CurrentBool" => ($this->owner->CurrentPage() == $i+1)?true:false, 
               ) 
         ); 
         $ret->push($thePage); 
      } 

      return $ret; 
   } 

   public function PageNextLink() { 
      if($this->owner->pageStart + $this->owner->pageLength < $this->owner->totalSize) { 
         return HTTP::setGetVar($this->pageNumGetVar, $this->owner->CurrentPage() + 1); 
      } 
   } 

   public function PagePrevLink() { 
      if($this->owner->pageStart - $this->owner->pageLength >= 0) { 
         return HTTP::setGetVar($this->pageNumGetVar, $this->CurrentPage() - 1); 
      } 
   } 

}
?>