コード例 #1
1
 public static function run()
 {
     $action = array_key_exists('action', $_SESSION) ? $_SESSION['action'] : "";
     $arguments = $_SESSION['arguments'];
     switch ($action) {
         case "new":
             if ($_SERVER["REQUEST_METHOD"] == "POST") {
                 $reviewData = new ReviewData($_POST);
                 if ($reviewData->getErrorCount() == 0) {
                     $dbReviewData = ReviewDB::addReview($reviewData);
                     HomeView::show();
                 } else {
                     ReviewView::show($reviewData);
                 }
             } else {
                 ReviewView::show(null);
             }
             break;
         case "show":
             $users = UsersDB::getUsersBy('userId', $arguments);
             $_SESSION['user'] = !empty($users) ? $users[0] : null;
             self::show();
             break;
         case "showall":
             $_SESSION['reviews'] = ReviewDB::getReviewsBy();
             $_SESSION['headertitle'] = "h00dFliX Reviews";
             $_SESSION['footertitle'] = "<h3>The footer goes here</h3>";
             ReviewsView::showall();
             break;
         case "update":
             echo "Update";
             self::updateUser();
             break;
         default:
     }
 }
コード例 #2
0
 public static function run()
 {
     // Perform actions related to a review
     $action = $_SESSION['action'];
     $arguments = $_SESSION['arguments'];
     switch ($action) {
         case "new":
             self::newReview();
             break;
         case "show":
             $reviews = ReviewsDB::getReviewsBy('reviewId', $arguments);
             $_SESSION['review'] = !empty($reviews) ? $reviews[0] : null;
             ReviewView::show();
             break;
         case "showall":
             $_SESSION['reviews'] = reviewsDB::getReviewsBy();
             $_SESSION['headertitle'] = "ClassBash Reviews";
             $_SESSION['footertitle'] = "<h3>The footer goes here</h3>";
             ReviewView::showall();
             break;
         case "update":
             self::updateReview();
             break;
         default:
     }
 }
コード例 #3
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         HomeView::show();
     } else {
         // Initial link
         ReviewView::show();
     }
 }
コード例 #4
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $reviewData = new ReviewData($_POST);
         if ($reviewData->getErrorCount() == 0) {
             HomeView::show();
         } else {
             ReviewView::show($reviewData);
         }
     } else {
         ReviewView::show(null);
     }
 }
コード例 #5
0
 public static function run()
 {
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         $review = new Review($_POST);
         if ($review->getErrorCount() == 0) {
             HomeView::show(null);
         } else {
             ReviewView::show($review);
         }
     } else {
         // Initial link
         ReviewView::show(null);
     }
 }
コード例 #6
0
<?php 
$input = array("reviewerName" => "Kay", "submissionID" => 2, "score" => "5", "review" => "This was a great presentation");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The reviewer name is " . $theReview->getReviewerName() . "<br>";
$_SESSION = array('reviews' => array($theReview), 'base' => "mvcdbcrud");
ReviewView::show();
?>

<h2>It should show display the review form with errors at the top if invalid entry</h2>
<?php 
$input = array("reviewerName" => "Kay#");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The reviewer name is " . $theReview->getReviewerName() . "<br>";
$_SESSION = array('reviews' => array($theReview), 'base' => "mvcdbcrud");
ReviewView::show();
?>

<h2>It should allow updating when a valid review is passed</h2>
<?php 
$validTest = array("reviewerName" => "Kay", "submissionId" => 2, "score" => "5", "review" => "This was a great presentation");
$review = new Review($validTest);
$review->setReviewId(1);
echo $review;
$_SESSION = array('reviews' => array($review), 'base' => "mvcdbcrud");
ReviewView::showUpdate();
?>
</body>
</html>
コード例 #7
0
include_once "../models/Messages.class.php";
include_once "../models/Review.class.php";
include_once "../views/MasterView.class.php";
include_once "../views/ReviewView.class.php";
?>

<h2>It should call show </h2>
<?php 
ReviewView::show(null);
?>

<h2>It should show successfully when review is passed to show</h2>
<?php 
$input = array("firstName" => "Kay");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The first name is " . $theReview->getFirstName() . "<br>";
ReviewView::show($theReview);
?>

<h2>It should show display the review form with errors at the top if invalid entry</h2>
<?php 
$input = array("firstName" => "Kay#");
$theReview = new Review($input);
echo "The review {$theReview}";
echo "The first name is " . $theReview->getFirstName() . "<br>";
ReviewView::show($theReview);
?>
</body>
</html>
コード例 #8
0
<html>
<head>
<meta charset="utf-8">
<title>Basic tests for ReviewView</title>
</head>
<body>
<h1>ReviewView Test</h1>

<?php 
include_once "../models/ReviewData.class.php";
include_once "../views/ReviewView.class.php";
?>

<h2>It should call show when $reviewData has an input</h2>
<?php 
$testReviewData = array("movieTitle" => "Friday", "reviewedBy" => "Thugnificent", "reviewedOn" => "2015-10", "review" => "A+! Great Movie!");
$reviewDataTest = new ReviewData($testReviewData);
ReviewView::show($reviewDataTest);
?>
</body>
</html>