From 70539fe94d67cb4bdde7edce8a26873343d3c240 Mon Sep 17 00:00:00 2001 From: Silvio Date: Wed, 18 Aug 2010 12:00:21 -0300 Subject: Moving tests to apps folder --- apps/csv.php | 124 +++++++++++++++++++++++++++++++++++ apps/field.php | 51 +++++++++++++++ apps/index.php | 42 ++++++++++++ apps/malete.php | 181 +++++++++++++++++++++++++++++++++++++++++++++++++++ apps/phpisis.php | 29 +++++++++ apps/read.php | 51 +++++++++++++++ apps/repetition.php | 51 +++++++++++++++ apps/subfield.php | 56 ++++++++++++++++ apps/test.php | 28 ++++++++ config/config.yaml | 2 +- tests/csv.php | 124 ----------------------------------- tests/field.php | 51 --------------- tests/index.php | 42 ------------ tests/malete.php | 181 --------------------------------------------------- tests/phpisis.php | 30 --------- tests/read.php | 53 --------------- tests/repetition.php | 51 --------------- tests/subfield.php | 56 ---------------- tests/test.php | 33 ---------- 19 files changed, 614 insertions(+), 622 deletions(-) create mode 100644 apps/csv.php create mode 100644 apps/field.php create mode 100644 apps/index.php create mode 100644 apps/malete.php create mode 100644 apps/phpisis.php create mode 100644 apps/read.php create mode 100644 apps/repetition.php create mode 100644 apps/subfield.php create mode 100644 apps/test.php delete mode 100644 tests/csv.php delete mode 100644 tests/field.php delete mode 100644 tests/index.php delete mode 100644 tests/malete.php delete mode 100644 tests/phpisis.php delete mode 100644 tests/read.php delete mode 100644 tests/repetition.php delete mode 100644 tests/subfield.php delete mode 100644 tests/test.php diff --git a/apps/csv.php b/apps/csv.php new file mode 100644 index 0000000..e50249b --- /dev/null +++ b/apps/csv.php @@ -0,0 +1,124 @@ +', '', $field); +} + +/** + * Merge fields in a single cel. + * + * @param $data + * Array with field data. + * + * @param $field + * Field name. + * + * @return + * Cel with merged fields. + */ +function merge_fields($data, $field) { + $cel = ''; + $sep = (count($data) > 1) ? '; ': ''; + foreach ($data as $subkey => $subvalue) { + $cel = $cel . $data[$subkey][$field] . $sep; + } + + return $cel; +} + +// Import Cinisis Library. +require_once '../index.php'; + +// Get a db instance. +$isis = new CinisisDb(); + +// Test connection. +if ($isis->db) { + // Get format and number of entries. + $entries = $isis->db->entries(); + $format = $isis->db->format; + + // Prepare output. + header("Content-type: application/text/x-csv"); + header("Content-Disposition: attachment; filename=export.csv"); + header("Pragma: no-cache"); + header("Expires: 0"); + + // Format fields. + foreach ($format['fields'] as $field) { + echo csv($field['name']); + if (is_array($field['subfields'])) { + foreach ($field['subfields'] as $key => $value) { + echo csv($field['name'] .': '. $value); + } + } + } + + // New roll. + echo "\n"; + + // Format output. + for ($n = 1; $n <= $entries; $n++) { + $result = $isis->db->read($n); + + if ($result) { + // Filter results. + array_walk_recursive($result, 'filter'); + + foreach ($format['fields'] as $field) { + if (is_array($result[$field['name']])) { + // Print main field if needed. + if (is_array($result[$field['name']][0])) { + echo csv(); + } + else { + echo csv($result[$field['name']][0]); + } + } + else { + echo csv($result[$field['name']]); + } + if (is_array($field['subfields'])) { + foreach ($field['subfields'] as $key => $value) { + // Deals with subfield repetition. + if (isset($result[$field['name']][0][$value])) { + echo csv(merge_fields($result[$field['name']], $value)); + } + else { + echo csv($result[$field['name']][$value]); + } + } + } + } + + // New roll. + echo "\n"; + } + } +} diff --git a/apps/field.php b/apps/field.php new file mode 100644 index 0000000..b9f9c3a --- /dev/null +++ b/apps/field.php @@ -0,0 +1,51 @@ +form_input_text('entry', $entry); +$form .= $display->form_input_text('field', $field); +$display->form($form, 'field.php'); + +// Get a db instance. +$isis = new CinisisDb(); + +// 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--; + + // Query database. + do { + $result = $isis->db->read(++$entry); + if ($entry == $entries) { + break; + } + } while (!isset($result[$field_name])); + + // Navigation bar. + $display->navbar($entry, $entries, $repetition, '&field='. $field); + + // Format output. + echo "
\n";
+  echo "Selected field: $field: $field_name.\n";
+  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
+  echo "Repetitions found: ". count($result[$field_name]) .".\n";
+  echo "\n";
+  print_r($result[$field_name]);
+  echo '
'; +} + +$display->footer(); +?> diff --git a/apps/index.php b/apps/index.php new file mode 100644 index 0000000..b395b80 --- /dev/null +++ b/apps/index.php @@ -0,0 +1,42 @@ +form($display->form_input_text('entry', $entry)); + +// Get a db instance. +$isis = new CinisisDb(); + +// Setup database and entry number. +if ($isis->db) { + // Get the number of entries. + $entries = $isis->db->entries(); + + // Input sanitization. + if ($entries < $entry) { + $entry = 1; + } + + // Query database. + $result = $isis->db->read($entry); + $display->navbar($entry, $entries); + + // Format output. + echo "
\n";
+  echo "Showing entry $entry from $entries total entries.\n";
+  echo "\n";
+  print_r($result);
+  echo '
'; +} + +$display->footer(); +?> diff --git a/apps/malete.php b/apps/malete.php new file mode 100644 index 0000000..03451f2 --- /dev/null +++ b/apps/malete.php @@ -0,0 +1,181 @@ + + +Query + + 1, + 'Data' => 2, + 'Titulo' => 3, + 'Autor' => 4, + 'Assuntos primarios' => 5, + 'Assuntos secundarios' => 6, + 'Ilustrado' => 7, + 'Caderno' => 8, + 'Pagina' => 9, + 'Arquivo digital' => 10, + 'Forma documento' => 11, + 'Local de publicacao' => 12, + 'Observacoes' => 13, + 'Descritores imagem' => 14, + 'Termo geografico' => 16, + 'Coluna' => 17, + 'Recorte' => 19, + 'Alimentador' => 20, + 'Tema Anuario' => 21, + ); + + $fdt_tupi = array( + 'cod.titulo' => 1, + 'postopo' => 2, + 'num.entrada' => 3, + 'num.tombo' => 4, + 'datain' => 5, + 'dataex' => 6, + 'acervo (DIF ou PRE)' => 7, + 'cadarq' => 10, + 'caddep' => 11, + 'cadddl' => 12, + 'outarq' => 13, + 'categorias' => 15, + 'presok' => 16, + 'roteiro de locução' => 17, + 'mat.acervo' => 18, + 'mat.orig' => 19, + 'titulo' => 20, + 'outros titulos' => 22, + 'data/série' => 24, + 'conteudo/sinopse' => 25, + 'descritores' => 26, + 'descritores secundários' => 27, + 'identidades' => 28, + 'ndxlib' => 29, + 'materiais' => 40, + 'materiais' => 41, + 'materiais' => 42, + 'materiais' => 43, + 'materiais' => 44, + 'materiais' => 45, + 'mat' => 46, + 'mat' => 47, + 'mat' => 48, + 'mat' => 49, + 'mat' => 50, + 'mat' => 51, + 'mat' => 52, + 'mat' => 53, + 'mat' => 54, + 'mat' => 55, + 'evol.estado tec.' => 56, + 'movimentacao' => 57, + 'movimentacao' => 58, + 'obsmat' => 59, + 'producao*' => 60, + 'dir.arte*' => 61, + 'fotografia*' => 62, + 'musica*' => 63, + 'som*' => 64, + 'montagem*' => 65, + 'direcao*' => 66, + 'arg/roteiro*' => 67, + 'distribuicao*' => 68, + 'colab./outros' => 69, + 'producao1' => 70, + 'dir.arte1' => 71, + 'fotografia1' => 72, + 'musica1' => 73, + 'som1' => 74, + 'montagem1' => 75, + 'producao2(res.p/expandir)' => 80, + 'dir.arte2(res.p/expandir)' => 81, + 'fotografia2(res.p/expandir)' => 82, + 'musica2(res.p/expandir)' => 83, + 'som2(res.p/expandir)' => 84, + 'loc.prod.lan' => 85, + 'dat.prod.lan' => 86, + 'lab/est/locacoes' => 87, + 'premios' => 88, + 'fontes' => 89, + 'certificados' => 95, + 'examinador' => 98, + 'observações' => 99, + 'termos geográficos' => 165, + 'quicktime' => 900, + 'revisão' => 901, + 'vídeo' => 902, + ); + + //$db = 'tupi'; + $db = 'anu10'; + $fdt = ${'fdt_'. $db}; +?> + +

