* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-class SearchCriteria extends BaseFrameworkSystem implements LocalCriteria {
+class SearchCriteria extends BaseFrameworkSystem implements LocalSearchCriteria {
/**
* Criteria to handle
*/
private $skip = 0;
/**
- * Private constructor
+ * Protected constructor
*
* @return void
*/
$this->setObjectDescription("Search criteria class");
// Create unique ID number
- $this->createUniqueID();
+ $this->generateUniqueId();
// Clean up a little
$this->removeNumberFormaters();
}
/**
- * Add extra criteria
+ * Add criteria
*
* @param $criteriaKey Criteria key
* @param $criteriaValue Criteria value
$this->searchCriteria[$criteriaKey] = $criteriaValue;
}
+ /**
+ * Add configured criteria
+ *
+ * @param $criteriaKey Criteria key
+ * @param $configEntry Configuration entry
+ * @return void
+ */
+ public function addConfiguredCriteria ($criteriaKey, $configEntry) {
+ // Add the configuration entry as a criteria
+ $value = $this->getConfigInstance()->readConfig($configEntry);
+ $this->addCriteria($criteriaKey, $value);
+ }
+
/**
* Setter for limit
*
$this->limit = $limit;
}
+ /**
+ * Getter for limit
+ *
+ * @param
+ * @return $limit Search limit
+ */
+ public final function getLimit () {
+ return $this->limit;
+ }
+
/**
* Setter for skip
*
$this->skip = $skip;
}
+ /**
+ * Getter for skip
+ *
+ * @param
+ * @return $skip Search skip
+ */
+ public final function getSkip () {
+ return $this->skip;
+ }
+
/**
* "Getter" for a cache key
*
// Return the cache key
return $cacheKey;
}
+
+ /**
+ * Get criteria element or null if not found
+ *
+ * @param $criteria The criteria we want to have
+ * @return $value Wether the value of the critera or null
+ */
+ public function getCriteriaElemnent ($criteria) {
+ // Default is not found
+ $value = null;
+
+ // Is the criteria there?
+ if (isset($this->searchCriteria[$criteria])) {
+ // Then use it
+ $value = $this->searchCriteria[$criteria];
+ }
+
+ // Return the value
+ return $value;
+ }
}
// [EOF]