sQuery = $sNewQuery; $this->aColumns = $aNewColumns; $this->aColumnNames = $aNewColumnNames; $this->aColumnTypes = $aNewColumnTypes; $this->aHyperLinkURL = $aNewHyperLinkURL; $this->aQueryStringText = $aNewQueryStringText; } function setTableWidth($iNewValue) { $this->iTableWidth = $iNewValue; } function setTextAreaRows($iNewValue) { $this->iTextAreaRows = $iNewValue; } function setTextAreaColumns($iNewValue) { $this->iTextAreaColumns = $iNewValue; } function setTableHeading($sNewValue) { $this->sTableHeading = $sNewValue; } function setRenderIndividualTableForEachResult($bNewValue) { $this->bIndividualTableForEachResult = $bNewValue; } function setEmptyTableMessage($sNewValue) { $this->sEmptyTableMessage = $sNewValue; } function & render() { global $default; $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); $aRows = DBUtil::getResultArray($this->sQuery); $sToRender = ""; $sToRender .= "iTableWidth) ? " width=\"$this->iTableWidth\"" : "") . " >\n"; if (isset($this->sTableHeading)) { $sToRender .= "\n"; } if (count($aRows) == 0) { $sToRender .= "\n"; if (isset($this->sEmptyTableMessage)) { $sToRender .= "\n"; } else { $sToRender .= "\n"; } $sToRender .= "\n"; $sToRender .= "
aColumns) . "\">$this->sTableHeading
$this->sEmptyTableMessage" . sprintf(_("No %s data"), (isset($this->sTableHeading) ? "$this->sTableHeading" : "")) . "
\n"; return $sToRender; } $map = array(); foreach ($this->aColumns as $sColumn) { $map[$sColumn] = array(); } $iColour = 0; foreach ($aRows as $aRow) { $i = 0; foreach ($this->aColumns as $sColumn) { switch ($this->aColumnTypes[$i]) { //plain text field case 1: $value = $aRow[$this->aColumns[$i]]; break; case 2: $value = $aRow[$this->aColumns[$i]]; if (!empty($value)) { if ($value) { $value = "graphicsUrl/" . $this->sChkPicPath . "\">"; } else { $value = "graphicsUrl/" . $this->sUnChkPicPath . "\">"; } $value .= " "; } break; case 3: $value = $aRow[$this->aColumns[$i]]; $value = sprintf('%s', $this->aHyperLinkURL[$i], $this->replaceValues($this->aQueryStringText[$i], ""), $value); break; default: break; } $map[$sColumn][] = $value; $i++; } } $oTemplating =& KTTemplating::getSingleton(); $oTemplate = $oTemplating->loadTemplate('ktcore/document_data'); $aColumnNames = array(); $iLen = count($this->aColumnNames); for ($c = 0; $c < $iLen; $c++) { $aColumnNames[$this->aColumns[$c]] = $this->aColumnNames[$c]; } $sToRender = $oTemplate->render(array( 'map' => $map, 'cnames' => $aColumnNames, )); return $sToRender; } function replaceValues($sQueryStringText, $sql) { return $sQueryStringText; } } ?>