sTableName = $sNewTableName; $this->sDisplayColumn = $sNewDisplayColumn; $this->sValueColumn = $sNewValueColumn; $this->sSelectName = $sNewSelectName; $this->sWhereClause = $sNewWhereClause; $this->bOrderAsc = $bNewOrderAsc; } function setPostBackOnChange($bNewValue) { $this->bPostBackOnChange = $bNewValue; } function setOnChangeAction($sNewValue) { $this->sOnChangeAction = $sNewValue; } function setSelectedValue($NewValue) { $this->selectedValue = $NewValue; } function setWhereClause($sNewValue) { $this->sWhereClause = $sNewValue; } function setFromClause($sNewValue) { $this->sFromClause = $sNewValue; } function setEmptyErrorMessage($sNewValue) { $this->sEmptyErrorMessage = $sNewValue; } function setIncludeDefaultValue($bNewValue) { $this->bIncludeDefaultValue = $bNewValue; } /** * Create the HTML string that will be used to render the list box * * @return String html used to render the list box * */ function & render() { global $default; $sql = $default->db; $sQuery = "SELECT DISTINCT ST." . $this->sDisplayColumn . " AS display, ST." . $this->sValueColumn . " AS value FROM $this->sTableName AS ST "; if (isset($this->sFromClause)) { $sQuery .= $this->sFromClause . " "; } if (isset($this->sWhereClause)) { $sQuery .= "WHERE " . $this->sWhereClause . " "; } $sQuery .= "ORDER BY $this->sDisplayColumn " . ($this->bOrderAsc ? "ASC" : "DESC"); $sql->query($sQuery); if ($sql->num_rows() > 0) { //$sToRender = "sSelectName\" ". ($this->bPostBackOnChange ? "onChange=\"document.MainForm.submit();\" " : " ") . ">\n"; if ($this->bIncludeDefaultValue) { $sToRender .= "\n"; } while ($sql->next_record()) { if ($this->selectedValue == $sql->f("value")) { $sToRender .= "\n"; } else { $sToRender .= "\n"; } } $sToRender .= "\n"; } else { $sToRender .= "\n"; } return $sToRender; } } ?>