diff options
author | Silvio <silvio@devlet.com.br> | 2010-08-04 14:37:24 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-08-04 14:37:24 -0300 |
commit | fa2e699c04c6d59efe968c1811d1ecddb2191b7c (patch) | |
tree | 4eb6d6f448ca256aa683ad0af3cb475e91300141 /classes/IsisConnector.php | |
parent | 2e66a7279b67b35369da83cc4959edd5e957cae2 (diff) | |
download | cinisis-fa2e699c04c6d59efe968c1811d1ecddb2191b7c.tar.gz cinisis-fa2e699c04c6d59efe968c1811d1ecddb2191b7c.tar.bz2 |
Adding methods hasItem() and hasMainItem() at IsisConnector
Diffstat (limited to 'classes/IsisConnector.php')
-rw-r--r-- | classes/IsisConnector.php | 62 |
1 files changed, 58 insertions, 4 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index 886246e..8a2fd45 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -292,9 +292,9 @@ class IsisConnector { */ public function getMap($field, $subfield = NULL) { if ($subfield == NULL) { - if (isset($field['map']['field'])) { - // Custom map provided. - $dest = $this->mapName($field['map']['field']); + if (isset($field['map']['main'])) { + // Custom map provided for the main item. + $dest = $this->mapName($field['map']['main']); } else { // Default map. @@ -353,7 +353,7 @@ class IsisConnector { * TRUE if field has a map, FALSE otherwise. */ public function fieldHasMap($field) { - if (isset($field['map']['field'])) { + if (isset($field['map']['main'])) { return TRUE; } return FALSE; @@ -625,6 +625,60 @@ class IsisConnector { } /** + * Check if a field result has a main item. + * + * @param $field + * Field data. + * + * @param $row + * Row number. + * + * @return + * True if result has the main item, false otherwise. + */ + public function hasMainItem($field, $row) + { + $value = $this->getMainItem($field, $row); + + if (!empty($value)) { + return TRUE; + } + else { + return FALSE; + } + } + + /** + * Check if a field result has an item. + * + * @param $field + * Field data. + * + * @param $item + * Item code ('main' for the main item). + * + * @param $row + * Row number. + * + * @return + * True if result has the main item, false otherwise. + */ + public function hasItem($field, $item, $row = 0) + { + if ($item == 'main') + { + $has = $this->hasMainItem($field, $row); + } + else + { + $subfield = $this->getSubfieldName($this->getFieldKey($field), $item); + $has = $this->hasSubfield($field, $subfield, $row); + } + + return $has; + } + + /** * Get a subfield name. * * @param $field_key |