aboutsummaryrefslogtreecommitdiff
path: root/apps/search.php
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-20 18:49:49 -0300
committerSilvio <silvio@devlet.com.br>2010-08-20 18:49:49 -0300
commit0956138b3dae192c3bb8db2b769e7526d1ec489e (patch)
tree92332864a3f747fa68dd83407ca85527fcd07b81 /apps/search.php
parente713d07bb78d6160fcb428a9f7c39891b4b07ef0 (diff)
downloadcinisis-0956138b3dae192c3bb8db2b769e7526d1ec489e.tar.gz
cinisis-0956138b3dae192c3bb8db2b769e7526d1ec489e.tar.bz2
Adding simple search app
Diffstat (limited to 'apps/search.php')
-rw-r--r--apps/search.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/apps/search.php b/apps/search.php
new file mode 100644
index 0000000..cd75339
--- /dev/null
+++ b/apps/search.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Cinisis - Isis db reading tool.
+ *
+ * @todo
+ * Checkbox for $match.
+ */
+
+// Import requisites.
+require_once '../index.php';
+
+// Get input data.
+$entry = CinisisHttpHelper::getNumericArg('entry');
+$fid = CinisisHttpHelper::getNumericArg('fid');
+$sid = CinisisHttpHelper::getTextualArg('sid');
+$text = CinisisHttpHelper::getTextualArg('text');
+
+// Draw the document.
+$display = new CinisisDisplayHelper('Text finder');
+$form = $display->formInputText('entry', $entry);
+$form .= $display->formInputText('fid', $fid);
+$form .= $display->formInputText('sid', $sid);
+$form .= $display->formInputText('text', $text);
+$script = basename(__FILE__);
+$display->form($form, $script);
+
+// Get a db instance.
+$isis = new IsisFinder();
+
+// Setup database and entry number.
+if ($isis) {
+ // Query database.
+ $field = $isis->getFieldArray($fid);
+ $item = ($sid == 'main') ? 'main' : $isis->getSubfieldName($fid, $sid);
+ list($entry, $result) = $isis->nextResult($field, $item, $text, $entry);
+
+ // Navigation bar.
+ $display->navbar($entry, $isis->entries, $script, '&fid='. $fid . '&sid='. $sid . '&text='. $text);
+
+ // Format output.
+ $display->pre("Selected field: $fid: ". $field['name'] .".");
+ $display->pre("Selected item: $sid: $item.");
+ $display->pre("Showing entry ". $display->entryLink($entry) ." from ". $isis->entries ." total entries.");
+ $display->pre("Repetitions found: ". count($result[$field['name']]) .".");
+ $display->dump($result[$field['name']]);
+}
+
+$display->footer();