ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
Comment.php
Go to the documentation of this file.
1<?php
2
4
6
7class Comment implements IComparable
8{
14 private $author;
15
21 private $text;
22
28 private $width = '96pt';
29
35 private $marginLeft = '59.25pt';
36
42 private $marginTop = '1.5pt';
43
49 private $visible = false;
50
56 private $height = '55.5pt';
57
63 private $fillColor;
64
70 private $alignment;
71
75 public function __construct()
76 {
77 // Initialise variables
78 $this->author = 'Author';
79 $this->text = new RichText();
80 $this->fillColor = new Style\Color('FFFFFFE1');
81 $this->alignment = Style\Alignment::HORIZONTAL_GENERAL;
82 }
83
89 public function getAuthor()
90 {
91 return $this->author;
92 }
93
101 public function setAuthor($author)
102 {
103 $this->author = $author;
104
105 return $this;
106 }
107
113 public function getText()
114 {
115 return $this->text;
116 }
117
123 public function setText(RichText $pValue)
124 {
125 $this->text = $pValue;
126
127 return $this;
128 }
129
135 public function getWidth()
136 {
137 return $this->width;
138 }
139
147 public function setWidth($width)
148 {
149 $this->width = $width;
150
151 return $this;
152 }
153
159 public function getHeight()
160 {
161 return $this->height;
162 }
163
171 public function setHeight($value)
172 {
173 $this->height = $value;
174
175 return $this;
176 }
177
183 public function getMarginLeft()
184 {
185 return $this->marginLeft;
186 }
187
195 public function setMarginLeft($value)
196 {
197 $this->marginLeft = $value;
198
199 return $this;
200 }
201
207 public function getMarginTop()
208 {
209 return $this->marginTop;
210 }
211
219 public function setMarginTop($value)
220 {
221 $this->marginTop = $value;
222
223 return $this;
224 }
225
231 public function getVisible()
232 {
233 return $this->visible;
234 }
235
243 public function setVisible($value)
244 {
245 $this->visible = $value;
246
247 return $this;
248 }
249
255 public function getFillColor()
256 {
257 return $this->fillColor;
258 }
259
267 public function setAlignment($alignment)
268 {
269 $this->alignment = $alignment;
270
271 return $this;
272 }
273
279 public function getAlignment()
280 {
281 return $this->alignment;
282 }
283
289 public function getHashCode()
290 {
291 return md5(
292 $this->author .
293 $this->text->getHashCode() .
294 $this->width .
295 $this->height .
296 $this->marginLeft .
297 $this->marginTop .
298 ($this->visible ? 1 : 0) .
299 $this->fillColor->getHashCode() .
300 $this->alignment .
301 __CLASS__
302 );
303 }
304
308 public function __clone()
309 {
310 $vars = get_object_vars($this);
311 foreach ($vars as $key => $value) {
312 if (is_object($value)) {
313 $this->$key = clone $value;
314 } else {
315 $this->$key = $value;
316 }
317 }
318 }
319
325 public function __toString()
326 {
327 return $this->text->getPlainText();
328 }
329}
An exception for terminatinating execution or to throw for unit testing.
getAlignment()
Get Alignment.
Definition: Comment.php:279
__construct()
Create a new Comment.
Definition: Comment.php:75
__toString()
Convert to string.
Definition: Comment.php:325
setVisible($value)
Set comment default visibility.
Definition: Comment.php:243
setMarginLeft($value)
Set left margin (CSS style, i.e.
Definition: Comment.php:195
setMarginTop($value)
Set top margin (CSS style, i.e.
Definition: Comment.php:219
getText()
Get Rich text comment.
Definition: Comment.php:113
getWidth()
Get comment width (CSS style, i.e.
Definition: Comment.php:135
getMarginLeft()
Get left margin (CSS style, i.e.
Definition: Comment.php:183
setText(RichText $pValue)
Set Rich text comment.
Definition: Comment.php:123
__clone()
Implement PHP __clone to create a deep clone, not just a shallow copy.
Definition: Comment.php:308
setWidth($width)
Set comment width (CSS style, i.e.
Definition: Comment.php:147
getHeight()
Get comment height (CSS style, i.e.
Definition: Comment.php:159
getMarginTop()
Get top margin (CSS style, i.e.
Definition: Comment.php:207
setAuthor($author)
Set Author.
Definition: Comment.php:101
getFillColor()
Get fill color.
Definition: Comment.php:255
getVisible()
Is the comment visible by default?
Definition: Comment.php:231
setHeight($value)
Set comment height (CSS style, i.e.
Definition: Comment.php:171
setAlignment($alignment)
Set Alignment.
Definition: Comment.php:267
$key
Definition: croninfo.php:18