getSpace(); if (isset($_SESSION['user']) && $space->allowUser($_SESSION['user'])) echo displayEssay($essay); else if ($space->getVisibility() == 1) echo displayEssay($essay); else echo displaySpace(2025); } else echo displaySpace(2025); break; case 'show': // TODO: After implementing the notification modal, notify the user on success/fail auth events. if (isset($_GET['id'])) { $space = Space::retrieveFromDB($_GET['id']); if (isset($_SESSION['user'])) if ($space->allowUser(unserialize($_SESSION['user']))) echo displaySpace($_GET['id']); else if ($space->getVisibility() == 1) echo displaySpace($_GET['id']); else echo 'TODO: Notification Modal -> User not a member'; else { if ($space->getVisibility() == 1) echo displaySpace($_GET['id']); else echo 'TODO: Notification Modal -> Space is not Open'; } } else echo displaySpaceList(); break; case 'list': if (isset($_SESSION['user'])) echo displaySpaceList(); else echo displaySpace(2025); break; default: echo displaySpaceList(); break; } } else { echo displaySpace(2025); } if (isset($_SESSION['user'])) echo actionButton(); require_once 'components/core/foot.php'; function actionButton() { // TODO: Position these on the arc of a circle. $html = '
'; return $html; } function displayEssay(Essay $e) { $html = '
' . $e->getHTML() . '
'; return $html; } function displaySpaceList() { $user = unserialize($_SESSION['user']); $html = '

Spaces

'; $spaces = $user->getSpaces(); foreach ($spaces as $s) { $html .= $s->getCardHTML(); } $html .= '
'; return $html; } function displaySpace($id = 2025) { $space = Space::retrieveFromDB($id); if ($space) { $html = '

' . $space->getName() . '

' . $space->getDescription() . '

'; // TODO: Need to investigate this bug in Posts $posts = $space->getPosts(); foreach ($posts as $post) { foreach ($post as $p) { $html .= $p->getCardHTML(); } } $html .= '
'; return $html; } }