server

+ +srv->sock) { + echo "could not contact server\n"; + } + else { + //print_r($db); +?> + +

number of records...

+ +num_recs($query); + echo "got ",count($recs), " terms for '$query'
\n"; +?> + +

terms beginning with...

+ +terms(strtoupper($query)); + echo "got ",count($terms), " terms for '$query'
\n"; + foreach ($terms as $t) { + list($cnt, $term) = explode("\t", $t); + echo "'$term'($cnt) "; + } + echo "
\n"; +?> + +

query reading records

+ +query(strtoupper($query)); + echo "got ",count($recs), " records for '$query'
\n"; + foreach ($recs as $r) { + echo "
---\n", $r->toString(), "---\n
\n"; + } +?> + +

query reading a record

+ +read(6); + echo "
---\n", $r->toString(), "---\n

\n"; + echo '
';
+    //print_r($r);
+    //print_r($r->val[8]);
+    //print_r(preg_split('/\t/', $r->val[7]));
+    //print_r(array_flip($fdt_anu10));
+    echo '
'; + } // end else could contact server + +?> + + diff --git a/apps/phpisis.php b/apps/phpisis.php new file mode 100644 index 0000000..75326f1 --- /dev/null +++ b/apps/phpisis.php @@ -0,0 +1,29 @@ + + +

Testing pecl-isis

+'; + + $result = isis_search('$', $db); + while ($record = isis_fetch_flat_array($result) ) { + print (" MFN: $record[mfn]\n"); + for ($i=0; $i\n". + " $tag\n". + " ".htmlspecialchars($value)."\n". + " \n"); + } + } + echo ''; +?> + + diff --git a/apps/read.php b/apps/read.php new file mode 100644 index 0000000..835ae60 --- /dev/null +++ b/apps/read.php @@ -0,0 +1,51 @@ + + + + + array( + 'implementation' => 'PhpIsis', + 'database' => 'dbname', + ), + 1 => array( + 'implementation' => 'BiblioIsis', + 'database' => 'dbname', + ), +); + +foreach ($configs as $config) { + // Get a db instance. + $isis = new CinisisDb($config); + + // Test connection. + if ($isis->db) { + $result = $isis->db->read(1); + $entries = $isis->db->entries(); + + // Format output. + echo ''; + } +} + +?> + +
'; + echo '
';
+    echo 'Implementation: '. $config['implementation'] ."\n";
+    echo "Rows: $entries\n";
+    print_r($result);
+    echo '
'; + echo '
+ diff --git a/apps/repetition.php b/apps/repetition.php new file mode 100644 index 0000000..37d0889 --- /dev/null +++ b/apps/repetition.php @@ -0,0 +1,51 @@ +form_input_text('entry', $entry); +$form .= $display->form_input_text('field', $field); +$display->form($form, 'repetition.php'); + +// Get a db instance. +$isis = new CinisisDb(); + +// 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--; + + // Query database. + do { + $result = $isis->db->read(++$entry); + if ($entry == $entries) { + break; + } + } while (!isset($result[$field_name]) || count($result[$field_name]) < 2); + + // Navigation bar. + $display->navbar($entry, $entries, $repetition, '&field='. $field); + + // Format output. + echo "
\n";
+  echo "Selected field: $field: $field_name.\n";
+  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
+  echo "Repetitions found: ". count($result[$field_name]) .".\n";
+  echo "\n";
+  print_r($result[$field_name]);
+  echo '
'; +} + +$display->footer(); +?> diff --git a/apps/subfield.php b/apps/subfield.php new file mode 100644 index 0000000..117b8ce --- /dev/null +++ b/apps/subfield.php @@ -0,0 +1,56 @@ +form_input_text('entry', $entry); +$form .= $display->form_input_text('field', $field); +$form .= $display->form_input_text('subfield', $subfield); +$display->form($form, 'subfield.php'); + +// Get a db instance. +$isis = new CinisisDb(); + +// 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--; + + // Query database. + do { + $result = $isis->db->read(++$entry); + if ($entry == $entries) { + break; + } + } while (!isset($result[$field_name][0][$subfield_name])); + + // Navigation bar. + $display->navbar($entry, $entries, $repetition, '&field='. $field . '&subfield='. $subfield); + + // Format output. + $link = $display->entry_link($entry); + echo "
\n";
+  echo "Selected field: $field: $field_name.\n";
+  echo "Selected subfield: $subfield: $subfield_name.\n";
+  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
+  echo "Repetitions found: ". count($result[$field]) .".\n";
+  echo "\n";
+  print_r($result[$field_name]);
+  echo '
'; +} + +$display->footer(); +?> diff --git a/apps/test.php b/apps/test.php new file mode 100644 index 0000000..2b1fe5c --- /dev/null +++ b/apps/test.php @@ -0,0 +1,28 @@ +db) { + $result = $isis->db->read(1); + $entries = $isis->db->entries(); + + // Format output. + echo '
';
+  echo "Connection test:\n";
+  echo "Rows: $entries\n";
+  print_r($result);
+  echo '
'; +} + +$display->footer(); diff --git a/config/config.yaml b/config/config.yaml index 0f81b48..a8ab772 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -1,3 +1,3 @@ --- implementation: BiblioIsis -database: film +database: poster diff --git a/tests/csv.php b/tests/csv.php deleted file mode 100644 index e50249b..0000000 --- a/tests/csv.php +++ /dev/null @@ -1,124 +0,0 @@ -', '', $field); -} - -/** - * Merge fields in a single cel. - * - * @param $data - * Array with field data. - * - * @param $field - * Field name. - * - * @return - * Cel with merged fields. - */ -function merge_fields($data, $field) { - $cel = ''; - $sep = (count($data) > 1) ? '; ': ''; - foreach ($data as $subkey => $subvalue) { - $cel = $cel . $data[$subkey][$field] . $sep; - } - - return $cel; -} - -// Import Cinisis Library. -require_once '../index.php'; - -// Get a db instance. -$isis = new CinisisDb(); - -// Test connection. -if ($isis->db) { - // Get format and number of entries. - $entries = $isis->db->entries(); - $format = $isis->db->format; - - // Prepare output. - header("Content-type: application/text/x-csv"); - header("Content-Disposition: attachment; filename=export.csv"); - header("Pragma: no-cache"); - header("Expires: 0"); - - // Format fields. - foreach ($format['fields'] as $field) { - echo csv($field['name']); - if (is_array($field['subfields'])) { - foreach ($field['subfields'] as $key => $value) { - echo csv($field['name'] .': '. $value); - } - } - } - - // New roll. - echo "\n"; - - // Format output. - for ($n = 1; $n <= $entries; $n++) { - $result = $isis->db->read($n); - - if ($result) { - // Filter results. - array_walk_recursive($result, 'filter'); - - foreach ($format['fields'] as $field) { - if (is_array($result[$field['name']])) { - // Print main field if needed. - if (is_array($result[$field['name']][0])) { - echo csv(); - } - else { - echo csv($result[$field['name']][0]); - } - } - else { - echo csv($result[$field['name']]); - } - if (is_array($field['subfields'])) { - foreach ($field['subfields'] as $key => $value) { - // Deals with subfield repetition. - if (isset($result[$field['name']][0][$value])) { - echo csv(merge_fields($result[$field['name']], $value)); - } - else { - echo csv($result[$field['name']][$value]); - } - } - } - } - - // New roll. - echo "\n"; - } - } -} diff --git a/tests/field.php b/tests/field.php deleted file mode 100644 index b9f9c3a..0000000 --- a/tests/field.php +++ /dev/null @@ -1,51 +0,0 @@ -form_input_text('entry', $entry); -$form .= $display->form_input_text('field', $field); -$display->form($form, 'field.php'); - -// Get a db instance. -$isis = new CinisisDb(); - -// 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--; - - // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name])); - - // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field); - - // Format output. - echo "
\n";
-  echo "Selected field: $field: $field_name.\n";
-  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
-  echo "Repetitions found: ". count($result[$field_name]) .".\n";
-  echo "\n";
-  print_r($result[$field_name]);
-  echo '
'; -} - -$display->footer(); -?> diff --git a/tests/index.php b/tests/index.php deleted file mode 100644 index b395b80..0000000 --- a/tests/index.php +++ /dev/null @@ -1,42 +0,0 @@ -form($display->form_input_text('entry', $entry)); - -// Get a db instance. -$isis = new CinisisDb(); - -// Setup database and entry number. -if ($isis->db) { - // Get the number of entries. - $entries = $isis->db->entries(); - - // Input sanitization. - if ($entries < $entry) { - $entry = 1; - } - - // Query database. - $result = $isis->db->read($entry); - $display->navbar($entry, $entries); - - // Format output. - echo "
\n";
-  echo "Showing entry $entry from $entries total entries.\n";
-  echo "\n";
-  print_r($result);
-  echo '
'; -} - -$display->footer(); -?> diff --git a/tests/malete.php b/tests/malete.php deleted file mode 100644 index 03451f2..0000000 --- a/tests/malete.php +++ /dev/null @@ -1,181 +0,0 @@ - - -Query - - 1, - 'Data' => 2, - 'Titulo' => 3, - 'Autor' => 4, - 'Assuntos primarios' => 5, - 'Assuntos secundarios' => 6, - 'Ilustrado' => 7, - 'Caderno' => 8, - 'Pagina' => 9, - 'Arquivo digital' => 10, - 'Forma documento' => 11, - 'Local de publicacao' => 12, - 'Observacoes' => 13, - 'Descritores imagem' => 14, - 'Termo geografico' => 16, - 'Coluna' => 17, - 'Recorte' => 19, - 'Alimentador' => 20, - 'Tema Anuario' => 21, - ); - - $fdt_tupi = array( - 'cod.titulo' => 1, - 'postopo' => 2, - 'num.entrada' => 3, - 'num.tombo' => 4, - 'datain' => 5, - 'dataex' => 6, - 'acervo (DIF ou PRE)' => 7, - 'cadarq' => 10, - 'caddep' => 11, - 'cadddl' => 12, - 'outarq' => 13, - 'categorias' => 15, - 'presok' => 16, - 'roteiro de locução' => 17, - 'mat.acervo' => 18, - 'mat.orig' => 19, - 'titulo' => 20, - 'outros titulos' => 22, - 'data/série' => 24, - 'conteudo/sinopse' => 25, - 'descritores' => 26, - 'descritores secundários' => 27, - 'identidades' => 28, - 'ndxlib' => 29, - 'materiais' => 40, - 'materiais' => 41, - 'materiais' => 42, - 'materiais' => 43, - 'materiais' => 44, - 'materiais' => 45, - 'mat' => 46, - 'mat' => 47, - 'mat' => 48, - 'mat' => 49, - 'mat' => 50, - 'mat' => 51, - 'mat' => 52, - 'mat' => 53, - 'mat' => 54, - 'mat' => 55, - 'evol.estado tec.' => 56, - 'movimentacao' => 57, - 'movimentacao' => 58, - 'obsmat' => 59, - 'producao*' => 60, - 'dir.arte*' => 61, - 'fotografia*' => 62, - 'musica*' => 63, - 'som*' => 64, - 'montagem*' => 65, - 'direcao*' => 66, - 'arg/roteiro*' => 67, - 'distribuicao*' => 68, - 'colab./outros' => 69, - 'producao1' => 70, - 'dir.arte1' => 71, - 'fotografia1' => 72, - 'musica1' => 73, - 'som1' => 74, - 'montagem1' => 75, - 'producao2(res.p/expandir)' => 80, - 'dir.arte2(res.p/expandir)' => 81, - 'fotografia2(res.p/expandir)' => 82, - 'musica2(res.p/expandir)' => 83, - 'som2(res.p/expandir)' => 84, - 'loc.prod.lan' => 85, - 'dat.prod.lan' => 86, - 'lab/est/locacoes' => 87, - 'premios' => 88, - 'fontes' => 89, - 'certificados' => 95, - 'examinador' => 98, - 'observações' => 99, - 'termos geográficos' => 165, - 'quicktime' => 900, - 'revisão' => 901, - 'vídeo' => 902, - ); - - //$db = 'tupi'; - $db = 'anu10'; - $fdt = ${'fdt_'. $db}; -?> - -

