| <?php |
| |
| require_once 'bundle.class.php'; |
| |
| class Component { |
| private $label; |
| private $bundles = array(); |
| private $description; |
| private $junitURL; |
| |
| function __construct($label, $description, $junitURL) { |
| $this->label = $label; |
| $this->description = $description; |
| $this->junitURL = $junitURL; |
| } |
| |
| function getLabel() { |
| return $this->label; |
| } |
| |
| function getDescription() { |
| return $this->description; |
| } |
| |
| function addBundle($bundle) { |
| $this->bundles[] = $bundle; |
| } |
| |
| function getBundles() { |
| return $this->bundles; |
| } |
| |
| function render() { |
| $result = "<h4><img src=\"/tigerstripe/images/dl.gif\" alt=\"Download\"/> " . $this->label; |
| if (strlen($this->junitURL) > 0 ) { |
| $result = $result . " <small>(<a href=\"" . $this->junitURL . "\">JUnit Results</a>)</small>"; |
| } |
| $result = $result . "</h4>"; |
| if ( strlen($this->description) > 0 ) { |
| $result = $result . "<small>(" . $this->description . ")</small>"; |
| } |
| if ( count($this->bundles) == 0 ) { |
| return $result . "<p><i><small>No download available</small></i></p>"; |
| } |
| |
| $result = $result . "<ul>"; |
| foreach( $this->bundles as $bundle ) { |
| $result = $result . "<li>" . $bundle->render() . "</li>"; |
| } |
| $result = $result . "</ul>"; |
| |
| return $result; |
| } |
| } |
| |
| ?> |