aboutsummaryrefslogtreecommitdiff
path: root/model/RoomSelection.php
diff options
context:
space:
mode:
authorMaZderMind2015-03-30 16:20:30 +0200
committerMaZderMind2015-03-30 16:20:30 +0200
commitf7d9d592745d1cb5cb2de76ed6ae99be974f1807 (patch)
tree0f9f77efe9efc70b3ac0404a46b249f809197922 /model/RoomSelection.php
parentea4b6c7699a7fbb7be3d9e5ce86c84a36b63f569 (diff)
Implement MVT Pattern based on simple Config options
Diffstat (limited to 'model/RoomSelection.php')
-rw-r--r--model/RoomSelection.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/model/RoomSelection.php b/model/RoomSelection.php
new file mode 100644
index 0000000..c163321
--- /dev/null
+++ b/model/RoomSelection.php
@@ -0,0 +1,52 @@
+<?php
+
+class RoomSelection
+{
+ public function __construct(Room $room, $selection)
+ {
+ $this->room = $room;
+ $this->selection = $selection;
+ }
+
+ public function getRoom()
+ {
+ return $this->room;
+ }
+
+ public function getSelection()
+ {
+ return $this->selection;
+ }
+
+ public function getLink()
+ {
+ $selection = $this->getRoom()->getSelectionNames();
+ if($selection[0] == $this->getSelection())
+ return rawurlencode($this->getRoom()->getSlug()).'/';
+
+ return rawurlencode($this->getRoom()->getSlug()).'/'.rawurlencode($this->getSelection()).'/';
+ }
+
+ public function getTranslatedLink()
+ {
+ return $this->getLink().'translated/';
+ }
+
+ public function getDisplay()
+ {
+ switch($this->getSelection())
+ {
+ case 'sd':
+ case 'hd':
+ return strtoupper($this->getSelection());
+
+ default:
+ return ucfirst($this->getSelection());
+ }
+ }
+
+ public function getTech()
+ {
+ return $this->getSelection().'-tech';
+ }
+}