refactor sorting, prepare filter for empty rooms

This commit is contained in:
Andreas Hubel 2021-12-30 04:19:48 +01:00
parent 237457f963
commit d740e586cf
2 changed files with 19 additions and 11 deletions

View file

@ -18,7 +18,7 @@ $CONFIG['CONFERENCE'] = array(
*
* Wird dieser Zeitpunkt nicht angegeben, endet die Konferenz nie. (Siehe aber CLOSED weiter unten)
*/
'ENDS_AT' => strtotime("2021-12-31 03:00"),
'ENDS_AT' => strtotime("2021-12-31 05:30"),
/**
* Hiermit kann die Funktionalitaet von STARTS_AT/ENDS_AT überschrieben werden. Der Wert 'before'
@ -126,6 +126,8 @@ $CONFIG['OVERVIEW'] = array(
'GROUPS' => array(
// TODO sort array in random order, based on current hour or simular
'Channels' => array(
'infobeamer',
'cbase',
'cwtv',
'cbase',
'r3s',
@ -134,14 +136,11 @@ $CONFIG['OVERVIEW'] = array(
'fem',
'franconiannet',
'aboutfuture',
'sendezentrum',
# 'sendezentrum',
'haecksen',
'gehacktesfromhell',
'xhain',
),
'Info' => array(
'infobeamer'
),
'Music' => array(
'c3lounge',
'abchillgleis'
@ -791,7 +790,6 @@ $CONFIG['ROOMS'] = array(
'TWITTER' => false,
),
'infobeamer' => array(
'WIDE' => true,
'DISPLAY' => 'Infobeamer',
'DISPLAY_SHORT' => 'Infobeamer',
'STREAM' => 'infobeamer',

View file

@ -12,17 +12,26 @@
<div class="row room-group room-group-n<?=h($i++)?> room-group-<?=h(slugify($group))?>">
<?
/*
$rooms = array_filter($rooms, function($r) {
global $upcomingTalksPerRoom;
$upcoming = @$upcomingTalksPerRoom[ $r->getSlug() ];
return isset($upcoming['next']);
}); */
$count = count($rooms);
$idx = 0;
usort($rooms, function ($r_a, $r_b) {
global $upcomingTalksPerRoom;
$u_a = $upcomingTalksPerRoom[ $r_a->getSlug() ];
$a = @$u_a['current']['special'] ? $u_a['next'] : $u_a['current'];
$u_b = $upcomingTalksPerRoom[ $r_b->getSlug() ];
return (
(@$u_a['current']['special'] ? @$u_a['next']['start'] : @$u_a['current']['start'])
<=>
(@$u_b['current']['special'] ? @$u_b['next']['start'] : @$u_b['current']['start'])
);
$b = @$u_b['current']['special'] ? $u_b['next'] : $u_b['current'];
if ( $u_a['next'] === null || $u_b['next'] === null) {
return -($u_a['next'] <=> $u_b['next']);
}
return @$a['start'] <=> @$b['start'];
});
foreach($rooms as $room):
@ -91,6 +100,7 @@
<? if($room->hasSchedule()):
$upcoming = @$upcomingTalksPerRoom[ $room->getSlug() ] ?: [];
// echo var_dump($upcoming);
$current = @$upcoming['current'];
$next = @$upcoming['next']; ?>
<div class="program-schedule">