From f29befe3b6f94962a19fd554cd66488db6ccc5fc Mon Sep 17 00:00:00 2001
From: Silvio <silvio@devlet.com.br>
Date: Tue, 24 Aug 2010 17:22:14 -0300
Subject: Mutual field<->subfield app link

---
 apps/field.php                           |  1 +
 apps/repetition.php                      |  1 +
 classes/helpers/CinisisDisplayHelper.php | 32 ++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+)

diff --git a/apps/field.php b/apps/field.php
index 21a637f..7f1f3ec 100644
--- a/apps/field.php
+++ b/apps/field.php
@@ -32,6 +32,7 @@ if ($isis) {
   $display->pre("Selected field: $fid: ". $field['name'] .".");
   $display->pre("Showing entry ". $display->entryLink($entry) ." from ". $isis->entries ." total entries.");
   $display->pre("Repetitions found: ". count($result[$field['name']]) .".");
+  $display->pre($display->repetitionLink($entry, $fid));
   $display->dump($result[$field['name']]);
 }
 
diff --git a/apps/repetition.php b/apps/repetition.php
index 6c57a39..0f0288e 100644
--- a/apps/repetition.php
+++ b/apps/repetition.php
@@ -32,6 +32,7 @@ if ($isis) {
   $display->pre("Selected field: $fid: ". $field['name'] .".");
   $display->pre("Showing entry ". $display->entryLink($entry) ." from ". $isis->entries ." total entries.");
   $display->pre("Repetitions found: ". count($result[$field['name']]) .".");
+  $display->pre($display->fieldLink($entry, $fid));
   $display->dump($result[$field['name']]);
 }
 
diff --git a/classes/helpers/CinisisDisplayHelper.php b/classes/helpers/CinisisDisplayHelper.php
index e6666d7..7802f42 100644
--- a/classes/helpers/CinisisDisplayHelper.php
+++ b/classes/helpers/CinisisDisplayHelper.php
@@ -226,6 +226,38 @@ class CinisisDisplayHelper {
     return self::link('index.php', '?entry='. $entry, $entry);
   }
 
+  /**
+   * Format a link to the field app.
+   *
+   * @param $entry
+   *   Entry number.
+   *
+   * @param $fid
+   *   Field code.
+   *
+   * @return
+   *   Formatted link.
+   */
+  protected static function webFieldLink($entry, $fid) {
+    return "Field search: ". self::link('field.php', '?entry='. $entry .'&fid='. $fid, $entry);
+  }
+
+  /**
+   * Format a link to the field app.
+   *
+   * @param $entry
+   *   Entry number.
+   *
+   * @param $fid
+   *   Field code.
+   *
+   * @return
+   *   Formatted link.
+   */
+  protected static function webRepetitionLink($entry, $fid) {
+    return "Repetition search: ". self::link('repetition.php', '?entry='. $entry .'&fid='. $fid, $entry);
+  }
+
   /**
    * Draws tags for opening a table.
    */
-- 
cgit v1.2.3