CSS for links

This commit is contained in:
Roland Gruber 2012-11-03 17:34:18 +00:00
parent a4cfd700be
commit 8da5ed7ad4
2 changed files with 22 additions and 1 deletions

View File

@ -2314,6 +2314,8 @@ class htmlLink extends htmlElement {
private $onClick = null;
/** show as button */
private $showAsButton = false;
/** CSS classes */
private $cssClasses = array();
/**
* Constructor.
@ -2363,7 +2365,11 @@ class htmlLink extends htmlElement {
$id = 'a_' . preg_replace('/[^a-zA-Z0-9_]+/', '_', $this->target);
$idAttr = ' id="' . $id . '"';
}
echo '<a href="' . $this->target . '"' . $idAttr . $title . $targetWindow . $onClick . '>' . $image . $this->text . '</a>';
$classAttr = '';
if (sizeof($this->cssClasses) > 0) {
$classAttr = ' class="' . implode(' ', $this->cssClasses) . '"';
}
echo '<a href="' . $this->target . '"' . $idAttr . $classAttr . $title . $targetWindow . $onClick . '>' . $image . $this->text . '</a>';
if ($this->showAsButton) {
echo '<script type="text/javascript">';
echo ' jQuery(document).ready(function() {';
@ -2401,6 +2407,15 @@ class htmlLink extends htmlElement {
$this->onClick = htmlspecialchars($event);
}
/**
* Adds CSS classes to this link.
*
* @param array $classes CSS class names
*/
public function setCSSClasses($classes) {
$this->cssClasses = $classes;
}
}
/**

View File

@ -73,6 +73,12 @@ a img {
border: 0px;
}
a.classicBold {
color: blue;
text-decoration: none;
font-weight: bold;
}
fieldset {
background-color:#fff3c8;
border:1px solid #af8800;