aboutsummaryrefslogtreecommitdiff
path: root/model/Room.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--model/Room.php49
1 files changed, 49 insertions, 0 deletions
diff --git a/model/Room.php b/model/Room.php
new file mode 100644
index 0000000..7394870
--- /dev/null
+++ b/model/Room.php
@@ -0,0 +1,49 @@
+<?php
+
+class Room {
+ private $slug;
+
+ public static function get($slug)
+ {
+ return new Room($slug);
+ }
+
+ private function __construct($slug)
+ {
+ if(! has('ROOMS.'.$slug))
+ throw new NotFoundException('Room '.$slug);
+
+ $this->slug = $slug;
+ }
+
+
+ public function getSlug() {
+ return $this->slug;
+ }
+
+ public function getThumb() {
+ return 'thumbs/'.$this->getStream().'.png';
+ }
+
+ public function getLink() {
+ return rawurlencode($this->getSlug()).'/';
+ }
+
+ public function getStream() {
+ return get('ROOMS.'.$this->getSlug().'.STREAM', $this->getSlug());
+ }
+
+ public function getDisplay() {
+ return get('ROOMS.'.$this->getSlug().'.DISPLAY', $this->getSlug());
+ }
+
+
+
+ public function hasPreview() {
+ return get('ROOMS.'.$this->getSlug().'.PREVIEW');
+ }
+
+ public function hasSchedule() {
+ return get('ROOMS.'.$this->getSlug().'.SCHEDULE') && has('SCHEDULE');
+ }
+}