mirror of
https://github.com/voc/streaming-website
synced 2024-11-10 06:34:17 +00:00
1cd3e2b60b
PHP8 deprecated, that class member variables can be created outside the class definition or constructor, which prevented the code to run at all. Additionally the error handling has changed, which has lead to multiple other errors during the runtime. Finally, strftime was deprecated in PHP 8.1.
67 lines
1.2 KiB
PHP
67 lines
1.2 KiB
PHP
<?php
|
|
|
|
class RoomSelection
|
|
{
|
|
public $room;
|
|
public $selection;
|
|
|
|
public function __construct(Room $room, $selection)
|
|
{
|
|
$this->room = $room;
|
|
$this->selection = $selection;
|
|
}
|
|
|
|
public function getRoom()
|
|
{
|
|
return $this->room;
|
|
}
|
|
|
|
public function getSelection()
|
|
{
|
|
return $this->selection;
|
|
}
|
|
|
|
private function getSelectionPath() {
|
|
$path = [$this->getRoom()->getConference()->getSlug(), $this->getRoom()->getSlug()];
|
|
|
|
$selection = $this->getRoom()->getSelectionNames();
|
|
if ($selection[0] != $this->getSelection())
|
|
$path[] = $this->getSelection();
|
|
|
|
return joinpath($path);
|
|
}
|
|
|
|
public function getLink()
|
|
{
|
|
return $this->getSelectionPath() . url_params();
|
|
}
|
|
|
|
public function getTranslatedLink($translation_endpoint)
|
|
{
|
|
return joinpath([$this->getSelectionPath(), 'i18n', $translation_endpoint]) . url_params();
|
|
}
|
|
|
|
public function getDisplay()
|
|
{
|
|
switch($this->getSelection())
|
|
{
|
|
case 'sd':
|
|
case 'hd':
|
|
return strtoupper($this->getSelection());
|
|
|
|
case 'music':
|
|
return 'Radio';
|
|
|
|
case 'hls':
|
|
return 'HLS';
|
|
|
|
default:
|
|
return ucfirst($this->getSelection());
|
|
}
|
|
}
|
|
|
|
public function getTech()
|
|
{
|
|
return $this->getSelection().'-tech';
|
|
}
|
|
}
|