Commit bb93aa59c427a684a99fec081e14d4cf771fc425
1 parent
e3b10fa4
Remove unused file.
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@3816 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
0 additions
and
141 deletions
presentation/lookAndFeel/knowledgeTree/search/booleanSearchUtil.inc deleted
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * $Id$ | |
| 4 | - * | |
| 5 | - * Business logic related to Boolean Search. This allows client-side construction | |
| 6 | - * of complex searches. | |
| 7 | - * | |
| 8 | - * Copyright (c) 2005 Jam Warehouse http://www.jamwarehouse.com | |
| 9 | - * | |
| 10 | - * This program is free software; you can redistribute it and/or modify | |
| 11 | - * it under the terms of the GNU General Public License as published by | |
| 12 | - * the Free Software Foundation; either version 2 of the License, or | |
| 13 | - * (at your option) any later version. | |
| 14 | - * | |
| 15 | - * This program is distributed in the hope that it will be useful, | |
| 16 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 17 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 18 | - * GNU General Public License for more details. | |
| 19 | - * | |
| 20 | - * You should have received a copy of the GNU General Public License | |
| 21 | - * along with this program; if not, write to the Free Software | |
| 22 | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 23 | - * | |
| 24 | - * @version $Revision$ | |
| 25 | - * @author Brad Shuttleworth, Jam Warehouse (Pty) Ltd, South Africa | |
| 26 | - * @package search | |
| 27 | - */ | |
| 28 | - | |
| 29 | -/* getBooleanSearchResults. | |
| 30 | - * | |
| 31 | - * What gets passed in from the Ajax generated environment looks as follows: | |
| 32 | - * boolean_search[x] = array(); // x is a client-side generated index for the criterion. | |
| 33 | - * boolean_search[x]["type"] = Criterion::getID; // straight out, so none of this "bumpf". | |
| 34 | - * boolean_search[x]["data"] = array(); | |
| 35 | - * boolean_search[x]["data"][y] = value; // where "y" is whatever-the-hell each thing is. essentially, pass boolean_search[x]["data"] as $aRequest;. | |
| 36 | - */ | |
| 37 | - | |
| 38 | -function getBooleanSearchResults($aOrigReq, $iStartIndex) { | |
| 39 | - global $default; | |
| 40 | - | |
| 41 | - $sRefreshMessage = "<table><tr><td align=\"center\">" . _("If your browser displays a 'Warning: Page has Expired' message when you attempt to return to these search results, please click your browser's 'Refresh' button") . "</td></tr></table>"; | |
| 42 | - | |
| 43 | - $aReq = array(); | |
| 44 | - foreach ($aOrigReq as $k => $v) { | |
| 45 | - if (searchCriteria($k) === 1) { | |
| 46 | - $v = trim($v); | |
| 47 | - if ($v === "") { | |
| 48 | - continue; | |
| 49 | - } | |
| 50 | - if ($v === "-1") { | |
| 51 | - continue; | |
| 52 | - } | |
| 53 | - $aReq[$k] = $v; | |
| 54 | - } | |
| 55 | - } | |
| 56 | - | |
| 57 | - $aIDs = array_unique(array_map("criteriaNumber", array_keys($aReq))); | |
| 58 | - $aSQL = array(); | |
| 59 | - $aJoinSQL = array(); | |
| 60 | - foreach ($aIDs as $iID) { | |
| 61 | - $oCriterion =& Criteria::getCriterionByNumber($iID); | |
| 62 | - $res = $oCriterion->searchSQL($aReq); | |
| 63 | - if (!is_null($res)) { | |
| 64 | - $aSQL[] = $res; | |
| 65 | - } | |
| 66 | - $res = $oCriterion->searchJoinSQL(); | |
| 67 | - if (!is_null($res)) { | |
| 68 | - $aJoinSQL[] = $res; | |
| 69 | - } | |
| 70 | - } | |
| 71 | - $aCritParams = array(); | |
| 72 | - $aCritQueries = array(); | |
| 73 | - foreach ($aSQL as $sSQL) { | |
| 74 | - if (is_array($sSQL)) { | |
| 75 | - $aCritQueries[] = $sSQL[0]; | |
| 76 | - $aCritParams = array_merge($aCritParams , $sSQL[1]); | |
| 77 | - } else { | |
| 78 | - $aCritQueries[] = $sSQL; | |
| 79 | - } | |
| 80 | - } | |
| 81 | - | |
| 82 | - if (count($aCritQueries) == 0) { | |
| 83 | - return "No search criteria were specified"; | |
| 84 | - } | |
| 85 | - | |
| 86 | - $sSQLSearchString = join(" AND ", $aCritQueries); | |
| 87 | - $sJoinSQL = join(" ", $aJoinSQL); | |
| 88 | - | |
| 89 | - $sToSearch = KTUtil::arrayGet($aOrigReq, 'fToSearch', 'Live'); | |
| 90 | - | |
| 91 | - $sQuery = DBUtil::compactQuery(" | |
| 92 | -SELECT | |
| 93 | - F.name AS folder_name, F.id AS folder_id, D.id AS document_id, | |
| 94 | - D.name AS document_name, D.filename AS file_name, COUNT(D.id) AS doc_count, 'View' AS view | |
| 95 | -FROM | |
| 96 | - $default->documents_table AS D | |
| 97 | - INNER JOIN $default->folders_table AS F ON D.folder_id = F.id | |
| 98 | - $sJoinSQL | |
| 99 | - INNER JOIN $default->search_permissions_table AS SDUL ON SDUL.document_id = D.id | |
| 100 | - INNER JOIN $default->status_table AS SL on D.status_id=SL.id | |
| 101 | -WHERE | |
| 102 | - (F.is_public OR | |
| 103 | - SDUL.user_id = ?) | |
| 104 | - AND SL.name = ? | |
| 105 | - AND ($sSQLSearchString) | |
| 106 | -GROUP BY D.id | |
| 107 | -ORDER BY doc_count DESC"); | |
| 108 | - | |
| 109 | - $aParams = array(); | |
| 110 | - $aParams[] = $_SESSION["userID"]; | |
| 111 | - $aParams[] = $sToSearch; | |
| 112 | - $aParams = array_merge($aParams, $aCritParams); | |
| 113 | - | |
| 114 | - //var_dump(DBUtil::getResultArray(array($sQuery, $aParams))); | |
| 115 | - //exit(0); | |
| 116 | - | |
| 117 | - $aColumns = array("folder_name", "file_name", "document_name", "doc_count", "view"); | |
| 118 | - $aColumnTypes = array(3,3,3,1,3); | |
| 119 | - $aColumnHeaders = array("<font color=\"ffffff\"><img src=$default->graphicsUrl/widgets/dfolder.gif>" . _("Folder") . "</font>", "<font color=\"ffffff\">" . _("Name") . "</font>", "<font color=\"ffffff\">" . _("Title") . "</font>", "<font color=\"ffffff\">" . _("Matches") . "</font>", "<font color=\"ffffff\">" . _("View") . "</font>"); | |
| 120 | - $aLinkURLs = array("$default->rootUrl/control.php?action=browse","$default->rootUrl/control.php?action=viewDocument", "$default->rootUrl/control.php?action=viewDocument", null, "$default->rootUrl/control.php?action=downloadDocument"); | |
| 121 | - $aDBQueryStringColumns = array("document_id","folder_id"); | |
| 122 | - $aQueryStringVariableNames = array("fDocumentID", "fFolderID"); | |
| 123 | - | |
| 124 | - $oPatternBrowse = & new PatternBrowseableSearchResults(array($sQuery, $aParams), 10, $aColumns, $aColumnTypes, $aColumnHeaders, $aLinkURLs, $aDBQueryStringColumns, $aQueryStringVariableNames); | |
| 125 | - $oPatternBrowse->setStartIndex($iStartIndex); | |
| 126 | - $oPatternBrowse->setSearchText(""); | |
| 127 | - $oPatternBrowse->setRememberValues($aReq); | |
| 128 | - $sForSearch = "<input type=\"hidden\" name=\"fForSearch\" value=\"1\" />"; | |
| 129 | - | |
| 130 | - return renderHeading(_("Advanced Search")) . $oPatternBrowse->render() . $sForSearch . $sRefreshMessage; | |
| 131 | -} | |
| 132 | - | |
| 133 | -function dealWithAdvancedSearch($aReq, $iStartIndex) { | |
| 134 | - global $main; | |
| 135 | - $oPatternCustom = & new PatternCustom(); | |
| 136 | - $oPatternCustom->setHtml(getAdvancedSearchResults($aReq, $iStartIndex)); | |
| 137 | - $main->setCentralPayload($oPatternCustom); | |
| 138 | - $main->render(); | |
| 139 | -} | |
| 140 | - | |
| 141 | -?> |