function __construct() { $this->checkRights(); if (Funcs::$uri[2] == '') { $list = Feedback::getList(); View::plugin('index', array('list' => $list)); } elseif (Funcs::$uri[2] == 'history') { $list = Feedback::getList('history'); View::plugin('index', array('list' => $list)); } }
if (isset($_GET['referenceId'])) { $referenceId = $_GET['referenceId']; } $userId = ''; if (isset($_GET['userId'])) { $userId = $_GET['userId']; } if ($tripId === '' || $referenceId === '') { $response = errorResponse(RESPONSE_BAD_REQUEST); } else { if (!$auth->canGetFeedback($tripId, $referenceId)) { $response = errorResponse(RESPONSE_UNAUTHORIZED); } else { if ($userId === '') { // Request for a list $list = Feedback::getList($tripId, $referenceId); $response = successResponse(); $response['tripId'] = $tripId; $response['referenceId'] = $referenceId; $response['list'] = $list; } else { $object = new Feedback($tripId, $referenceId, $userId); if ($object->getCreated() === null) { $response = errorResponse(RESPONSE_NOT_FOUND); } else { $response = successResponse(); $response['tripId'] = $object->getTripId(); $response['referenceId'] = $object->getReferenceId(); $response['userId'] = $object->getUserId(); $response['created'] = $object->getCreated(); $response['updated'] = $object->getUpdated();