Skip to content

Commit

Permalink
add DiocesanGroups to LitCalMetadata
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnRDOrazio committed Feb 6, 2022
1 parent d9c7344 commit a378f16
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions LitCalMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,17 @@
if( file_exists( 'nations/index.json' ) ) {
$index = file_get_contents( 'nations/index.json' );
if( $index !== false ) {
$diocesanCalendars = json_decode( $index, true );
$nationalCalendars = [];
$diocesanCalendars = json_decode( $index, true );
$nationalCalendars = [];
$diocesanGroups = [];
foreach( $diocesanCalendars as $key => $value ) {
unset( $diocesanCalendars[$key]["path"] );
if( array_key_exists( "group", $value ) && $value !== "" ) {
if( !array_key_exists($value["group"], $diocesanGroups) ) {
$diocesanGroups[$value["group"]] = [];
}
$diocesanGroups[$value["group"]][] = $key;
}
if( !array_key_exists($diocesanCalendars[$key]["nation"], $nationalCalendars) ) {
$nationalCalendars[$diocesanCalendars[$key]["nation"]] = [];
}
Expand All @@ -41,7 +48,8 @@
$response = json_encode( [
"LitCalMetadata" => [
"NationalCalendars" => $nationalCalendars,
"DiocesanCalendars" => $diocesanCalendars
"DiocesanCalendars" => $diocesanCalendars,
"DiocesanGroups" => $diocesanGroups
],
], JSON_PRETTY_PRINT );
$responseHash = md5( $response );
Expand Down

0 comments on commit a378f16

Please sign in to comment.