[pLog-svn] r3742 - plog/trunk/class/dao/customfields
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Wed Jul 19 21:11:12 GMT 2006
Author: oscar
Date: 2006-07-19 21:11:11 +0000 (Wed, 19 Jul 2006)
New Revision: 3742
Modified:
plog/trunk/class/dao/customfields/customfieldsvalues.class.php
Log:
added the getSearchConditions method
Modified: plog/trunk/class/dao/customfields/customfieldsvalues.class.php
===================================================================
--- plog/trunk/class/dao/customfields/customfieldsvalues.class.php 2006-07-19 20:08:10 UTC (rev 3741)
+++ plog/trunk/class/dao/customfields/customfieldsvalues.class.php 2006-07-19 21:11:11 UTC (rev 3742)
@@ -135,6 +135,31 @@
return( $result );
}
+
+ /**
+ * Returns the search string needed to find custom fields based on their values
+ *
+ * @param
+ * @return
+ */
+ function getSearchConditions( $searchTerms )
+ {
+ include_once( PLOG_CLASS_PATH."class/dao/searchengine.class.php" );
+
+ $query = SearchEngine::adaptSearchString($searchTerms);
+
+ $query_array = explode(' ',$query);
+
+ $where_string = "(";
+ $where_string .= "(v.normalized_value LIKE '%{$query_array[0]}%')";
+ for ( $i = 1; $i < count($query_array); $i = $i + 1) {
+ $where_string .= " AND ((v.normalized_value LIKE '%{$query_array[$i]}%'))";
+ }
+ $where_string .= " OR (v.normalized_value LIKE '%{$query}%')";
+ $where_string .= ")";
+
+ return( $where_string );
+ }
/**
* @private
More information about the pLog-svn
mailing list