示例#1
0
文件: profile.php 项目: ecs0/tbmd.com
                    <p>
                        <textarea name="content" cols="40" rows="10" placeholder="Write your review here..."></textarea>
                    </p>
                    <p>
                        <input type="submit" name="submit" value="Submit">
                    </p>
                </form>
            </div>
        </div>
        <div class="overlay" id="edit_review">
            <div>
                <input class="exit" id="edit_review_close" type="button" value="x">
                <h1 id="review_title">Edit Your Review</h1>
                <form method="post" action="php/edit_review_handler.php">
                    <input type="hidden" name="userId" value="<?php 
echo $login->getLoggedInUserId();
?>
">
                    <input type="hidden" name="reviewId" id="reviewId" value="">
                    <input type="hidden" name="return" value="<?php 
echo $return;
?>
">
                    <p>
                        <span class="star_rating" id="edit_movie_rating">
                            <input id="erating10" type="radio" name="rating" value="10">
                            <label for="erating10">10</label>
                            <input id="erating9" type="radio" name="rating" value="9">
                            <label for="erating9">9</label>
                            <input id="erating8" type="radio" name="rating" value="8">
                            <label for="erating8">8</label>
示例#2
0
/**
 * Created by PhpStorm.
 * User: bryan
 * Date: 11/8/15
 * Time: 10:37 AM
 */
include_once "Connection.php";
include_once "LoginManager.php";
if (isset($_POST['submit'])) {
    $movieId = filter_input(INPUT_POST, 'movie');
    $rating = filter_input(INPUT_POST, 'rating');
    $content = filter_input(INPUT_POST, 'content');
    $return = filter_input(INPUT_POST, 'return');
    $login = new LoginManager($return);
    $userId = $login->getLoggedInUserId();
    $connection = new Connection();
    $connection->createReview($userId, $movieId, $rating, $content);
    if (!$return) {
        $return = "../index.php";
    }
    $movie = $connection->getMoviesById([$movieId])[0];
    $title = $movie->getTitle();
    if (strpos($return, "?") !== FALSE) {
        $notificationGets = "&addreview={$title}";
    } else {
        $notificationGets = "?addreview={$title}";
    }
    header("Location: {$return}{$notificationGets}");
} else {
    header("Location: ../index.php");
示例#3
0
文件: Review.php 项目: ecs0/tbmd.com
 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>";
 }