From ad8d8568b683e6935bec64abe88f79bf31706dd7 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 18 Aug 2010 15:22:43 -0300 Subject: Adding audit and finder classes, cleanup and organization --- classes/IsisFinder.php | 103 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 classes/IsisFinder.php (limited to 'classes/IsisFinder.php') 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 @@ +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; + } +} -- cgit v1.2.3