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) * 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' * Hiermit kann die Funktionalitaet von STARTS_AT/ENDS_AT überschrieben werden. Der Wert 'before'
@ -126,6 +126,8 @@ $CONFIG['OVERVIEW'] = array(
'GROUPS' => array( 'GROUPS' => array(
// TODO sort array in random order, based on current hour or simular // TODO sort array in random order, based on current hour or simular
'Channels' => array( 'Channels' => array(
'infobeamer',
'cbase',
'cwtv', 'cwtv',
'cbase', 'cbase',
'r3s', 'r3s',
@ -134,14 +136,11 @@ $CONFIG['OVERVIEW'] = array(
'fem', 'fem',
'franconiannet', 'franconiannet',
'aboutfuture', 'aboutfuture',
'sendezentrum', # 'sendezentrum',
'haecksen', 'haecksen',
'gehacktesfromhell', 'gehacktesfromhell',
'xhain', 'xhain',
), ),
'Info' => array(
'infobeamer'
),
'Music' => array( 'Music' => array(
'c3lounge', 'c3lounge',
'abchillgleis' 'abchillgleis'
@ -791,7 +790,6 @@ $CONFIG['ROOMS'] = array(
'TWITTER' => false, 'TWITTER' => false,
), ),
'infobeamer' => array( 'infobeamer' => array(
'WIDE' => true,
'DISPLAY' => 'Infobeamer', 'DISPLAY' => 'Infobeamer',
'DISPLAY_SHORT' => 'Infobeamer', 'DISPLAY_SHORT' => 'Infobeamer',
'STREAM' => 'infobeamer', 'STREAM' => 'infobeamer',

View file

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