diff options
author | Silvio <silvio@devlet.com.br> | 2010-08-04 16:39:02 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-08-04 16:39:02 -0300 |
commit | 61f692933d4f7ed9c5bc860d28ee5e9b83f5b125 (patch) | |
tree | c85f7841756c5033881f7a680d3f68ffb7a896fb | |
parent | 5ffb81a3bef24a570b836b5d75071ea6daba45f2 (diff) | |
download | cinisis-61f692933d4f7ed9c5bc860d28ee5e9b83f5b125.tar.gz cinisis-61f692933d4f7ed9c5bc860d28ee5e9b83f5b125.tar.bz2 |
Adding more helper methods at IsisConnector
-rw-r--r-- | classes/IsisConnector.php | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index 03c2bfe..e82174c 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -391,7 +391,7 @@ class IsisConnector { * Subfield name. * * @return - * Subfield keys. + * Subfield key. */ public function getSubfieldKey($field, $subfield) { $keys = array_flip($field['subfields']); @@ -401,6 +401,27 @@ class IsisConnector { } /** + * Get the item key. + * + * @param $field + * Field array. + * + * @param $item + * Item name. + * + * @return + * Item key. + */ + public function getItemKey($field, $item) { + if ($item == 'main') { + return $item; + } + else { + return $this->getSubfieldKey($field, $item); + } + } + + /** * Get the key of a field entry. * * @param $field @@ -675,6 +696,33 @@ class IsisConnector { } /** + * Return the existing key items for a result. + * + * @param $field + * Field data. + * + * @param $row + * Row number. + * + * @return + * Array with existing item keys + * + * @todo + * Write and test. + */ + public function existingItemKeys($field, $row = 0) { + $existing = array(); + + foreach (new IsisItemIterator($this, $field)) as $key => $item) { + if ($row == $key) { + $existing[] = $this->getItemKey($field, $item); + } + } + + return $existing; + } + + /** * Get a subfield name. * * @param $field_key |