Fix Stream-Selection in Feedback-Form

This commit is contained in:
MaZderMind 2015-03-03 23:28:14 +01:00
parent 1cf6e0161c
commit e13e16405a
2 changed files with 18 additions and 8 deletions

View file

@ -153,6 +153,19 @@ function room_has_slides($room)
return count(array_intersect(array('slides'), $formats)) > 0;
}
function room_get_possible_selections($room)
{
$selections = array();
if(room_has_hd($room)) $selections[] = 'hd';
if(room_has_sd($room)) $selections[] = 'sd';
if(room_has_audio($room)) $selections[] = 'audio';
if(room_has_music($room)) $selections[] = 'music';
if(room_has_slides($room)) $selections[] = 'slides';
return $selections;
}
function room_has_rtmp($room)
{
$formats = get("ROOMS.$room.FORMATS");

View file

@ -52,17 +52,14 @@
<label for="stream">Stream</label>
<select class="form-control" name="stream" id="stream">
<option></option>
<? foreach(array('saal1', 'saal2', 'saalg', 'saal6', 'sendezentrum') as $roomIter): ?>
<? foreach($GLOBALS['CONFIG']['FORMATS'] as $formatIter => $formatDislay): ?>
<? foreach(get('ROOMS') as $roomSlug => $roomInfo): ?>
<? if(!has("ROOMS.$roomSlug.FEEDBACK")) continue ?>
<? foreach(room_get_possible_selections($roomSlug) as $selectionIter): ?>
<option
<? if($roomIter == $room && $formatIter == $format): ?>selected<? endif ?>
value="<?=h("$roomIter-$formatIter")?>"><?=h($GLOBALS['CONFIG']['ROOMS'][$roomIter])?> <?=h($formatDislay)?></option>
<? if($roomSlug == $room && $selectionIter == @$selection): ?>selected<? endif ?>
value="<?=h("$roomSlug-$selectionIter")?>"><?=h(get("ROOMS.$roomSlug.DISPLAY", $roomSlug))?> <?=h($selectionIter)?></option>
<? endforeach ?>
<? endforeach ?>
<? foreach(array('lounge', 'ambient') as $roomIter): ?>
<option value="<?=h("$roomIter")?>"><?=h($GLOBALS['CONFIG']['ROOMS'][$roomIter])?></option>
<? endforeach ?>
</select>
</div>
</div>