NotificationsController.inc 993 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class NotificationsController implements IController {
  3. public function execute() {
  4. $view = new View();
  5. $form = new Form();
  6. $headRenderer = new HeadRenderer();
  7. $user = new User();
  8. $notificationScraper = new NotificationScraper();
  9. $postRenderer = new PostRenderer();
  10. $user->populate();
  11. $userId = $user->getId();
  12. $viewData = array(
  13. "header" => $headRenderer->render()
  14. );
  15. $page = $form->getCleanDefaulted('p', 0);
  16. if ($userId) {
  17. //TODO: go through all posts made, pull any that are updated since last viewed
  18. //TODO: go through all comments made, pull any that are updated since last viewed
  19. $viewData['user'] = $user;
  20. $tagModel = new TagModel();
  21. $unreadTags = $tagModel->geAllTagsForUser($userId, $page);
  22. $tagModel->markTagDataRead($unreadTags);
  23. $viewData['unreadTags'] = $unreadTags;
  24. return $view->render("notificationsView.inc", $viewData);
  25. } else {
  26. return $view->render("logInPromptView.inc", $viewData);
  27. }
  28. }
  29. }