filter allowed hall ids
This commit is contained in:
parent
137cddd05f
commit
8388551abd
|
@ -5,6 +5,17 @@ wp_nav_menu( array( 'theme_location' => 'footer-schedule', 'container_class' =>
|
|||
|
||||
$lang = pll_current_language('slug');
|
||||
|
||||
|
||||
/* TODO make this read the ids from the proper place, as this breaks other years*/
|
||||
if ( preg_match('/^workshop/', $pagename) ) {
|
||||
$workshop = true;
|
||||
$allowedhallids = array(9);
|
||||
} else {
|
||||
$workshop = false;
|
||||
$allowedhallids = array(6,7,8);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* There is no better way to get where the speakers are
|
||||
*/
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
get_header();
|
||||
wp_nav_menu( array( 'theme_location' => 'footer-schedule', 'container_class' => 'content subnav cf' ) );
|
||||
|
||||
$allowedhallids = array(6,7,8,9);
|
||||
|
||||
$content = require __DIR__ . DIRECTORY_SEPARATOR . 'schedule' . DIRECTORY_SEPARATOR . 'parse.php';
|
||||
//var_dump($data);
|
||||
?>
|
||||
|
|
|
@ -12,6 +12,10 @@ $filenames = [
|
|||
'slots' => 'slots.json',
|
||||
];
|
||||
|
||||
|
||||
if (empty($allowedhallids)) {
|
||||
$allowedhallids = array (6,7,8);
|
||||
}
|
||||
$data = [];
|
||||
|
||||
foreach ($filenames as $name => $filename) {
|
||||
|
@ -31,12 +35,13 @@ foreach ($filenames as $name => $filename) {
|
|||
}
|
||||
|
||||
$add = true;
|
||||
|
||||
switch ($name) {
|
||||
case 'halls':
|
||||
$decoded = array_map(function($el) {
|
||||
return $el['name'];
|
||||
}, $decoded);
|
||||
$ret = array();
|
||||
foreach($decoded as $id => $hall) {
|
||||
if (in_array($id, $allowedhallids)) $ret[$id] = $hall['name'];
|
||||
}
|
||||
$decoded = $ret;
|
||||
break;
|
||||
case 'slots':
|
||||
$decoded = array_map(function($el) {
|
||||
|
@ -63,6 +68,6 @@ uasort($data['slots'], function($a, $b) {
|
|||
return compareKeys($a, $b, 'starts_at') ?: compareKeys($a, $b, 'hall_id');
|
||||
});
|
||||
|
||||
array_pop($data['halls']);
|
||||
//array_pop($data['halls']);
|
||||
|
||||
return $data;
|
||||
|
|
Loading…
Reference in New Issue