getSpaces(); foreach ($availableSpaces as $s) { $space = $s->getSpace(); if ($space->getId() == $_GET['id']) { echo displaySpace($_GET['id']); break; } else if ($space->getVisibility() == 1) { echo displaySpace($_GET['id']); break; } 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 actionBar(); if (isset($_GET['id'])) echo backButton(); require_once 'components/core/foot.php'; function backButton() { $html = ' '; return $html; } function actionBar() { $user = unserialize($_SESSION['user']); $html = '
'; return $html; } function errorScreen(String $heading, String $msg) { $html = '

' . $heading . '

' . $msg . '

'; return $html; } function displayEssay(Essay $e) { /* if (isset($_SESSION['user'])) */ /* if ($e->allowUser(unserialize($_SESSION['user'])) || $e->getSpace()->getVisibility() != 1) */ /* return errorScreen('Access Denied!', 'You do not have access to the Space that this Essay is in.'); */ $parsedown = new Parsedown(); $parsedown->setSafeMode(true); $html = '
' . $parsedown->parse($e->getMarkdown()) . '
'; return $html; } function displaySpaceList() { if (!isset($_SESSION['user'])) return displaySpace(); $user = unserialize($_SESSION['user']); $html = '

Spaces

'; $spaces = $user->getSpaces(); foreach ($spaces as $s) $html .= $s->getSpace()->getCardHTML(); $html .= '
'; return $html; } function displaySpace($id = 2025) { $spaces = unserialize($_SESSION['user'])->getSpaces(); foreach ($spaces as $s) { $space = $s->getSpace(); if ($space->getId() == $id) { break; } } if (!$space) return; if ($space) { $html = '

' . $space->getName() . '

' . $space->getDescription() . '

'; $subspaces = $space->getSubSpaces(); foreach ($subspaces as $ss) { $html .= $ss->getCardHTML(); } // 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; } }