"; return $formString; } /** * Closes an input form * * @return
*/ function closeForm() { return "
"; } /** * Outputs a hidden form field * * @param string $name * @param string $value * @param string $id * * @return */ function hiddenField($name, $value, $id="") { return ""; } /** * Returns a text input field * * @param string $name * @param string $id * @param string $value * @param int $size * @param int $maxlen * @param string $extraParams - allows for non-std params like "read-only" etc * @return */ function textField($name, $id="", $value="", $size="", $maxlen="",$extraParams="") { return ""; } /** * Returns a file input field * * @param string $name * @param string $id * @return */ function fileField($name, $id="") { return ""; } /** * Returns a set of radio buttons * * @param string $name * @param array $values * @param string $checked * @param string $id * @return */ /** * Produces an array of radio buttons * * @param string $name - the name of the control * @param array $values - an array containing any/all button values * @param string $checked - contains the name of the ($values) to start as checked * @param string $id * @return array $rbOptions - each line of the array is a complete rb entry */ function radioButton($name, $values, $displayText="",$checked="",$id="") { // $values should be an array $rbText = "
    "; for ($loopVar=0; $loopVar < sizeof($values); $loopVar++) { $rbText .= "
  • "; } $rbText .="
"; return $rbText; } /** * Returns an input form checkbox * * @param string $name * @param string $checked * @param string $id * @return */ function checkBox($name, $checked="", $id="", $value="") { // 15 May - added value field to allow for cb arrays $cbText = " */ function selectionBox($name,$values,$size,$id="",$selected="") { $sbText = ""; return $sbText; } /** * creates a dropdown based on a numeric range * * @param String $name * @param int $low * @param int $high * @param int $size * @param String $id * @return String */ function selectionBoxNumericRange($name,$low,$high,$size=1,$default,$id="") { $sbText = ""; return $sbText; } /** * It seems it's not possible to overload methods in PHP, so I had to create a new method * to deal with selection boxes where the display value and the passed value differ.. * //me -> hoping that this is wrong .... * * @param String $name * @param Array $values * @param Array $displayValues * @param int $size * @param String $id * @param String $selected <-- holds the value of any default option */ function selectionBoxVariable($name,$values,$displayValues,$size,$id="",$selected="",$extraParams="") { $sbText = ""; $sbText .= ""; return $sbText; } /** * Creates an HTML textarea * * @param string $name * @param string $value * @param int $rowsunknown * @param int $cols * @param string $id */ function textArea($name,$value,$rows,$cols, $id="") { return ""; } /** * Creates an HTML password input * * @param string $name * @param string $id */ function password($name,$id="") { return ""; } /** * Creates a form button * * @param string $url - url for the graphic to use * @param string $id */ function submitGfx($url,$text="",$id="") { return ""; } /** * Creates an HTML submit button * * @param string $text * @param string $jScript * @param string id */ function submit($text,$jScript="",$id="") { return ""; } /** * Creates an HTML reset button * * @param string $text * @param string $id */ function reset($text,$id="") { return ""; } /** * creates three dropdowns to allow date selection * userProvided name will be postpended by d, m or y * * @param String $name * @param String $id * @param int $startYear * @param int $endYear */ function date($name, $id="", $startYear=1900, $endYear=2050,$defaultMonth=1, $defaultDay=1, $defaultYear=2007){ $day = $this->selectionBoxNumericRange($name."d",1,31,1,$defaultDay); $mon = $this->selectionBoxNumericRange($name."m",1,12,1,$defaultMonth); $yr = $this->selectionBoxNumericRange($name."y",$startYear,$endYear,1,$defaultYear); return ($day."/".$mon."/".$yr); } } // end of class definition ?>"; function __construct($currentPage,$totalResults,$pageName,$pageSize=10,$prevArrow="[<< Prev]", $nxtArrow="[Next >>]") { // Constructor info here // Note, I added ltArrow and gtArrow to display the next and prev page indicators, the default is // text-based as per the constructor. If the user specifies ANYTHING else it'll be taken as a call // to an image ... $this->currentPage = $currentPage; $this->totalResults = $totalResults; $this->pageName = $pageName; $this->pageSize = $pageSize; if (($prevArrow != "[<< Prev]") and ($prevArrow != "")){ $this->prevArrow = ""; } else { $this->prevArrow = $prevArrow; } if (($nxtArrow != "[Next >>]") and ($nxtArrow != "")) { $this->nxtArrow = ""; } else { $this->nxtArrow = $nxtArrow; } } function getCurrentPage() { return $this->currentPage; } function isFirstPage() { if ($this->currentPage ==1) { return TRUE; } else { return FALSE; } } function isLastPage() { if (($this->currentPage*$this->pageSize) >= $this->totalResults) { return TRUE; } else { return FALSE; } } // UrlString *must* be passed in, will generate it at page level and send it over... function createPagination($urlString="") { $prevPage = ($this->currentPage < 2)? 1 : $this->currentPage-1; $nextPage = (($this->currentPage*$this->pageSize) < $this->totalResults)? $this->currentPage+1 : ($this->totalResults / $this->pageSize); if ($this->totalResults <= $this->pageSize) { return (""); // If the numItems doesn't exceed the pagesize then pagination isn't necessary, return NOWT! } $this->prevArrow = ($this->currentPage > 0)? "pageName."/".$urlString."&pn=".($prevPage-1)."\">".$this->prevArrow."" : ""; $this->nextArrow = ((($this->currentPage+1) * $this->pageSize) <= $this->totalResults)? "pageName."/".$urlString."&pn=".($nextPage+1)."\">".$this->nxtArrow."" : ""; // finally, list the pages ... $maxPages = (($this->totalResults % $this->pageSize) == 0) ? ($this->totalResults / $this->pageSize) : ($this->totalResults / $this->pageSize) + 1; $pageString = ""; for ($loopVar=1; $loopVar <= $maxPages; $loopVar++) { $tUrlString = $urlString; // temp var, otherwise it concetenates the page nums $tUrlString .= ($tUrlString == "")? "pn=".$loopVar : "&pn=".$loopVar; // if urlString is empty donlt start with an amp ... $displayPageNo = (($this->currentPage+1) == $loopVar)? "$loopVar" : "".$loopVar.""; $pageString .= $displayPageNo.$this->separator; } // Now bung it all together ... // Quick check to suppress arrows for first/last pages $this->prevArrow = ($this->currentPage == 0)? "" : $this->prevArrow; $this->nextArrow = ($this->currentPage == $maxPages)? "" : $this->nextArrow; $paginator = " ".$this->prevArrow." ".$this->separator.$pageString." ".$this->nextArrow; return($paginator); } } ?>