<?php /** * For normal users usage of chatrooms */ namespace cd; $session->requireLoggedIn(); switch ($this->owner) { case 'like': $status = PersonalStatus::get($this->child); if (!$status) { die('WEEH'); } if (Like::isLiked($status->id, STATUS, $session->id)) { die('LIKED'); } Like::set($status->id, STATUS, $session->id); redir('u/profile/' . $status->owner); break; default: echo 'No handler for view ' . $this->owner; }
public function newsFeed() { $data = $this->model->newsFeed(Session::get('id')); $like_controller = new Like(); for ($i = 0; $i < count($data); ++$i) { $data[$i]['isLiked'] = $like_controller->isLiked($data[$i]['post_id']); } $this->view->posts = $data; $this->view->styles = array(); array_push($this->view->styles, URL . "/Public/bootstrap/css/styles.css"); array_push($this->view->styles, URL . "/Public/bootstrap/css/post.css"); $this->view->render('post/newsfeed'); }