diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 12:39:39 +0000 |
commit | 8ca6cc32b2c789a3149861159ad258f2cb9491e3 (patch) | |
tree | 2492de6f1528dd44eaa169a5c1555026d9cb75ec /library/Icinga/Web/Announcement.php | |
parent | Initial commit. (diff) | |
download | icingaweb2-upstream/2.11.4.tar.xz icingaweb2-upstream/2.11.4.zip |
Adding upstream version 2.11.4.upstream/2.11.4upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | library/Icinga/Web/Announcement.php | 158 |
1 files changed, 158 insertions, 0 deletions
diff --git a/library/Icinga/Web/Announcement.php b/library/Icinga/Web/Announcement.php new file mode 100644 index 0000000..9835ce0 --- /dev/null +++ b/library/Icinga/Web/Announcement.php @@ -0,0 +1,158 @@ +<?php +/* Icinga Web 2 | (c) 2016 Icinga Development Team | GPLv2+ */ + +namespace Icinga\Web; + +/** + * An announcement to be displayed prominently in the web UI + */ +class Announcement +{ + /** + * @var string + */ + protected $author; + + /** + * @var string + */ + protected $message; + + /** + * @var int + */ + protected $start; + + /** + * @var int + */ + protected $end; + + /** + * Hash of the message + * + * @var string|null + */ + protected $hash = null; + + /** + * Announcement constructor + * + * @param array $properties + */ + public function __construct(array $properties = array()) + { + foreach ($properties as $key => $value) { + $method = 'set' . ucfirst($key); + if (method_exists($this, $method)) { + $this->$method($value); + } + } + } + + /** + * Get the author of the acknowledged + * + * @return string + */ + public function getAuthor() + { + return $this->author; + } + + /** + * Set the author of the acknowledged + * + * @param string $author + * + * @return $this + */ + public function setAuthor($author) + { + $this->author = $author; + return $this; + } + + /** + * Get the message of the acknowledged + * + * @return string + */ + public function getMessage() + { + return $this->message; + } + + /** + * Set the message of the acknowledged + * + * @param string $message + * + * @return $this + */ + public function setMessage($message) + { + $this->message = $message; + $this->hash = null; + return $this; + } + + /** + * Get the start date and time of the acknowledged + * + * @return int + */ + public function getStart() + { + return $this->start; + } + + /** + * Set the start date and time of the acknowledged + * + * @param int $start + * + * @return $this + */ + public function setStart($start) + { + $this->start = $start; + return $this; + } + + /** + * Get the end date and time of the acknowledged + * + * @return int + */ + public function getEnd() + { + return $this->end; + } + + /** + * Set the end date and time of the acknowledged + * + * @param int $end + * + * @return $this + */ + public function setEnd($end) + { + $this->end = $end; + return $this; + } + + /** + * Get the hash of the acknowledgement + * + * @return string + */ + public function getHash() + { + if ($this->hash === null) { + $this->hash = md5($this->message); + } + return $this->hash; + } +} |