Esempio n. 1
0
 public function asBlockView()
 {
     $movie = $this->getMovie();
     $title = $movie->getTitle();
     $movieId = $movie->getId();
     $link = "movie.php?id={$movieId}";
     $a = "<a href='" . $link . "' target='_blank'>{$title}</a>";
     $header = "<h3>{$a}</h3>";
     $stars = "";
     $login = new LoginManager("../error.php");
     $userId = $this->user->getId();
     if ($login->isLoggedIn() && $userId == $login->getLoggedInUserId()) {
         $addReview = "<input class='edit_review' id='edit_" . $this->id . "' type='button' value='Edit'>";
     } else {
         $addReview = "";
     }
     for ($i = 0; $i < $this->rating; $i++) {
         $stars .= "<img src='./images/star-on.svg'>";
     }
     for ($i = $this->rating; $i < 10; $i++) {
         $stars .= "<img src='./images/star-off.svg'>";
     }
     $userLink = "profile.php?id=" . $this->getUser()->getId();
     $userA = "<a href='" . $userLink . "' target='_blank'>{$this->user}</a>";
     $submission = "<p><strong>Submitted By: </strong>{$userA}</p>";
     $date = "<p><strong>Submitted On: </strong>{$this->submitDate}</p>";
     $ratingValue = "<span class='rating'>{$this->rating}</span>";
     $rating = "<p>{$stars}</p>";
     $review = "<p><strong>Review: </strong><span class='review_content'>{$this->reviewContent}</span></p>";
     $id = "'review_" . $this->id . "'";
     return "<div id={$id} class='review_block'>{$addReview}{$header}{$submission}{$date}{$rating}{$review}{$ratingValue}</div>";
 }