aboutsummaryrefslogtreecommitdiff
path: root/classes/IsisFinder.php
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-18 15:22:43 -0300
committerSilvio <silvio@devlet.com.br>2010-08-18 15:22:43 -0300
commitad8d8568b683e6935bec64abe88f79bf31706dd7 (patch)
tree43d00493cf8676acbcf4bec74bf44c717107ecd6 /classes/IsisFinder.php
parent219aa7f6b4a19b723b0c25683801b1b5d502e9f4 (diff)
downloadcinisis-ad8d8568b683e6935bec64abe88f79bf31706dd7.tar.gz
cinisis-ad8d8568b683e6935bec64abe88f79bf31706dd7.tar.bz2
Adding audit and finder classes, cleanup and organization
Diffstat (limited to 'classes/IsisFinder.php')
-rw-r--r--classes/IsisFinder.php103
1 files changed, 103 insertions, 0 deletions
diff --git a/classes/IsisFinder.php b/classes/IsisFinder.php
new file mode 100644
index 0000000..36732b5
--- /dev/null
+++ b/classes/IsisFinder.php
@@ -0,0 +1,103 @@
+<?php
+
+/**
+ * Provides Isis Database search methods.
+ */
+class IsisFinder extends IsisConnector {
+ /**
+ * Find the next repetition of a field.
+ *
+ * @param $entry
+ * Start entry number to begin the search.
+ *
+ * @param $field
+ * Field name.
+ *
+ * @return
+ * Next repetition.
+ */
+ public function nextRepetition($entry = 1, $field) {
+ $entry--;
+
+ // Query database.
+ do {
+ $result = $this->read(++$entry);
+ if ($entry == $entries) {
+ break;
+ }
+ } while (!isset($result[$field]) || count($result[$field]) < 2);
+
+ if (!isset($result[$field]) || count($result[$field]) < 2) {
+ return FALSE;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Find the next occurrence of a field.
+ *
+ * @param $entry
+ * Start entry number to begin the search.
+ *
+ * @param $field
+ * Field name.
+ *
+ * @return
+ * Next occurrence.
+ */
+ public function nextField($entry = 1, $field) {
+ $entry--;
+
+ // Query database.
+ do {
+ $result = $this->read(++$entry);
+ if ($entry == $entries) {
+ break;
+ }
+ } while (!isset($result[$field]));
+
+ if (!isset($result[$field])) {
+ return FALSE;
+ }
+
+ return $result;
+ }
+
+ /**
+ * Find the next occurrence of a subfield.
+ *
+ * @param $entry
+ * Start entry number to begin the search.
+ *
+ * @param $field
+ * Field name.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @return
+ * Next occurrence.
+ *
+ * @todo
+ * The subfield might be in any now and not just
+ * in the first one.
+ */
+ public function nextSubfield($entry = 1, $field, $subfield) {
+ $entry--;
+
+ // Query database.
+ do {
+ $result = $this->read(++$entry);
+ if ($entry == $entries) {
+ break;
+ }
+ } while (!isset($result[$field][0][$subfield]));
+
+ if (!isset($result[$field][0][$subfield])) {
+ return FALSE;
+ }
+
+ return $result;
+ }
+}