本文整理汇总了PHP中Review类的典型用法代码示例。如果您正苦于以下问题:PHP Review类的具体用法?PHP Review怎么用?PHP Review使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Review类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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']);
}
}
}
示例2: actionIndex
public function actionIndex()
{
$model = new Review();
$model->unsetAttributes();
$model->attributes = $this->aRequest('Review');
$this->render('index', array('model' => $model));
}
示例3: buildArrayResponse
/**
* Converts the response in JSON format to the list of value objects i.e
* Review
*
* @param json
* - response in JSON format
*
* @return List of Review object filled with json data
*
*/
function buildArrayResponse($json)
{
$reviewList = array();
$reviewsJSONObject = $this->getServiceJSONObject("reviews", $json);
if ($reviewsJSONObject->__get("review") instanceof JSONObject) {
$reviewJSONObject = $reviewsJSONObject->__get("review");
$reviewJSONObject = new JSONObject($reviewJSONObject);
$reviewObj = new Review();
$reviewObj->setStrResponse($json);
$reviewObj->setResponseSuccess($this->isRespponseSuccess($json));
$this->buildObjectFromJSONTree($reviewObj, $reviewJSONObject);
array_push($reviewList, $reviewObj);
} else {
// There is an Array of attribute
$reviewJSONArray = $reviewsJSONObject->getJSONArray("review");
for ($i = 0; $i < count($reviewJSONArray); $i++) {
$reviewJSONObj = $reviewJSONArray[$i];
$reviewObj = new Review();
$reviewObj->setStrResponse($json);
$reviewJSONObj = new JSONObject($reviewJSONObj);
$reviewObj->setResponseSuccess($this->isRespponseSuccess($json));
$this->buildObjectFromJSONTree($reviewObj, $reviewJSONObj);
array_push($reviewList, $reviewObj);
}
}
return $reviewList;
}
示例4: testCreateInvalid
/**
* Tests the create review action with invalid input.
*/
public function testCreateInvalid()
{
$note = $this->notes('note1');
$student = $this->students('student1');
// Empty content
$review = new Review();
$review->setAttributes(array('content' => null));
$this->assertFalse($note->addReview($review, $student->id));
}
示例5: review
public function review(Request $request, $id)
{
$validation = Validator::make($request->all(), ['rating' => 'required|between:1,10', 'title' => 'required|min:5', 'description' => 'required|min:5']);
if ($validation->fails()) {
return redirect('dvds/' . $id)->withInput()->withErrors($validation);
}
$review = new Review(['rating' => $request->input('rating'), 'title' => $request->input('title'), 'description' => $request->input('description'), 'dvd_id' => $id]);
$review->save();
return redirect('dvds/' . $id)->with('success', true);
}
示例6: load_many_from_query
public static function load_many_from_query($sql, $args)
{
$sth = Dal::query($sql, $args);
$items = array();
while ($r = Dal::row_assoc($sth)) {
$rev = new Review();
$rev->load_from_row($r);
$items[] = $rev;
}
return $items;
}
示例7: 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;
}
示例8: index
public function index()
{
if ($this->c_user->isTrialPlanEnds()) {
$this->addFlash(lang('subscription_ends_error', [site_url('subscript/plans')]), 'error');
}
// UNCOMMENT TO USE
// get average google rank for all keywords for chart in range
$keyword_rank = Keyword::average_for_range($this->c_user->id, '-30 days', 'today');
// average result for all the range
$keywords_trending = Keyword::average_for_range($this->c_user->id, '-30 days', 'today', FALSE);
// average for each day in range
// analytics data
$google_access_token = Access_token::getByTypeAndUserId('googlea', $this->c_user->id);
list($ga_visits_chart, $ga_visits_count) = $google_access_token->google_analytics_dashboard_visits();
$review = new Review();
$last_reviews_count = $review->last_period_count($this->c_user->id, $this->profile->id);
$review->clear();
$social_values = Social_value::inst();
$social_values->set_values($this->c_user->id, $this->profile->id, array('from' => date('Y-m-d', strtotime('-30 days')), 'to' => date('Y-m-d', time())));
$all_socials_data = $social_values->get_data();
$monthly_trending = array('reviews' => $review->last_month_trending($this->c_user->id, $this->profile->id), 'traffic' => $ga_visits_chart, 'keywords' => $keywords_trending, 'twitter_followers' => $all_socials_data['twitter'], 'facebook_likes' => $all_socials_data['facebook']);
$keywordsForHighlight = Mention_keyword::inst()->get_for_highlight($this->c_user->id, 0);
CssJs::getInst()->add_js('www.google.com/jsapi', 'external', 'footer');
CssJs::getInst()->add_js(array('libs/lodash.compat.js', 'libs/highcharts/highcharts.js'))->c_js();
$opportunities = $this->getOpportunities();
if (!empty($opportunities['web_radar'])) {
CssJs::getInst()->add_js('controller/webradar/index.js');
}
JsSettings::instance()->add(array('monthly_trending' => $monthly_trending, 'dashboard' => true, 'keywords' => $keywordsForHighlight, 'opportunities' => $opportunities));
$summary = array('reviews' => (int) $last_reviews_count, 'fb_likes' => (int) $all_socials_data['likes_count'], 'twiter_followers' => (int) $all_socials_data['followers_count'], 'web_traffic' => (int) $ga_visits_count, 'google_rank' => (int) round($keyword_rank, 3));
$this->isSupportScheduledPosts = $this->getAAC()->isGrantedPlan('scheduled_posts');
$this->load->helper('my_url_helper');
$this->template->set('isSupportScheduledPosts', $this->isSupportScheduledPosts);
$this->template->set('socials', Social_post::getActiveSocials($this->profile->id));
$this->is_user_set_timezone = User_timezone::is_user_set_timezone($this->c_user->id);
JsSettings::instance()->add(array('twitterLimits' => array('maxLength' => 140, 'midLength' => 117, 'lowLength' => 94), 'twitterLimitsText' => lang('twitter_error'), 'linkedinLimits' => array('maxLength' => 400), 'linkedinLimitsText' => lang('linkedin_error')));
CssJs::getInst()->add_css(array('custom/pick-a-color-1.css'));
CssJs::getInst()->add_js(array('libs/jq.file-uploader/jquery.iframe-transport.js', 'libs/jq.file-uploader/jquery.fileupload.js', 'libs/fabric/fabric.min.js', 'libs/fabric/StackBlur.js', 'libs/color/tinycolor-0.9.15.min.js', 'libs/color/pick-a-color-1.2.3.min.js'));
CssJs::getInst()->c_js('social/create', 'post_update');
CssJs::getInst()->c_js('social/create', 'post_cron');
CssJs::getInst()->c_js('social/create', 'post_attachment');
CssJs::getInst()->c_js('social/create', 'social_limiter');
CssJs::getInst()->c_js('social/create', 'schedule_block');
CssJs::getInst()->c_js('social/create', 'bulk_upload');
$this->template->set('is_user_set_timezone', User_timezone::is_user_set_timezone($this->c_user->id));
$user_posts = Social_post::inst()->get_user_scheduled_posts($this->c_user->id, $this->profile->id, 1, 3, 'all');
$this->template->set('posts', $user_posts);
$this->load->helper('Image_designer_helper');
$this->template->set('imageDesignerImages', Image_designer::getImages());
$this->template->set('summary', $summary);
$this->template->set('opportunities', $opportunities);
$this->template->set('need_welcome_notification', User_notification::needShowNotification($this->c_user->id, User_notification::WELCOME));
$this->template->render();
}
示例9: actionCreate
public function actionCreate()
{
$model = new Review();
if (isset($_POST['Review'])) {
$model->attributes = $_POST['Review'];
if ($model->validate() && $model->save()) {
$this->redirect(array('index'));
}
}
$statuses = array(0 => Yii::t('common', 'Disabled'), 1 => Yii::t('common', 'Enabled'));
$this->render('create', array('model' => $model, 'statuses' => $statuses));
}
示例10: run
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);
}
}
示例11: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl();
$model = new Review();
if (isset($_POST['Review'])) {
$acl = $this->_gets->getPost('acl');
$model->attributes = $_POST['Review'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入内容,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('review_create', array('model' => $model));
}
示例12: grabber
public function grabber(array $directory_user)
{
log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Reviews grabber');
try {
$directoryUser = new Directory_User($directory_user['id']);
if (!$directoryUser->exists()) {
throw new Exception('Directory_User id:' . $directory_user['id'] . ' doesn\'t exist');
}
$directory = $directoryUser->directory->get();
if (!$directory->exists()) {
throw new Exception('Directory id:' . $directory_user['directory_id'] . ' doesn\'t exist');
}
if (!$directory->status) {
throw new Exception('Directory id:' . $directory_user['directory_id'] . ' is disabled');
}
$link = !empty($directory_user['additional']) ? $directory_user['additional'] : $directory_user['link'];
log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Try to grabb - ' . $directory->name);
$aac = $this->getAAC();
$user = new User($directory_user['user_id']);
if (!$user->exists()) {
return;
}
$aac->setUser($user);
$directory_parcer = Directory_Parser::factory($directory->type)->set_url($link);
$reviews = $directory_parcer->get_reviews();
/**
* Store additional data to
*/
if ($directory_parcer instanceof Directory_Interface_UserStorage) {
$directoryUser->setAdditional($directory_parcer->getDataToStore())->save();
}
} catch (Exception $e) {
log_message('TASK_ERROR', __FUNCTION__ . ' > ' . 'Reviews: ' . $e->getMessage());
throw $e;
}
//$today_midnight = strtotime('-7 day midnight');
$today_midnight = strtotime('-14 day midnight');
if (is_array($reviews) && !empty($reviews)) {
foreach ($reviews as $_review) {
$review_model = new Review();
$review_model->from_array($_review);
$review_model->user_id = $directory_user['user_id'];
$review_model->directory_id = $directory_user['directory_id'];
$review_model->profile_id = $directory_user['profile_id'];
$review_model->posted_date = date('Y-m-d', $_review['posted']);
$review_model->save();
log_message('TASK_DEBUG', __FUNCTION__ . ' > ' . 'Review saved');
}
}
}
示例13: test_getAll
function test_getAll()
{
//Arrange
$review = "Pizza was dope";
$restaurant_id = 1;
$test_review = new Review($review, $restaurant_id);
$test_review->save();
$review2 = "DAMN DAT GRILLED CHEESE IS FIRE";
$restaurant_id2 = 2;
$test_review2 = new Review($review2, $restaurant_id2);
$test_review2->save();
//Act
$result = Review::getAll();
//Assert
$this->assertEquals([$test_review, $test_review2], $result);
}
示例14: render_for_post
function render_for_post()
{
if (empty(PA::$login_user)) {
return __("Login required");
}
$rev = new Review();
$rev->author_id = PA::$login_user->user_id;
$rev->subject_type = $this->params["subject_type"];
$rev->subject_id = $this->params["subject_id"];
//TODO: validate subject_type and subject_id
$rev->title = $this->params["title"];
$rev->body = $this->params["body"];
//TODO: ensure html is stripped properly
$rev->save();
return $this->render();
}
示例15: postIndex
/**
* Display a listing of destinos
*
* @return Response
*/
public function postIndex()
{
$input = Input::all();
if (!empty($input)) {
$review = new Review();
$review->cliente_id = Auth::user()->id;
$review->produto_id = $input['produto_id'];
$review->titulo = $input['review-titulo'];
$review->texto = $input['review-texto'];
$review->nota = $input['review-nota'];
$review->save();
return Redirect::back()->with('success', array('Sua avaliação foi enviada e em breve sera analisada.'));
} else {
return Redirect::back()->with('danger', array('preencha todos os campos da avaliação.'));
}
}