function CalcSearchParameters() { global $strTableName, $strSQL; $sWhere = ""; if (@$_SESSION[$strTableName . "_search"] == 2) { foreach (@$_SESSION[$strTableName . "_asearchfor"] as $f => $sfor) { $strSearchFor = trim($sfor); $strSearchFor2 = ""; $type = @$_SESSION[$strTableName . "_asearchfortype"][$f]; if (array_key_exists($f, @$_SESSION[$strTableName . "_asearchfor2"])) { $strSearchFor2 = trim(@$_SESSION[$strTableName . "_asearchfor2"][$f]); } if ($strSearchFor != "" || true) { if (!$sWhere) { if ($_SESSION[$strTableName . "_asearchtype"] == "and") { $sWhere = "1=1"; } else { $sWhere = "1=0"; } } $strSearchOption = trim($_SESSION[$strTableName . "_asearchopt"][$f]); if ($where = StrWhereAdv($f, $strSearchFor, $strSearchOption, $strSearchFor2, $type)) { if ($_SESSION[$strTableName . "_asearchnot"][$f]) { $where = "not (" . $where . ")"; } if ($_SESSION[$strTableName . "_asearchtype"] == "and") { $sWhere .= " and " . $where; } else { $sWhere .= " or " . $where; } } } } } return $sWhere; }
function getSuggestWhere($fName, $fType, $suggestAllContent, $searchVal) { $sWhere = ''; $searchOpt = $suggestAllContent ? "Contains" : "Starts with"; $where = StrWhereAdv($fName, $searchVal, $searchOpt, '', $fType, true); return $where; }
/** * Build where for advanced search. * Need for compability with old projects * * @protected * @return string */ function buildAdvancedWhere() { $sWhere = ""; if (isset($this->_where[$this->sessionPrefix . "_asearchfor"])) { foreach ($this->_where[$this->sessionPrefix . "_asearchfor"] as $f => $sfor) { $strSearchFor = trim($sfor); $strSearchFor2 = ""; $type = @$this->_where[$this->sessionPrefix . "_asearchfortype"][$f]; if (array_key_exists($f, @$this->_where[$this->sessionPrefix . "_asearchfor2"])) { $strSearchFor2 = trim(@$this->_where[$this->sessionPrefix . "_asearchfor2"][$f]); } if ($strSearchFor != "" || true) { if (!$sWhere) { if ($this->_where[$this->sessionPrefix . "_asearchtype"] == "and") { $sWhere = "1=1"; } else { $sWhere = "1=0"; } } $strSearchOption = trim($this->_where[$this->sessionPrefix . "_asearchopt"][$f]); if ($where = StrWhereAdv($f, $strSearchFor, $strSearchOption, $strSearchFor2, $type, false)) { if ($this->_where[$this->sessionPrefix . "_asearchnot"][$f]) { $where = "not (" . $where . ")"; } if ($this->_where[$this->sessionPrefix . "_asearchtype"] == "and") { $sWhere .= " and " . $where; } else { $sWhere .= " or " . $where; } } } } } return $sWhere; }