aboutsummaryrefslogtreecommitdiff
path: root/model/Room.php
blob: 5799e965beb72b20563af14fe7f5e97c67a22c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?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');
	}
}