owl_root_url/lib/owl.lib.php"); /** Builds a query using the table name and the array of specified columns and displays the results in an HTML table. The ID column of the table is included by default The first column in the table can be rendered as a link to the document/folder using the $iLinkType variable to specify the link type, the $sLinkPageURL to specify the page URL to link to and $sLinkImageURL to specify the image to display in the case of either a $iLinkType of 2 (image only) or 3 (image + text) @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa @date 7 January 2003 @todo $iLinkImageURL is hard coded - change $todo $sLinkPageURL is hard coded - change */ class PatternTableSqlQuery { /* Name of table to query */ var $sTableName; /* Columns in table to query (ID is included by default) */ var $aColumns; /* Column types. Possibles are 1 = text, 2 = boolean*/ var $aColumnTypes; /* Where clause */ var $sWhereClause; /* Order by clause */ var $sOrderByClause; /* Link type. Possibles are: 0 = none; 1 = text; 2 = image, 3 = text/image */ var $iLinkType; /* Image to display if $iLinkType = 1 */ var $sLinkImageURL; /* URL of page to redirect to */ var $sLinkPageURL = "Navigate.inc"; /* Number of result to display in the table. The default value is 15 */ var $iResultsToDisplay; /* Result number to start on (internal variable - not set by developer) */ var $iStartIndex; function PatternTableSqlQuery($sTmpTableName, $aTmpColumns, $aTmpColumnTypes, $sTmpWhereClause = null, $iTmpLinkType = 0, $sTmpLinkImageURL = null, $iTmpResultsToDisplay = 15) { $this->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() { $sToRender = "
| ".$this->aColumns[$i]." | \n"; } $sToRender .= "||||
|---|---|---|---|---|
| iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\">" . $aRow[$i] . " | \n"; $sToRender .= "\n"; break; case 2: //display an image only $sToRender .= "iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\"> | \n";
break;
case 3:
//display both an image and text
$sToRender .= "iLinkPageURL . "?fID=" . $aRow[0] . "&fTableName=" . $this->sTableName . "\"> | \n";
break;
default:
break;
}
} else {
$sToRender .= "".$aRow[$i]." | \n"; } } $sToRender .= "|
|   | ||||
| "; $sToRender .= ("iStartIndex + $this->iResultsToDisplay) . "\">Next"); $sToRender .= " | \n"; } /* Display both the next and the previous buttons */ else if (($this->iStartIndex + $this->iResultsToDisplay) < $sql->getLastQueryResultCount() && $this->iStartIndex > 0) { $sToRender .= ""; $sToRender .= ("iStartIndex + $this->iResultsToDisplay) . "\">Next"); $sToRender .= " | "; $sToRender .= ""; $sToRender .= ("iStartIndex - $this->iResultsToDisplay) . "\">Previous"); $sToRender .= " | \n"; } /* Display only the previous button */ else if ($this->iStartIndex > 0) { $sToRender .= "\n"; $sToRender .= (" "); $sToRender .= " | "; $sToRender .= "\n"; $sToRender .= ("iStartIndex - $this->iResultsToDisplay) . "\">Previous"); $sToRender .= " | "; } //$sToRender .= "\n"; $sToRender .= "