From 1a0175249f11faafd9753a503e0e0567aa8ee715 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Sat, 16 Oct 2010 16:55:31 +0000 Subject: [PATCH] allow to create links --- lam/lib/html.inc | 55 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/lam/lib/html.inc b/lam/lib/html.inc index 6de58d1c..ba5dffef 100644 --- a/lam/lib/html.inc +++ b/lam/lib/html.inc @@ -1592,11 +1592,12 @@ class htmlHiddenInput extends htmlElement { /** * Constructor. * - * @param String $label label + * @param String $name input name + * @param String $value input value */ function __construct($name, $value) { - $this->name = $name; - $this->value = $value; + $this->name = htmlspecialchars($name); + $this->value = htmlspecialchars($value); } /** @@ -1617,4 +1618,52 @@ class htmlHiddenInput extends htmlElement { } +/** + * Generates a link. + * The link can include an optional image in front of the link text. + * + * @package metaHTML + */ +class htmlLink extends htmlElement { + + /** link text */ + private $text = null; + /** link target */ + private $target = null; + /** optional image */ + private $image = null; + + /** + * Constructor. + * + * @param String $label label + */ + function __construct($text, $target, $image = null) { + $this->text = htmlspecialchars($text); + $this->target = htmlspecialchars($target); + $this->image = htmlspecialchars($image); + } + + /** + * Prints the HTML code for this element. + * + * @param string $module Name of account module + * @param array $input List of meta-HTML elements + * @param array $values List of values which override the defaults in $input (name => value) + * @param boolean $restricted If true then no buttons will be displayed + * @param integer $tabindex Start value of tabulator index for input fields + * @param string $scope Account type + * @return array List of input field names and their type (name => type) + */ + function generateHTML($module, $input, $values, $restricted, &$tabindex, $scope) { + $image = ''; + if ($this->image != null) { + $image = '' . $this->text . ' '; + } + echo '' . $image . $this->text . ''; + return array(); + } + +} + ?>