aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-17 15:34:52 -0300
committerSilvio <silvio@devlet.com.br>2010-08-17 15:34:52 -0300
commit044787875ba643fce951aeaf7256607c010ca65e (patch)
treecd4ebbfea7a892815b60b166fccc69b912db3260
parentd77a34b3aa1eaa313d1055580bddd1cb38556fef (diff)
downloadcinisis-044787875ba643fce951aeaf7256607c010ca65e.tar.gz
cinisis-044787875ba643fce951aeaf7256607c010ca65e.tar.bz2
Showing links at test scripts
-rw-r--r--classes/helpers/CinisisDisplayHelper.php44
-rw-r--r--tests/field.php2
-rw-r--r--tests/repetition.php2
-rw-r--r--tests/subfield.php3
4 files changed, 42 insertions, 9 deletions
diff --git a/classes/helpers/CinisisDisplayHelper.php b/classes/helpers/CinisisDisplayHelper.php
index 90e0069..e5cbafe 100644
--- a/classes/helpers/CinisisDisplayHelper.php
+++ b/classes/helpers/CinisisDisplayHelper.php
@@ -21,7 +21,7 @@ class CinisisDisplayHelper {
* @param $title
* Page title;
*/
- function title($title) {
+ static function title($title) {
echo "<h1>$title</h1>\n";
}
@@ -31,7 +31,7 @@ class CinisisDisplayHelper {
* @param $title
* Page title;
*/
- function header($title) {
+ static function header($title) {
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">';
echo '<head>';
@@ -44,7 +44,7 @@ class CinisisDisplayHelper {
/**
* Draws the page footer.
*/
- function footer() {
+ static function footer() {
echo '</body>';
}
@@ -60,7 +60,7 @@ class CinisisDisplayHelper {
* @param $method
* Form method.
*/
- function form($content, $action = 'index.php', $method = 'get') {
+ static function form($content, $action = 'index.php', $method = 'get') {
echo '<form action="'. $action .'" method="'. $method .'">';
echo $content;
echo '<input type="submit" />';
@@ -80,7 +80,7 @@ class CinisisDisplayHelper {
* @return
* Rendered text input.
*/
- function form_input_text($name, $default = null) {
+ static function form_input_text($name, $default = null) {
if ($default) {
$default = 'value="'. $default .'"';
}
@@ -103,7 +103,7 @@ class CinisisDisplayHelper {
* @param $extra
* Extra parameters.
*/
- function navbar($entry, $entries, $action = 'index.php', $extra = NULL) {
+ static function navbar($entry, $entries, $action = 'index.php', $extra = NULL) {
// First / prev links.
if ($entry != 1) {
$prev = $entry - 1;
@@ -118,4 +118,36 @@ class CinisisDisplayHelper {
echo '<a href="'. $action .'?entry='. $entries . $extra .'">last</a>';
}
}
+
+ /**
+ * Format a link.
+ *
+ * @param $action
+ * Link action.
+ *
+ * @param $args
+ * Action arguments.
+ *
+ * @param $title
+ * Link title.
+ *
+ * @return
+ * Formatted link.
+ */
+ static function link($action, $args, $title) {
+ return '<a href="'. $action . $args .'">'. $title .'</a>';
+ }
+
+ /**
+ * Format an entry link.
+ *
+ * @param $entry
+ * Entry number.
+ *
+ * @return
+ * Formatted link.
+ */
+ static function entry_link($entry) {
+ return self::link('index.php', '?entry='. $entry, $entry);
+ }
}
diff --git a/tests/field.php b/tests/field.php
index 35427a6..b9f9c3a 100644
--- a/tests/field.php
+++ b/tests/field.php
@@ -40,7 +40,7 @@ if ($isis->db) {
// Format output.
echo "<pre>\n";
echo "Selected field: $field: $field_name.\n";
- echo "Showing entry $entry from $entries total entries.\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]);
diff --git a/tests/repetition.php b/tests/repetition.php
index 7283427..37d0889 100644
--- a/tests/repetition.php
+++ b/tests/repetition.php
@@ -40,7 +40,7 @@ if ($isis->db) {
// Format output.
echo "<pre>\n";
echo "Selected field: $field: $field_name.\n";
- echo "Showing entry $entry from $entries total entries.\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]);
diff --git a/tests/subfield.php b/tests/subfield.php
index 892f2b5..117b8ce 100644
--- a/tests/subfield.php
+++ b/tests/subfield.php
@@ -41,10 +41,11 @@ if ($isis->db) {
$display->navbar($entry, $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";
- echo "Showing entry $entry from $entries total entries.\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]);