From 1c7744d7b0298723bcc2783663b60cd8a2c0e67b Mon Sep 17 00:00:00 2001 From: Silvio Date: Tue, 27 Jul 2010 10:52:00 -0300 Subject: Moving join_subfields and main_field_name to CinisisDb --- classes/BiblioIsisDb.php | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) (limited to 'classes/BiblioIsisDb.php') diff --git a/classes/BiblioIsisDb.php b/classes/BiblioIsisDb.php index eca03e5..2fb02cf 100644 --- a/classes/BiblioIsisDb.php +++ b/classes/BiblioIsisDb.php @@ -258,7 +258,7 @@ class BiblioIsisDb implements IsisDb { } else { foreach ($name as $value) { - $data[] = array($this->main_field_name($key) => $value); + $data[] = array(CinisisDb::main_field_name($this->format, $key) => $value); } } @@ -333,10 +333,10 @@ class BiblioIsisDb implements IsisDb { } // Join subfields and main field if needed. - if ($this->join_subfields()) { + if (CinisisDb::join_subfields($this->format)) { $data[$entry] = $data[$entry]['subfields']; if (isset($field)) { - $data[$entry][$this->main_field_name($key)] = $field; + $data[$entry][CinisisDb::main_field_name($this->format, $key)] = $field; } } } @@ -344,43 +344,6 @@ class BiblioIsisDb implements IsisDb { return $data; } - /** - * Whether to join field and subfields in a single array. - * - * @return - * Boolean. - * - * @todo - * Should be added at IsisDb interface? - */ - public function join_subfields() { - if ($this->format['db']['join_subfields']) { - return TRUE; - } - - return FALSE; - } - - /** - * Determine the main field name depending on db configuration. - * - * @param $key - * Field key. - * - * @return - * Main field name, 'field' by default. - * - * @todo - * Should be added at IsisDb interface? - */ - public function main_field_name($key) { - if ($this->join_subfields()) { - return $this->format['fields'][$key]['name']; - } - - return 'field'; - } - /** * Deals with repetition. * -- cgit v1.2.3