public function view() { $id = (int) $this->getParams()[0]; $this->modelComment = $this->loadModel('CommentsEvent'); $comment = $this->modelComment->getCommentsForEvent($id); print_r($comment)[0]; //$this->getView()->render('admin/comment', array('comments' => $comment)); }
public function testAllEvent() { $this->modelEvent = new CommentsEventModel(); $state = $this->modelEvent->insertCommentEvent(1, 1, 'Trop SWAG'); $this->assertEquals(true, $state); $array = $this->modelEvent->getCommentsForEvent(1); $this->assertNotEmpty($array); $state = $this->modelEvent->deleteCommentEvent(0); $this->assertEquals(true, $state); }
public function show() { $id = (int) $this->getParams()[0]; $event = $this->eventModel->get($id); if (empty($event)) { throw new EventNotFoundException($id); } $event = $this->getInfos($event); $participate = Authentication::getInstance()->isAuthenticated() ? $this->eventModel->getParticipateUser($id, Authentication::getInstance()->getUserId()) : null; $event['mine'] = Authentication::getInstance()->isAuthenticated() ? $event['user']['id'] == Authentication::getInstance()->getUserId() : false; $participateModel = new ParticipateModel(); $userParticipating = $participateModel->getEventParticipation($id); $comments = $this->eventCommentModel->getCommentsForEvent($id); $userList = array(); foreach ($userParticipating as $key => $value) { $userList[] = $value['username']; } $this->getView()->render('event/show', array('event' => $event, 'participate' => $participate, 'comments' => $comments, 'users' => $userList)); }