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

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