UserController.inc 550 B

123456789101112131415161718192021
  1. <?php
  2. class UserController implements IController {
  3. public function execute() {
  4. $form = new Form();
  5. $userId = $form->getCleanDefaulted('id', 0);
  6. $view = new View();
  7. $postRenderer = new PostRenderer();
  8. $postsView = $postRenderer->getPostsByUser($userId);
  9. // TODO: get both posts and comments, arrange them by date and display them together
  10. $headRenderer = new HeadRenderer();
  11. $viewData = array(
  12. 'postsView' => $postsView,
  13. 'header' => $headRenderer->render()
  14. );
  15. return $view->render('userPage.inc', $viewData);
  16. }
  17. }