| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
stubClassLoader::load('net::stubbles::websites::stubPageElement'); |
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
class stubPage extends stubBaseObject |
|---|
| 17 |
{ |
|---|
| 18 |
|
|---|
| 19 |
* list of kay => value properties |
|---|
| 20 |
* |
|---|
| 21 |
* @var array<string,scalar> |
|---|
| 22 |
*/ |
|---|
| 23 |
protected $properties = array(); |
|---|
| 24 |
|
|---|
| 25 |
* Resources that are used by this page |
|---|
| 26 |
* |
|---|
| 27 |
* @var array<string,string> |
|---|
| 28 |
*/ |
|---|
| 29 |
protected $resources = array(); |
|---|
| 30 |
|
|---|
| 31 |
* list of the elements of this page |
|---|
| 32 |
* |
|---|
| 33 |
* @var array<string,stubPageElement> |
|---|
| 34 |
*/ |
|---|
| 35 |
protected $elements = array(); |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
* sets a property |
|---|
| 39 |
* |
|---|
| 40 |
* @param string $name name of the property |
|---|
| 41 |
* @param scalar $value value of the property |
|---|
| 42 |
*/ |
|---|
| 43 |
public function setProperty($name, $value) |
|---|
| 44 |
{ |
|---|
| 45 |
$this->properties[$name] = $value; |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
* sets the list of properties |
|---|
| 50 |
* |
|---|
| 51 |
* @param array $properties |
|---|
| 52 |
*/ |
|---|
| 53 |
public function setProperties(array $properties) |
|---|
| 54 |
{ |
|---|
| 55 |
$this->properties = $properties; |
|---|
| 56 |
} |
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
* sets the list of resources |
|---|
| 60 |
* |
|---|
| 61 |
* @param array $resources |
|---|
| 62 |
*/ |
|---|
| 63 |
public function setResources(array $resources) |
|---|
| 64 |
{ |
|---|
| 65 |
$this->resources = $resources; |
|---|
| 66 |
} |
|---|
| 67 |
|
|---|
| 68 |
|
|---|
| 69 |
* checks whether a property for the page exists |
|---|
| 70 |
* |
|---|
| 71 |
* @param string $name name of the property |
|---|
| 72 |
* @return bool |
|---|
| 73 |
*/ |
|---|
| 74 |
public function hasProperty($name) |
|---|
| 75 |
{ |
|---|
| 76 |
return isset($this->properties[$name]); |
|---|
| 77 |
} |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
* returns the property or null if it does not exist |
|---|
| 81 |
* |
|---|
| 82 |
* @param string $name name of the property |
|---|
| 83 |
* @return scalar |
|---|
| 84 |
*/ |
|---|
| 85 |
public function getProperty($name) |
|---|
| 86 |
{ |
|---|
| 87 |
if (isset($this->properties[$name]) == true) { |
|---|
| 88 |
return $this->properties[$name]; |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
return null; |
|---|
| 92 |
} |
|---|
| 93 |
|
|---|
| 94 |
|
|---|
| 95 |
* returns the list of resources |
|---|
| 96 |
* |
|---|
| 97 |
* @return array |
|---|
| 98 |
*/ |
|---|
| 99 |
public function getResources() |
|---|
| 100 |
{ |
|---|
| 101 |
return $this->resources; |
|---|
| 102 |
} |
|---|
| 103 |
|
|---|
| 104 |
|
|---|
| 105 |
* adds an element to the page |
|---|
| 106 |
* |
|---|
| 107 |
* @param stubPageElement $element |
|---|
| 108 |
*/ |
|---|
| 109 |
public function addElement(stubPageElement $element) |
|---|
| 110 |
{ |
|---|
| 111 |
$this->elements[$element->getName()] = $element; |
|---|
| 112 |
} |
|---|
| 113 |
|
|---|
| 114 |
|
|---|
| 115 |
* returns the list of elements |
|---|
| 116 |
* |
|---|
| 117 |
* @return array<string,stubPageElement> |
|---|
| 118 |
*/ |
|---|
| 119 |
public function getElements() |
|---|
| 120 |
{ |
|---|
| 121 |
return $this->elements; |
|---|
| 122 |
} |
|---|
| 123 |
} |
|---|
| 124 |
?> |
|---|