diff options
author | Silvio <silvio@devlet.com.br> | 2010-08-19 17:50:42 -0300 |
---|---|---|
committer | Silvio <silvio@devlet.com.br> | 2010-08-19 17:50:42 -0300 |
commit | c8a371afff72055285a6db9729bda0bacb90f9e3 (patch) | |
tree | 9cfb1b1f61fa165e1bc5bc236d29364b6c9265d5 | |
parent | 5c4d0bf21d6ddf98d3907bff5644263d0eba39bc (diff) | |
download | cinisis-c8a371afff72055285a6db9729bda0bacb90f9e3.tar.gz cinisis-c8a371afff72055285a6db9729bda0bacb90f9e3.tar.bz2 |
Fixing audit
-rw-r--r-- | apps/field.php | 2 | ||||
-rw-r--r-- | apps/repetition.php | 2 | ||||
-rw-r--r-- | apps/subfield.php | 2 | ||||
-rw-r--r-- | classes/IsisAudit.php | 24 | ||||
-rw-r--r-- | classes/IsisFinder.php | 6 |
5 files changed, 16 insertions, 20 deletions
diff --git a/apps/field.php b/apps/field.php index 193d351..3d36df6 100644 --- a/apps/field.php +++ b/apps/field.php @@ -23,7 +23,7 @@ $isis = new IsisFinder(); if ($isis) { // Query database. $field = $isis->getFieldArray($fid); - list($entry, $result) = $isis->nextField($entry, $field); + list($entry, $result) = $isis->nextField($field, $entry); // Navigation bar. $display->navbar($entry, $isis->entries, 'field.php', '&fid='. $fid); diff --git a/apps/repetition.php b/apps/repetition.php index 0e2718c..a45e6f4 100644 --- a/apps/repetition.php +++ b/apps/repetition.php @@ -23,7 +23,7 @@ $isis = new IsisFinder(); if ($isis) { // Query database. $field = $isis->getFieldArray($fid); - list($entry, $result) = $isis->nextRepetition($entry, $field); + list($entry, $result) = $isis->nextRepetition($field, $entry); // Navigation bar. $display->navbar($entry, $isis->entries, 'repetition.php', '&fid='. $fid); diff --git a/apps/subfield.php b/apps/subfield.php index ca7557e..a7a33f2 100644 --- a/apps/subfield.php +++ b/apps/subfield.php @@ -26,7 +26,7 @@ if ($isis) { // Query database. $field = $isis->getFieldArray($fid); $subfield = $isis->getSubfieldName($fid, $sid); - list($entry, $result) = $isis->nextSubfield($entry, $field, $subfield); + list($entry, $result) = $isis->nextSubfield($field, $subfield, $entry); // Navigation bar. $display->navbar($entry, $isis->entries, 'subfield.php', '&fid='. $fid . '&sid='. $sid); diff --git a/classes/IsisAudit.php b/classes/IsisAudit.php index 79cbe26..63446e1 100644 --- a/classes/IsisAudit.php +++ b/classes/IsisAudit.php @@ -6,31 +6,27 @@ class IsisAudit extends IsisFinder { /** * Run a standard audit procedure. - * - * @todo - * Test. */ public function run() { foreach ($this->format['fields'] as $field) { - $field_name = $this->getFieldName($field); - $repetition = $this->nextRepetition(null, $field_name); + $repetition = $this->nextRepetition($field); // Check for repetitions. - if ($field['repeat'] && !$repetition) - { - echo "Field $field_name is configured for repetitions but no repetitions found.\n"; + if ($field['repeat'] && !$repetition) { + echo "Field ". $field['name'] ." is configured for repetitions but no repetitions found.\n"; } elseif (!$field['repeat'] && $repetition) { - echo "Field $field_name is not configured for repetitions but a repetition was found.\n"; + echo "Field ". $field['name'] ." is not configured for repetitions but a repetition was found for entry ". $repetition[0] .".\n"; } // Check for subfields. - foreach ($field['subfields'] as $subfield) { - $subfield_name = $this->getSubfieldName($field, $subfield); - $next_subfield = $isis->nextSubfield(null, $field_name, $subfield_name); + if (isset($field['subfields'])) { + foreach ($field['subfields'] as $subfield) { + $next_subfield = $this->nextSubfield($field, $subfield); - if (!$next_subfield) { - echo "No occurrences found for field $field_name and subfield $subfield_name\n"; + if (!$next_subfield) { + echo "No occurrences found for field ". $field['name'] ." and subfield $subfield\n"; + } } } } diff --git a/classes/IsisFinder.php b/classes/IsisFinder.php index 26430c6..7f7405d 100644 --- a/classes/IsisFinder.php +++ b/classes/IsisFinder.php @@ -16,7 +16,7 @@ class IsisFinder extends IsisConnector { * @return * Next repetition entry and result. */ - public function nextRepetition($entry = 1, $field) { + public function nextRepetition($field, $entry = 1) { foreach(new IsisEntryIterator($this, $entry) as $entry => $result) { if (count($this->getValues($field)) >= 2) { return array($entry, $result); @@ -38,7 +38,7 @@ class IsisFinder extends IsisConnector { * @return * Next occurrence. */ - public function nextField($entry = 1, $field) { + public function nextField($field, $entry = 1) { foreach(new IsisEntryIterator($this, $entry) as $entry => $result) { if (count($this->getValues($field)) > 0) { return array($entry, $result); @@ -63,7 +63,7 @@ class IsisFinder extends IsisConnector { * @return * Next occurrence. */ - public function nextSubfield($entry = 1, $field, $subfield) { + public function nextSubfield($field, $subfield, $entry = 1) { foreach(new IsisEntryIterator($this, $entry) as $entry => $result) { if ($this->hasSubfieldInRows($field, $subfield) !== FALSE) { return array($entry, $result); |