public function render() { //Echo the view //renders the header automatically Header::renderHeader(); $giveFeedbackManager = new GiveFeedbackManager(); $feedbackManager = new FeedbackManager(); $updateFailedBlock = ''; if ($this->updateFailed) { $updateFailedBlock .= '<h6 id="update_fail"><i class="glyphicon glyphicon-alert"></i> Some of your information is incorrect.</h6></span>'; } $user_to_id = $_REQUEST['user_to_id']; $auction_id = $_REQUEST['auction_id']; ?> <div id="giveFeedback" class="container"> <div class="well well-small"> <h3>Feedback</h3> <?php echo "<h4>On user: "******"</h4>"; ?> <?php foreach ($giveFeedbackManager->getAuction($auction_id) as $auction) { echo "<h4>On auction: " . $auction->title . "</h4>"; } echo '<form class="form-horizontal" action="/auction/giveFeedbackForm?user_to_id=' . $user_to_id . '&auction_id=' . $auction_id . '" method="post" role="form">'; ?> <div class="form-group"> <label class="control-label col-sm-3">Rating:</label> <div class="col-sm-9"> <select name="rating" class="form-control" id="sel1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> </div> </div> <div class="form-group"> <label class="control-label col-sm-3" for="pwd">Comments:</label> <div class="col-sm-9"> <textarea type="text" name="comment" class="form-control" rows="5" required="required" id="comment" placeholder="Enter comments about user"></textarea> </div> </div> <?php echo $updateFailedBlock; ?> <div class="form-group"> <div class="col-sm-12"> <button type="submit" class="btn btn-primary btn-large btn-block">Submit</button> </div> </div> </form> </div> </div> <?php }
<?php include_once '../bootstrap.php'; use Models\GiveFeedbackManager; use Views\GiveFeedbackView; use Views\HomepageView; use Models\LoginManager; // login protected page LoginManager::startSessionAndRedirectIfNotLoggedIn(); $user_to_id = $_REQUEST['user_to_id']; $auction_id = $_REQUEST['auction_id']; $rating = $_REQUEST['rating']; $comment = $_REQUEST['comment']; $giveFeedbackManager = new GiveFeedbackManager(); $isFeedbackUpdateSuccess = $giveFeedbackManager->leaveFeedback($_SESSION['userID'], $user_to_id, $auction_id, $rating, $comment); if ($isFeedbackUpdateSuccess) { echo "<script type='text/javascript'>alert('Feedback submitted successfully!!')</script>"; header("Location: /auction/homepage"); //exit(); } else { $GiveFeedbackView = new GiveFeedbackView(true); $GiveFeedbackView->render(); }