sTableName = & $sTmpTableName; $this->aColumns = & $aTmpColumns; $this->aColumnTypes = $aTmpColumnTypes; $this->sWhereClause = & $sTmpWhereClause; $this->iLinkType = & $iTmpLinkType; $this->iResultsToDisplay = $iTmpResultsToDisplay; $this->sLinkImageURL = "C:\temp\test\up.jpg"; } /** Set the variable $this->sTableName */ function setTableName($sNewVal) { $this->sTableName = & $sNew7Val; } /** Set the variable $this->aColumns */ function setColumns($aNewVal) { $this->aColumns = & $aNewVal; } /** Set the variable $this->aColumnTypes */ function setColumnTypes($aNewVal) { $this->aColumnTypes = $aTmpColumnTypes; } /** Set the variable $this->sWhereClause */ function setWhereClause($sNewVal) { $this->sWhereClause = & $sNewVal; } /** Set the variable $this->iLinkType */ function setLinkType($iNewVal) { $this->iLinkType = & $iNewVal; } /** Set the variable $this->sLinkImageURL */ function setLinkImageURL($sNewVal) { $this->sLinkImageURL = & $sNewVal; } /** Set the variable $this->iStartIndex */ function setStartIndex($iNewVal) { $this->iStartIndex = & $iNewVal; } /** Set the variable $this->iResultsToDisplay */ function setResultsToDisplay($iNewVal) { $this->iResultsToDisplay = & $iNewVal; } /** * Build the HTML string used to render the object * * @return String of HTML used to render object * * @todo possibly add in image size restraints for link types 2 and 3 */ function & render() { global $default; $sToRender = "\n"; $sToRender .= "\n"; //$i starts at 1 because the $aColumns[0] is the ID column, which //is used in links, but never actually displayed for ($i = 0; $i < count($this->aColumns); $i++) { $sToRender .= "\n"; } $sToRender .= "\n"; $sql = & $default->db; $sql->createSQLQueryWithOffset($this->sTableName, $this->aColumns, $this->iStartIndex, $this->iResultsToDisplay); $iDisplayed = 0; //limit the result set displayed while(($aRow = $sql->next_record()) && ($iDisplayed < $this->iResultsToDisplay)) { $sToRender .= ""; //get the value for each column in the row //and put it in a table column. //$i starts at 1 because $aRow[0] is the ID column for the specified table, which //is used in links, but never actually displayed //$i < count(this->aColumns) + 1 because $this->aColumns should not contain the ID column for ($i = 1; $i < count($this->aColumns) + 1; $i++) { //if the first column is a link column if (($this->iLinkType == 1 || $this->iLinkType == 2 || $this->iLinkType == 3) && ($i == 1)) { switch ($this->iLinkType) { case 1: //display text only $sToRender .= "\n"; $sToRender .= "\n"; break; case 2: //display an image only $sToRender .= "\n"; break; case 3: //display both an image and text $sToRender .= "\n"; break; default: break; } } else { $sToRender .= "\n"; } } $sToRender .= "\n"; $iDisplayed++; } //if we displayed less results than the number to display //simply pad the table while ($iDisplayed < $this->iResultsToDisplay) { $sToRender .= "\n"; $iDisplayed++; } $sToRender .= "\n"; /* Display only the next button */ if (($this->iStartIndex + $this->iResultsToDisplay) < $sql->getLastQueryResultCount() && $this->iStartIndex == 0) { $sToRender .= "\n"; } /* Display both the next and the previous buttons */ else if (($this->iStartIndex + $this->iResultsToDisplay) < $sql->getLastQueryResultCount() && $this->iStartIndex > 0) { $sToRender .= ""; $sToRender .= "\n"; } /* Display only the previous button */ else if ($this->iStartIndex > 0) { $sToRender .= ""; $sToRender .= ""; } //$sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "
".$this->aColumns[$i]."
iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\">" . $aRow[$i] . "iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\">sLinkImageURL . "\"/>iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\">sLinkImageURL . "\"/>" . $aRow[0] . "".$aRow[$i]."
 
"; $sToRender .= ("iStartIndex + $this->iResultsToDisplay) . "\">Next"); $sToRender .= ""; $sToRender .= ("iStartIndex + $this->iResultsToDisplay) . "\">Next"); $sToRender .= ""; $sToRender .= ("iStartIndex - $this->iResultsToDisplay) . "\">Previous"); $sToRender .= "\n"; $sToRender .= (" "); $sToRender .= "\n"; $sToRender .= ("iStartIndex - $this->iResultsToDisplay) . "\">Previous"); $sToRender .= "
\n"; return $sToRender; } } ?>