当前位置: 首页>>代码示例>>PHP>>正文


PHP Review::setReviewId方法代码示例

本文整理汇总了PHP中Review::setReviewId方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::setReviewId方法的具体用法?PHP Review::setReviewId怎么用?PHP Review::setReviewId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Review的用法示例。


在下文中一共展示了Review::setReviewId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateReview

 public static function updateReview()
 {
     // Process updating review
     $reviews = ReviewsDB::getReviewsBy('reviewId', $_SESSION['arguments']);
     if (empty($reviews)) {
         HomeView::show();
         header('Location: /' . $_SESSION['base']);
     } elseif ($_SERVER["REQUEST_METHOD"] == "GET") {
         $_SESSION['reviews'] = $reviews;
         ReviewView::showUpdate();
     } else {
         $parms = $reviews[0]->getParameters();
         $parms['score'] = array_key_exists('score', $_POST) ? $_POST['score'] : $reviews[0]->getScore();
         $parms['review'] = array_key_exists('review', $_POST) ? $_POST['review'] : $reviews[0]->getReview();
         $newReview = new Review($parms);
         $newReview->setReviewId($reviews[0]->getReviewId());
         $review = ReviewsDB::updateReview($newReview);
         if ($review->getErrorCount() != 0) {
             $_SESSION['reviews'] = array($newReview);
             ReviewView::showUpdate();
         } else {
             HomeView::show();
             header('Location: /' . $_SESSION['base']);
         }
     }
 }
开发者ID:bennilyn,项目名称:examples,代码行数:26,代码来源:ReviewController.class.php

示例2: getReviewsArray

 public static function getReviewsArray($rowSets)
 {
     // Return an array of Review objects extracted from $rowSets
     $reviews = array();
     foreach ($rowSets as $reviewRow) {
         $review = new Review($reviewRow);
         $review->setReviewId($reviewRow['reviewId']);
         array_push($reviews, $review);
     }
     return $reviews;
 }
开发者ID:raroseman,项目名称:cs4413-Hoodflix,代码行数:11,代码来源:ReviewDB.class.php

示例3: testUpdateReview

 public function testUpdateReview()
 {
     $myDb = DBMaker::create('ptest');
     Database::clearDB();
     $db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
     $beforeCount = count(ReviewsDB::getReviewsBy());
     $reviews = ReviewsDB::getReviewsBy('reviewId', 1);
     $currentReview = $reviews[0];
     $parms = $currentReview->getParameters();
     $parms['review'] = 'new review text';
     $newReview = new Review($parms);
     $newReview->setReviewId($currentReview->getReviewId());
     $updatedReview = ReviewsDB::updateReview($newReview);
     $afterCount = count(ReviewsDB::getReviewsBy());
     $this->assertEquals($beforeCount, $afterCount, 'The number of reviews in the database should not change after update');
     $this->assertEquals($updatedReview->getReviewId(), $newReview->getReviewId(), 'The id of the updated review should remain the same');
 }
开发者ID:bennilyn,项目名称:examples,代码行数:17,代码来源:ReviewsDBTest.php

示例4: array

<?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>
开发者ID:bennilyn,项目名称:examples,代码行数:30,代码来源:ReviewView_tests.php

示例5: count

echo "Now the database has {$afterCount}<br>";
?>

<h2>It should all update of a valid review</h2>
<?php 
DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$beforeCount = count(ReviewsDB::getReviewsBy());
$reviews = ReviewsDB::getReviewsBy('reviewId', 1);
$currentReview = $reviews[0];
echo "Current review: {$currentReview}<br>";
$parms = $currentReview->getParameters();
$parms['review'] = 'new review text';
$newReview = new Review($parms);
$newReview->setReviewId($currentReview->getReviewId());
$updatedReview = ReviewsDB::updateReview($newReview);
echo "Updated review: {$updatedReview}<br>";
$afterCount = count(ReviewsDB::getReviewsBy());
echo "<br>Count before update = {$beforeCount}<br>";
echo "Count after = {$afterCount}<br>";
?>

 <h2>It should get a review by reviewer name</h2>
<?php 
DBMaker::create('ptest');
Database::clearDB();
$db = Database::getDB('ptest', 'C:\\xampp\\myConfig.ini');
$reviews = ReviewsDB::getReviewsBy('reviewerName', 'Alice');
echo "<br>Number of reviews by Alice is " . count($reviews);
foreach ($reviews as $review) {
开发者ID:bennilyn,项目名称:examples,代码行数:31,代码来源:ReviewsDB_tests.php


注:本文中的Review::setReviewId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。