Skip to content

Commit

Permalink
Created JSON Schema to print Notices
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaswat975 committed Mar 8, 2024
1 parent d1367f8 commit 1966379
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions tools/docker-dev/unity-web-portal
Submodule unity-web-portal added at 7087b7
19 changes: 10 additions & 9 deletions webroot/api/notices/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,15 @@
}

$notices = $SQL->getNotices();
$jsonArray = [];
foreach ($notices as $notice) {
echo $notice["title"] . "\r\n";
echo date('m-d-Y', strtotime($notice["date"])) . "\r\n";

$lineArr = explode("\r\n", wordwrap($notice["message"], $CHAR_WRAP));
foreach ($lineArr as $line) {
echo $line;
}

echo "\r\n\r\n";
$formattedNotice = [
"title" => $notice["title"],
"date" => date('m-d-Y', strtotime($notice["date"])),
"message" => wordwrap($notice["message"], $CHAR_WRAP)
];
$jsonArray[] = $formattedNotice;
}

$jsonOutput = json_encode($jsonArray, JSON_PRETTY_PRINT);
echo $jsonOutput;

0 comments on commit 1966379

Please sign in to comment.