From d83a35ce8486256ff865596066c6dbf23bfe5b18 Mon Sep 17 00:00:00 2001 From: Silvio Date: Thu, 15 Jul 2010 18:07:01 -0300 Subject: Adding IsisNormalSubfieldFilterIterator --- classes/IsisConnector.php | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'classes/IsisConnector.php') diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index cc4bf62..c731d9a 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -543,4 +543,43 @@ class IsisConnector { return false; } + + /** + * Deal with special subfields. + * + * @param $field + * Field data from ISIS database schema. + * + * @param $subfield + * Subfield name. + * + * @param $return + * Specify return type. + * + * @return + * True if special subfield, false otherwise of special return type + */ + public function specialSubfield($field, $subfield, $return = 'boolean') { + if (isset($field['special'])) { + $field_key = $this->getFieldKey($field); + $subfield_key = $this->getSubfieldKey($field, $subfield); + $name = $field['name'] .':'. $subfield; + $code = $field_key .':'. $subfield_key; + + if (array_search($subfield_key, $field['special'])) { + $this->log("Found special subfield $name", 'debug'); + + if ($return == 'boolean') { + return true; + } + elseif ($return == 'code') { + return $code; + } + + return $name; + } + } + + return false; + } } -- cgit v1.2.3