server

- -srv->sock) { - echo "could not contact server\n"; - } - else { - //print_r($db); -?> - -

number of records...

- -num_recs($query); - echo "got ",count($recs), " terms for '$query'
\n"; -?> - -

terms beginning with...

- -terms(strtoupper($query)); - echo "got ",count($terms), " terms for '$query'
\n"; - foreach ($terms as $t) { - list($cnt, $term) = explode("\t", $t); - echo "'$term'($cnt) "; - } - echo "
\n"; -?> - -

query reading records

- -query(strtoupper($query)); - echo "got ",count($recs), " records for '$query'
\n"; - foreach ($recs as $r) { - echo "
---\n", $r->toString(), "---\n
\n"; - } -?> - -

query reading a record

- -read(6); - echo "
---\n", $r->toString(), "---\n

\n"; - echo '
';
-    //print_r($r);
-    //print_r($r->val[8]);
-    //print_r(preg_split('/\t/', $r->val[7]));
-    //print_r(array_flip($fdt_anu10));
-    echo '
'; - } // end else could contact server - -?> - - diff --git a/tests/phpisis.php b/tests/phpisis.php deleted file mode 100644 index d04fbd9..0000000 --- a/tests/phpisis.php +++ /dev/null @@ -1,30 +0,0 @@ - - -

Testing pecl-isis

-'; - - $result = isis_search('$', $db); - while ($record = isis_fetch_flat_array($result) ) { - print (" MFN: $record[mfn]\n"); - for ($i=0; $i\n". - " $tag\n". - " ".htmlspecialchars($value)."\n". - " \n"); - } - } - echo ''; -?> - - diff --git a/tests/read.php b/tests/read.php deleted file mode 100644 index 92dc1c3..0000000 --- a/tests/read.php +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - array( - 'implementation' => 'PhpIsis', - 'database' => 'anu10', - ), - 1 => array( - 'implementation' => 'BiblioIsis', - 'database' => 'anu10', - ), -); - -foreach ($configs as $config) { - // Get a db instance. - $isis = new CinisisDb($config); - - // Test connection. - if ($isis->db) { - $result = $isis->db->read(1); - $entries = $isis->db->entries(); - - // Format output. - echo ''; - } -} - -?> - -
'; - echo '
';
-    echo 'Implementation: '. $config['implementation'] ."\n";
-    echo "Rows: $entries\n";
-    print_r($result);
-    echo '
'; - echo '
- diff --git a/tests/repetition.php b/tests/repetition.php deleted file mode 100644 index 37d0889..0000000 --- a/tests/repetition.php +++ /dev/null @@ -1,51 +0,0 @@ -form_input_text('entry', $entry); -$form .= $display->form_input_text('field', $field); -$display->form($form, 'repetition.php'); - -// Get a db instance. -$isis = new CinisisDb(); - -// 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--; - - // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name]) || count($result[$field_name]) < 2); - - // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field); - - // Format output. - echo "
\n";
-  echo "Selected field: $field: $field_name.\n";
-  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
-  echo "Repetitions found: ". count($result[$field_name]) .".\n";
-  echo "\n";
-  print_r($result[$field_name]);
-  echo '
'; -} - -$display->footer(); -?> diff --git a/tests/subfield.php b/tests/subfield.php deleted file mode 100644 index 117b8ce..0000000 --- a/tests/subfield.php +++ /dev/null @@ -1,56 +0,0 @@ -form_input_text('entry', $entry); -$form .= $display->form_input_text('field', $field); -$form .= $display->form_input_text('subfield', $subfield); -$display->form($form, 'subfield.php'); - -// Get a db instance. -$isis = new CinisisDb(); - -// 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--; - - // Query database. - do { - $result = $isis->db->read(++$entry); - if ($entry == $entries) { - break; - } - } while (!isset($result[$field_name][0][$subfield_name])); - - // Navigation bar. - $display->navbar($entry, $entries, $repetition, '&field='. $field . '&subfield='. $subfield); - - // Format output. - $link = $display->entry_link($entry); - echo "
\n";
-  echo "Selected field: $field: $field_name.\n";
-  echo "Selected subfield: $subfield: $subfield_name.\n";
-  echo "Showing entry ". $display->entry_link($entry) ." from $entries total entries.\n";
-  echo "Repetitions found: ". count($result[$field]) .".\n";
-  echo "\n";
-  print_r($result[$field_name]);
-  echo '
'; -} - -$display->footer(); -?> diff --git a/tests/test.php b/tests/test.php deleted file mode 100644 index 5a96e3b..0000000 --- a/tests/test.php +++ /dev/null @@ -1,33 +0,0 @@ - - - - -db) { - $result = $isis->db->read(1); - $entries = $isis->db->entries(); - - // Format output. - echo '
';
-  echo "Connection test:\n";
-  echo "Rows: $entries\n";
-  print_r($result);
-  echo '
'; -} - -?> - -- cgit v1.2.3