aboutsummaryrefslogtreecommitdiff
path: root/classes/IsisConnector.php
diff options
context:
space:
mode:
Diffstat (limited to 'classes/IsisConnector.php')
-rw-r--r--classes/IsisConnector.php82
1 files changed, 78 insertions, 4 deletions
diff --git a/classes/IsisConnector.php b/classes/IsisConnector.php
index 6052454..a53c6d6 100644
--- a/classes/IsisConnector.php
+++ b/classes/IsisConnector.php
@@ -1,5 +1,9 @@
<?php
+/**
+ * IsisConnector: provides an easy interface to connect an
+ * application with Cinisis.
+ */
class IsisConnector {
/**
* Constructor.
@@ -19,6 +23,12 @@ class IsisConnector {
/**
* Alias to $isis->db->read().
+ *
+ * @param $row
+ * Row number.
+ *
+ * @return
+ * Resulting data.
*/
public function read($row) {
// Always store the last result.
@@ -30,6 +40,15 @@ class IsisConnector {
/**
* Get the value of a given field.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @param $row
+ * Optional row number if repetitive field.
+ *
+ * @return
+ * Field data.
*/
public function getField($field, $row = 0) {
if (isset($this->result[$field['name']][$row]['field'])) {
@@ -39,6 +58,15 @@ class IsisConnector {
/**
* Get the value of a given subfield.
+ *
+ * @param $field
+ * Field name.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @return
+ * Subfield data.
*/
public function getSubfield($field, $subfield, $row = 0) {
if (isset($this->result[$field['name']][$row]['subfields'][$subfield])) {
@@ -48,6 +76,9 @@ class IsisConnector {
/**
* Get the list of subfields from a given field.
+ *
+ * @param $field
+ * Subfield name.
*/
public function getSubfields($field) {
if (isset($field['subfields'])) {
@@ -57,8 +88,11 @@ class IsisConnector {
}
/**
- * Determine which model field an ISIS db field should
- * be mapped to.
+ * Determine which model field an ISIS db field should be mapped to.
+ * When importing an ISIS database to another system, a mapping
+ * provided in the database schema can be used to put the originating
+ * entries (fields and subfields) in the right place at the destination
+ * database.
*
* Map format:
*
@@ -82,8 +116,18 @@ class IsisConnector {
* field: title
* subfields:
* a: subtitle
- *
- * @todo Convert field and subfield names to valid field names.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @retrn
+ * A map destination to the field or subfield.
+ *
+ * @todo
+ * Convert field and subfield names to valid field names.
*/
public function getMap($field, $subfield = NULL) {
if ($subfield == NULL) {
@@ -114,6 +158,12 @@ class IsisConnector {
/**
* Get the mapping type of a given field.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @return
+ * The mapping type.
*/
public function getMapType($field) {
return isset($field['map']['type']) ? $field['map']['type'] : FALSE;
@@ -121,6 +171,12 @@ class IsisConnector {
/**
* Check on an ISIS schema whether a field has a map.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @return
+ * TRUE if field has a map, FALSE otherwise.
*/
public function fieldHasMap($field) {
if (isset($field['map']['field'])) {
@@ -131,6 +187,15 @@ class IsisConnector {
/**
* Check on an ISIS schema whether a subfield has a map.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @return
+ * TRUE if subfield has a map, FALSE otherwise.
*/
public function subfieldHasMap($field, $subfield) {
if (isset($field['map']['subfields'])) {
@@ -144,6 +209,15 @@ class IsisConnector {
/**
* Get the key of a subfield entry.
+ *
+ * @param $field
+ * Field number.
+ *
+ * @param $subfield
+ * Subfield name.
+ *
+ * @return
+ * Subfield keys.
*/
public function getSubfieldKey($field, $subfield) {
$keys = array_flip($field['subfields']);