diff options
author | Silvio <silvio@devlet.com.br> | 2010-07-13 13:56:42 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-07-13 13:56:42 -0300 |
commit | e66cda93a6bb085aacf9ae90d74d7084378672b6 (patch) | |
tree | bc6f1a988b783f7d202ea8eb5fb9f133ce94fc37 /classes/IsisConnector.php | |
parent | 03ef493e69fa31c2fc56a0b4c626ff71bb44bc0b (diff) | |
download | cinisis-e66cda93a6bb085aacf9ae90d74d7084378672b6.tar.gz cinisis-e66cda93a6bb085aacf9ae90d74d7084378672b6.tar.bz2 |
Adding getSubfieldName() and hasSubfield() at IsisConnector
Diffstat (limited to 'classes/IsisConnector.php')
-rw-r--r-- | classes/IsisConnector.php | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php index 6ea24cf..710048a 100644 --- a/classes/IsisConnector.php +++ b/classes/IsisConnector.php @@ -456,8 +456,7 @@ class IsisConnector { * @return * Normalized field name */ - static function normalizeFieldName($name) - { + static function normalizeFieldName($name) { return ucfirst(preg_replace('/[^a-z0-9_]/', '', strtolower($name))); } @@ -470,8 +469,49 @@ class IsisConnector { * @return * Map name */ - static function mapName($name) - { + static function mapName($name) { return 'set'. self::normalizeFieldName($name); } + + /** + * Check if a field result has a given subfield. + * + * @param $field + * Field data. + * + * @param $subfield + * Subfield. + * + * @param $row + * Row number. + * + * @return + * True if result has the subfield, false otherwise. + */ + public function hasSubfield($field, $subfield, $row) { + $value = $this->getSubfield($field, $subfield, $row); + + if (!empty($value)) { + return TRUE; + } + else { + return FALSE; + } + } + + /** + * Get a subfield name. + * + * @param $field_key + * Field key. + * + * @param $subfield_key + * Subfield key. + * + * @return + * Subfield name. + */ + public function getSubfieldName($field_key, $subfield_key) { + return $this->format['fields'][$field_key]['subfields'][$subfield_key]; + } } |