diff options
Diffstat (limited to 'apps')
-rw-r--r-- | apps/audit.php | 26 | ||||
-rw-r--r-- | apps/csv.php | 2 | ||||
-rw-r--r-- | apps/field.php | 21 | ||||
-rw-r--r-- | apps/index.php | 2 | ||||
-rw-r--r-- | apps/repetition.php | 21 | ||||
-rw-r--r-- | apps/subfield.php | 24 |
6 files changed, 47 insertions, 49 deletions
diff --git a/apps/audit.php b/apps/audit.php new file mode 100644 index 0000000..28237b0 --- /dev/null +++ b/apps/audit.php @@ -0,0 +1,26 @@ +<?php +/** + * Cinisis - Isis db reading tool. + */ + +// Import requisites. +require_once '../index.php'; + +// Draw the document. +$display = new CinisisDisplayHelper('Database audit'); + +// Get a db instance. +$isis = new IsisAudit(); + +// Setup database and entry number. +if ($isis) { + // Run audit. + $result = $isis->run(); + + // Format output. + echo "<pre>\n"; + print_r($result); + echo '</pre>'; +} + +$display->footer(); diff --git a/apps/csv.php b/apps/csv.php index e50249b..ae99ad0 100644 --- a/apps/csv.php +++ b/apps/csv.php @@ -56,7 +56,7 @@ function merge_fields($data, $field) { require_once '../index.php'; // Get a db instance. -$isis = new CinisisDb(); +$isis = new Cinisis(); // Test connection. if ($isis->db) { diff --git a/apps/field.php b/apps/field.php index 13320e6..f34bffa 100644 --- a/apps/field.php +++ b/apps/field.php @@ -14,28 +14,19 @@ $field = CinisisHttpHelper::get_numeric_arg('field'); $display = new CinisisDisplayHelper('Field finder'); $form = $display->form_input_text('entry', $entry); $form .= $display->form_input_text('field', $field); -$display->form($form, 'field.php'); +$display->form($form, basename(__FILE__)); // Get a db instance. -$isis = new CinisisDb(); +$isis = new IsisFinder(); // Setup database and entry number. -if ($isis->db) { - // Get the number of entries. - $field_name = $isis->db->format['fields'][$field]['name']; - $entries = $isis->db->entries(); - $entry--; - +if ($isis) { // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name])); + $field_name = $isis->getFieldName($field); + $result = $isis->nextField($entry, $field_name); // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field); + $display->navbar($entry, $isis->entries, $repetition, '&field='. $field); // Format output. echo "<pre>\n"; diff --git a/apps/index.php b/apps/index.php index 54d7d0e..cd5e5bb 100644 --- a/apps/index.php +++ b/apps/index.php @@ -14,7 +14,7 @@ $display = new CinisisDisplayHelper('Isis Navigator'); $display->form($display->form_input_text('entry', $entry)); // Get a db instance. -$isis = new CinisisDb(); +$isis = new Cinisis(); // Setup database and entry number. if ($isis->db) { diff --git a/apps/repetition.php b/apps/repetition.php index 7c7f245..6b7f9de 100644 --- a/apps/repetition.php +++ b/apps/repetition.php @@ -14,28 +14,19 @@ $field = CinisisHttpHelper::get_numeric_arg('field'); $display = new CinisisDisplayHelper('Repetition finder'); $form = $display->form_input_text('entry', $entry); $form .= $display->form_input_text('field', $field); -$display->form($form, 'repetition.php'); +$display->form($form, basename(__FILE__)); // Get a db instance. -$isis = new CinisisDb(); +$isis = new IsisFinder(); // Setup database and entry number. -if ($isis->db) { - // Get the number of entries. - $field_name = $isis->db->format['fields'][$field]['name']; - $entries = $isis->db->entries(); - $entry--; - +if ($isis) { // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name]) || count($result[$field_name]) < 2); + $field_name = $isis->getFieldName($field); + $result = $isis->nextRepetition($entry, $field_name); // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field); + $display->navbar($entry, $isis->entries, $repetition, '&field='. $field); // Format output. echo "<pre>\n"; diff --git a/apps/subfield.php b/apps/subfield.php index 93de5a9..e3d5d75 100644 --- a/apps/subfield.php +++ b/apps/subfield.php @@ -16,32 +16,22 @@ $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); -$display->form($form, 'subfield.php'); +$display->form($form, basename(__FILE__)); // Get a db instance. -$isis = new CinisisDb(); +$isis = new IsisFinder(); // Setup database and entry number. -if ($isis->db) { - // Get the number of entries. - $field_name = $isis->db->format['fields'][$field]['name']; - $subfield_name = $isis->db->format['fields'][$field]['subfields'][$subfield]; - $entries = $isis->db->entries(); - $entry--; - +if ($isis) { // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name][0][$subfield_name])); + $field_name = $isis->getFieldName($field); + $subfield_name = $isis->getSubfieldName($field, $subfield); + $result = $isis->nextSubfield($entry, $field_name, $subfield_name); // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field . '&subfield='. $subfield); + $display->navbar($entry, $isis->entries, $repetition, '&field='. $field . '&subfield='. $subfield); // Format output. - $link = $display->entry_link($entry); echo "<pre>\n"; echo "Selected field: $field: $field_name.\n"; echo "Selected subfield: $subfield: $subfield_name.\n"; |