allow to create links

This commit is contained in:
Roland Gruber 2010-10-16 16:55:31 +00:00
parent d2d2cc9f5c
commit 1a0175249f
1 changed files with 52 additions and 3 deletions

View File

@ -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 = '<img src="' . $this->image . '" alt="' . $this->text . '">&nbsp;';
}
echo '<a href="' . $this->target . '">' . $image . $this->text . '</a>';
return array();
}
}
?>