"asc",
"desc"=>"desc",
""=>"none");
## HTML Widget dictionary
var $dict = array(
"de" => array(
"searchfor" => "Suchen nach:",
"and" => "und",
"or" => "oder",
"like" => "enth\344lt",
"reset" => "Neu",
"submit" => "Ausf\374hren",
"less" => "Weniger",
"more" => "Mehr"
),
"en" => array(
"searchfor" => "Search for:",
"and" => "and",
"and not" => "and not",
"or" => "or",
"or not" => "or not",
"like" => "contains",
"reset" => "Reset",
"submit" => "Submit Query",
"less" => "Fewer",
"more" => "More",
"sort" => "Sort Order:",
"asc" => "Asc",
"desc" => "Desc",
"none" => "None"
),
"rus" => array(
"searchfor" => "Искать:",
"and" => "и",
"or" => "или",
"like" => "содержит",
"reset" => "Новый Поиск",
"submit" => "Начать Поиск",
"less" => "Меньше",
"more" => "Больше",
"sort" => "Порядок Сортировки:",
"asc" => "Восходящий",
"desc" => "Нисходящий",
"none" => "Не сортировать"
)
);
## form:
##
## Draw SQL Query selection form.
##
function form($base, $option, $class = "", $target = "") {
if($this->debug)
printf("form()
\n");
global $sess;
##
## load the HTML results of this function into $res.
##
$res = "";
## Scale the HTML table according to the number of active options
$colnum = 4; // at least 4 columns
if ($this->sort)
$colnum += 1;
## A hack. We cannot do language dependent initialisation of
## static values.
if (isset($this->compare["like"])) {
$this->compare["like"] = $this->dict[$this->lang]["like"];
}
if ($this->sort) {
$this->sort["asc"] = $this->dict[$this->lang]["asc"];
$this->sort["desc"] = $this->dict[$this->lang]["desc"];
$this->sort[""] = $this->dict[$this->lang]["none"];
}
## Prepare a self-directed container form
if ($this->container) {
$res .= sprintf("
| \n", ($class)?" class=$class":"", ($class)?" class=$class":"", ($class)?" class=$class":""); } $res .= sprintf("\n"); if ($this->container) { $res .= sprintf(" |
\n"); ## get dictionary data for the queried tables if (!$this->ddata) $this->ddata= get_table_ddata(trim($GLOBALS[docprops][dtable])); for($i=1; $i<=$this->conditions; $i++) { ## Only create conditions for used input fields if ($GLOBALS[$base]["input_".$i] == "") continue; ## If necessary, add conjunction if ($q != "") $q .= sprintf(" %s ", $GLOBALS[$base]["conj_".$i]); ## Handle "like" if ($GLOBALS[$base]["comp_".$i] == "like") $v = "%".$GLOBALS[$base]["input_".$i]."%"; else $v = $GLOBALS[$base]["input_".$i]; ## Create subcondition, case-insensitive if $this->caseins is set and we are not searching on a date if ($this->caseins && ($this->ddata[$GLOBALS[$base]["sel_".$i]][datatype] != "DATE")) { $q .= sprintf("upper(%s) %s upper('%s')", $GLOBALS[$base]["sel_".$i], $GLOBALS[$base]["comp_".$i], addslashes($v)); } else { $q .= sprintf("%s %s '%s'", $GLOBALS[$base]["sel_".$i], $GLOBALS[$base]["comp_".$i], addslashes($v)); } } ## Create the "order by" string (MA, 8/18/2000) if ($this->sort) { for($i=1; $i<=$this->conditions; $i++) { if ($GLOBALS[$base]["order_".$i] == "") continue; if ($o != "") $o .= ", "; $o .= sprintf(" %s %s", $GLOBALS[$base]["sel_".$i], $GLOBALS[$base]["order_".$i]); } if (($q) && ($o)) $o = " order by " . $o; else $o = ""; // zero out the "order by" string if there is no query string } if (!$q) $q = "1=0"; return "( $q ) $o"; } } // end class ext_sql_query ?>

