aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/field.php18
-rw-r--r--apps/repetition.php18
-rw-r--r--apps/subfield.php26
-rw-r--r--classes/IsisConnector.php17
-rw-r--r--classes/IsisFinder.php16
-rw-r--r--config/config.yaml2
6 files changed, 57 insertions, 40 deletions
diff --git a/apps/field.php b/apps/field.php
index 563b2b0..cc79a20 100644
--- a/apps/field.php
+++ b/apps/field.php
@@ -7,13 +7,13 @@
require_once '../index.php';
// Get input data.
-$entry = CinisisHttpHelper::get_numeric_arg('entry');
-$field = CinisisHttpHelper::get_numeric_arg('field');
+$entry = CinisisHttpHelper::get_numeric_arg('entry');
+$field_key = CinisisHttpHelper::get_numeric_arg('field_key');
// Draw the document.
$display = new CinisisDisplayHelper('Field finder');
$form = $display->form_input_text('entry', $entry);
-$form .= $display->form_input_text('field', $field);
+$form .= $display->form_input_text('field_key', $field_key);
$display->form($form, basename(__FILE__));
// Get a db instance.
@@ -22,19 +22,19 @@ $isis = new IsisFinder();
// Setup database and entry number.
if ($isis) {
// Query database.
- $field_name = $isis->getFieldName($field);
- list($entry, $result) = $isis->nextField($entry, $field_name);
+ $field = $isis->getFieldArray($field_key);
+ list($entry, $result) = $isis->nextField($entry, $field);
// Navigation bar.
- $display->navbar($entry, $isis->entries, $repetition, '&field='. $field);
+ $display->navbar($entry, $isis->entries, $repetition, '&field_key='. $field_key);
// Format output.
echo "<pre>\n";
- echo "Selected field: $field: $field_name.\n";
+ echo "Selected field: $field_key: ". $field['name'] ."\n";
echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
- echo "Repetitions found: ". count($result[$field_name]) .".\n";
+ echo "Repetitions found: ". count($result[$field['name']]) .".\n";
echo "\n";
- print_r($result[$field_name]);
+ print_r($result[$field['name']]);
echo '</pre>';
}
diff --git a/apps/repetition.php b/apps/repetition.php
index b2f25c9..a206976 100644
--- a/apps/repetition.php
+++ b/apps/repetition.php
@@ -7,13 +7,13 @@
require_once '../index.php';
// Get input data.
-$entry = CinisisHttpHelper::get_numeric_arg('entry');
-$field = CinisisHttpHelper::get_numeric_arg('field');
+$entry = CinisisHttpHelper::get_numeric_arg('entry');
+$field_key = CinisisHttpHelper::get_numeric_arg('field_key');
// Draw the document.
$display = new CinisisDisplayHelper('Repetition finder');
$form = $display->form_input_text('entry', $entry);
-$form .= $display->form_input_text('field', $field);
+$form .= $display->form_input_text('field_key', $field_key);
$display->form($form, basename(__FILE__));
// Get a db instance.
@@ -22,19 +22,19 @@ $isis = new IsisFinder();
// Setup database and entry number.
if ($isis) {
// Query database.
- $field_name = $isis->getFieldName($field);
- list($entry, $result) = $isis->nextRepetition($entry, $field_name);
+ $field = $isis->getFieldArray($field_key);
+ list($entry, $result) = $isis->nextRepetition($entry, $field);
// Navigation bar.
- $display->navbar($entry, $isis->entries, $repetition, '&field='. $field);
+ $display->navbar($entry, $isis->entries, $repetition, '&field_key='. $field_key);
// Format output.
echo "<pre>\n";
- echo "Selected field: $field: $field_name.\n";
+ echo "Selected field: $field_key: ". $field['name'] ."\n";
echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
- echo "Repetitions found: ". count($result[$field_name]) .".\n";
+ echo "Repetitions found: ". count($result[$field['name']]) .".\n";
echo "\n";
- print_r($result[$field_name]);
+ print_r($result[$field['name']]);
echo '</pre>';
}
diff --git a/apps/subfield.php b/apps/subfield.php
index a4c804a..4694d74 100644
--- a/apps/subfield.php
+++ b/apps/subfield.php
@@ -7,15 +7,15 @@
require_once '../index.php';
// Get input data.
-$entry = CinisisHttpHelper::get_numeric_arg('entry');
-$field = CinisisHttpHelper::get_numeric_arg('field');
-$subfield = CinisisHttpHelper::get_textual_arg('subfield');
+$entry = CinisisHttpHelper::get_numeric_arg('entry');
+$field_key = CinisisHttpHelper::get_numeric_arg('field_key');
+$subfield_key = CinisisHttpHelper::get_textual_arg('subfield_key');
// Draw the document.
$display = new CinisisDisplayHelper('Subfield finder');
$form = $display->form_input_text('entry', $entry);
-$form .= $display->form_input_text('field', $field);
-$form .= $display->form_input_text('subfield', $subfield);
+$form .= $display->form_input_text('field_key', $field_key);
+$form .= $display->form_input_text('subfield_key', $subfield_key);
$display->form($form, basename(__FILE__));
// Get a db instance.
@@ -24,21 +24,21 @@ $isis = new IsisFinder();
// Setup database and entry number.
if ($isis) {
// Query database.
- $field_name = $isis->getFieldName($field);
- $subfield_name = $isis->getSubfieldName($field, $subfield);
- list($entry, $result) = $isis->nextSubfield($entry, $field_name, $subfield_name);
+ $field = $isis->getFieldArray($field_key);
+ $subfield = $isis->getSubfieldName($field_key, $subfield_key);
+ list($entry, $result) = $isis->nextSubfield($entry, $field, $subfield);
// Navigation bar.
- $display->navbar($entry, $isis->entries, $repetition, '&field='. $field . '&subfield='. $subfield);
+ $display->navbar($entry, $isis->entries, $repetition, '&field_key='. $field_key . '&subfield_key='. $subfield_key);
// Format output.
echo "<pre>\n";
- echo "Selected field: $field: $field_name.\n";
- echo "Selected subfield: $subfield: $subfield_name.\n";
+ echo "Selected field: $field_key: ". $field['name'] .".\n";
+ echo "Selected subfield: $subfield_key: $subfield.\n";
echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
- echo "Repetitions found: ". count($result[$field]) .".\n";
+ echo "Repetitions found: ". count($result[$field['name']]) .".\n";
echo "\n";
- print_r($result[$field_name]);
+ print_r($result[$field['name']]);
echo '</pre>';
}
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php
index 64a6c59..09bb8ea 100644
--- a/classes/IsisConnector.php
+++ b/classes/IsisConnector.php
@@ -448,6 +448,23 @@ class IsisConnector {
}
/**
+ * Get the array which defines a field.
+ *
+ * @param $field_key
+ * Field key.
+ *
+ * @return
+ * Field array.
+ */
+ public function getFieldArray($field_key) {
+ if (isset($this->format['fields'][$field_key])) {
+ return $this->format['fields'][$field_key];
+ }
+
+ return NULL;
+ }
+
+ /**
* Remove brackets from strings whithin an array.
*
* @param $value
diff --git a/classes/IsisFinder.php b/classes/IsisFinder.php
index 1f8ed0f..a87488f 100644
--- a/classes/IsisFinder.php
+++ b/classes/IsisFinder.php
@@ -11,7 +11,7 @@ class IsisFinder extends IsisConnector {
* Start entry number to begin the search.
*
* @param $field
- * Field name.
+ * Field data.
*
* @return
* Next repetition entry and result.
@@ -25,9 +25,9 @@ class IsisFinder extends IsisConnector {
if ($entry == $entries) {
break;
}
- } while (!isset($result[$field]) || count($result[$field]) < 2);
+ } while (!isset($result[$field['name']]) || count($result[$field['name']]) < 2);
- if (!isset($result[$field]) || count($result[$field]) < 2) {
+ if (!isset($result[$field['name']]) || count($result[$field['name']]) < 2) {
return FALSE;
}
@@ -41,7 +41,7 @@ class IsisFinder extends IsisConnector {
* Start entry number to begin the search.
*
* @param $field
- * Field name.
+ * Field data.
*
* @return
* Next occurrence.
@@ -55,9 +55,9 @@ class IsisFinder extends IsisConnector {
if ($entry == $entries) {
break;
}
- } while (!isset($result[$field]));
+ } while (!isset($result[$field['name']]));
- if (!isset($result[$field])) {
+ if (!isset($result[$field['name']])) {
return FALSE;
}
@@ -71,7 +71,7 @@ class IsisFinder extends IsisConnector {
* Start entry number to begin the search.
*
* @param $field
- * Field name.
+ * Field data.
*
* @param $subfield
* Subfield name.
@@ -94,7 +94,7 @@ class IsisFinder extends IsisConnector {
$has = $this->hasSubfieldInRows($field, $subfield);
} while ($has === FALSE);
- if (!isset($result[$field][$has][$subfield])) {
+ if (!$this->hasSubfield($field, $subfield, $has)) {
return FALSE;
}
diff --git a/config/config.yaml b/config/config.yaml
index a8ab772..0f81b48 100644
--- a/config/config.yaml
+++ b/config/config.yaml
@@ -1,3 +1,3 @@
---
implementation: BiblioIsis
-database: poster
+database: film