aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <silvio@devlet.com.br>2010-08-16 15:48:17 -0300
committerSilvio <silvio@devlet.com.br>2010-08-16 15:48:17 -0300
commite7e7ea4467452f6e08cf79ca0a8e6b9e216407c6 (patch)
treea1c5013cece6f71ce332a4105190ab21dd0e171b
parent2ec3b3c05e535ffacb1e10a64aa62ad057499d47 (diff)
downloadcinisis-e7e7ea4467452f6e08cf79ca0a8e6b9e216407c6.tar.gz
cinisis-e7e7ea4467452f6e08cf79ca0a8e6b9e216407c6.tar.bz2
Comments
-rw-r--r--classes/helpers/CinisisDisplayHelper.php54
-rw-r--r--classes/helpers/CinisisHttpHelper.php12
-rw-r--r--tests/read.php4
-rw-r--r--tests/test.php3
4 files changed, 71 insertions, 2 deletions
diff --git a/classes/helpers/CinisisDisplayHelper.php b/classes/helpers/CinisisDisplayHelper.php
index 16d458e..cf095ac 100644
--- a/classes/helpers/CinisisDisplayHelper.php
+++ b/classes/helpers/CinisisDisplayHelper.php
@@ -1,15 +1,33 @@
<?php
+/**
+ * Display helpers for test scripts.
+ */
class CinisisDisplayHelper {
+ /**
+ * Constructor.
+ *
+ * @param $title
+ * Page title;
+ */
function __construct($title) {
$this->header();
$this->title($title);
}
+ /**
+ * Draws a page title.
+ *
+ * @param $title
+ * Page title;
+ */
function title($title) {
echo "<h1>$title</h1>\n";
}
+ /**
+ * Draws the page header.
+ */
function header() {
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">';
@@ -19,10 +37,25 @@ class CinisisDisplayHelper {
echo '<body>';
}
+ /**
+ * Draws the page footer.
+ */
function footer() {
echo '</body>';
}
+ /**
+ * Draws a form.
+ *
+ * @param $content
+ * Form inner content.
+ *
+ * @param $action
+ * Form action.
+ *
+ * @param $method
+ * Form method.
+ */
function form($content, $action = 'index.php', $method = 'get') {
echo '<form action="'. $action .'" method="'. $method .'">';
echo $content;
@@ -31,10 +64,31 @@ class CinisisDisplayHelper {
echo '<br />';
}
+ /**
+ * Draws a form text input.
+ *
+ * @param $name
+ * Input name.
+ *
+ * @return
+ * Rendered text input.
+ */
function form_input_text($name) {
return ucfirst($name) .': <input name="'. $name .'" type="text" />';
}
+ /**
+ * Draws a navigation bar.
+ *
+ * @param $entry
+ * Current entry.
+ *
+ * @param $entries
+ * Total number of entries.
+ *
+ * @param $action
+ * Page action.
+ */
function navbar($entry, $entries, $action = 'index.php') {
// First / prev links.
if ($entry != 1) {
diff --git a/classes/helpers/CinisisHttpHelper.php b/classes/helpers/CinisisHttpHelper.php
index 34ff349..eae8a8d 100644
--- a/classes/helpers/CinisisHttpHelper.php
+++ b/classes/helpers/CinisisHttpHelper.php
@@ -1,6 +1,18 @@
<?php
+/**
+ * Http helper for test scripts.
+ */
class CinisisHttpHelper {
+ /**
+ * Get a numeric argument.
+ *
+ * @param $name
+ * Argument name.
+ *
+ * @return
+ * Argument value.
+ */
static function get_numeric_arg($name) {
// Get the query parameter.
if (isset($_GET[$name]) && ! empty($_GET[$name])) {
diff --git a/tests/read.php b/tests/read.php
index 5281335..92dc1c3 100644
--- a/tests/read.php
+++ b/tests/read.php
@@ -7,7 +7,9 @@
<?php
// Import requisites.
require_once '../index.php';
-require_once 'includes/header.inc.php';
+
+// Draw the document.
+$display = new CinisisDisplayHelper('Isis Reader');
?>
<table><tr>
diff --git a/tests/test.php b/tests/test.php
index fd2ac99..5a96e3b 100644
--- a/tests/test.php
+++ b/tests/test.php
@@ -7,10 +7,11 @@
<?php
// Import requisites.
require_once '../index.php';
-require_once 'includes/header.inc.php';
?>
<?php
+// Draw the document.
+$display = new CinisisDisplayHelper('Isis Test');
// Get a db instance.
$isis = new CinisisDb();