aboutsummaryrefslogtreecommitdiff
path: root/model/RoomTab.php
blob: dfe6e848f01e2311e780d7cf1994f78b85b49d63 (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
<?php

class RoomTab
{
	public function __construct(Room $room, $tab)
	{
		$this->room = $room;
		$this->tab = $tab;
	}

	public function getRoom()
	{
		return $this->room;
	}

	public function getTab()
	{
		return $this->tab;
	}

	public function getLink()
	{
		$tabs = $this->getRoom()->getTabNames();
		if($tabs[0] == $this->getTab())
			return rawurlencode($this->getRoom()->getSlug()).'/'.url_params();

		return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getTab()).'/'.url_params();
	}

	public function getDisplay()
	{
		$tab = $this->getTab();
		switch($tab)
		{
			case 'music':
				return 'Radio';

			case 'dash':
				return 'DASH (beta)';

			default:
				return ucfirst($tab);
		}
	}
}