aboutsummaryrefslogtreecommitdiff
path: root/classes/IsisConnector.php
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-04 16:39:02 -0300
committerSilvio <silvio@devlet.com.br>2010-08-04 16:39:02 -0300
commit61f692933d4f7ed9c5bc860d28ee5e9b83f5b125 (patch)
treec85f7841756c5033881f7a680d3f68ffb7a896fb /classes/IsisConnector.php
parent5ffb81a3bef24a570b836b5d75071ea6daba45f2 (diff)
downloadcinisis-61f692933d4f7ed9c5bc860d28ee5e9b83f5b125.tar.gz
cinisis-61f692933d4f7ed9c5bc860d28ee5e9b83f5b125.tar.bz2
Adding more helper methods at IsisConnector
Diffstat (limited to 'classes/IsisConnector.php')
-rw-r--r--classes/IsisConnector.php50
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