本文整理汇总了PHP中Review::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Review::model方法的具体用法?PHP Review::model怎么用?PHP Review::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Review
的用法示例。
在下文中一共展示了Review::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModel
public function loadModel($id)
{
$model = Review::model()->findByPk((int) $id);
if ($model === null) {
throw new CHttpException(404, 'Страница не найдена');
}
return $model;
}
示例2: actionReviewDetail
public function actionReviewDetail()
{
if (isset($_REQUEST['reviewId'])) {
$review = Review::model()->findByPk($_REQUEST['reviewId']);
$reviewReply = Review::model()->reviewFind($_REQUEST['reviewId'], 2, '');
$this->render('reviewDetail', array('review' => $review, 'reviewReply' => $reviewReply));
}
}
示例3: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Review::model()->findByPk((int) $id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例4: run
public function run()
{
$models = Review::model()->published()->findAll(array('order' => 't.sort ASC'));
if (empty($models)) {
return;
}
$this->render($this->view, array('models' => $models));
}
示例5: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
$count = Review::model()->count($criteria);
$pages = new CPagination($count);
// results per page
$pages->pageSize = Yii::app()->settings->getValue('config_admin_limit');
$pages->applyLimit($criteria);
$reviews = Review::model()->findAll($criteria);
$this->render('index', array('reviews' => $reviews, 'pages' => $pages));
}
示例6: reviewData
public function reviewData()
{
if (isset($this->_itemId)) {
if ($this->_rating != 0) {
$model = Review::model()->reviewFind($this->_itemId, $this->_entityId, $this->_rating);
} else {
$model = Review::model()->reviewFind($this->_itemId, $this->_entityId, '');
}
return $model;
}
}
示例7: actionDetail
public function actionDetail()
{
if (isset($_REQUEST['status'])) {
switch ($_REQUEST['status']) {
case 'close':
Review::model()->updateByPk($_GET['id'], ['status' => 'close']);
break;
case 'delete':
Review::model()->updateByPk($_GET['id'], ['status' => 'delete']);
break;
}
}
$this->render('review', ['Review' => Review::model()->findByPk(['review_id' => $_GET['id']])]);
}
示例8: testCreate
/**
* Tests the create review action.
*/
public function testCreate()
{
$note = $this->notes('note1');
$student = $this->students('student1');
$content = 'Test review content.';
$review = new Review();
$review->setAttributes(array('content' => $content));
$this->assertTrue($note->addReview($review, $student->id));
$newReview = Review::model()->findByPk($review->id);
$this->assertNotNull($newReview);
$this->assertTrue($newReview instanceof Review);
$this->assertEquals($content, $newReview->content);
$this->assertEquals($note->id, $newReview->note_id);
$this->assertEquals($student->id, $newReview->student_id);
$this->assertNotEquals('0000-00-00 00:00:00', $newReview->timestamp);
}
示例9: actionEdit
public function actionEdit()
{
$id = $this->iGet('id');
$model = Review::model()->findByPk($id);
if ($model === null) {
$this->redirect(Yii::app()->request->urlReferrer);
}
if (isset($_POST['Review'])) {
$model->attributes = $_POST['Review'];
if ($model->save()) {
Yii::app()->user->setFlash('success', '更新评价成功');
$this->redirect($this->getReferrer());
}
}
$model->formatDate();
$this->render('edit', array('model' => $model));
}
示例10: actionView
public function actionView($id)
{
$teacher = $this->loadModel($id);
$this->_seoTitle = '名师 - ' . $teacher->name;
$userId = $this->_cookiesGet('userId');
$userType = $this->_cookiesGet('userType');
$reviewModel = new Review();
if ($userType === 'student' and isset($_POST['Review'])) {
$reviewModel->attributes = $_POST['Review'];
$reviewModel->teacher_id = $id;
$reviewModel->student_id = $userId;
$reviewModel->ctime = time();
if ($reviewModel->validate() and $reviewModel->save()) {
Yii::app()->user->setFlash('success', '保存成功');
}
}
$criteria = new CDbCriteria();
$books = Book::model()->findAllByAttributes(array('teacher_id' => $id));
$lessons = array();
$reviews = array();
$list = yii::app()->request->getParam('list');
if ($list === null or $list === 'lesson') {
$model = Lesson::model();
$count = $model->count($criteria->addCondition("teacher_id = {$id}"));
$pager = new CPagination($count);
$pager->pageSize = 4;
$pager->applyLimit($criteria);
$lessons = $model->findAll($criteria);
} else {
$model = Review::model();
$count = $model->count($criteria->addCondition("teacher_id = {$id}"));
$pager = new CPagination($count);
$pager->pageSize = 4;
$pager->applyLimit($criteria);
$reviews = Yii::app()->db->createCommand()->select('s.*, r.contents, r.ctime')->from('seed_review r')->leftjoin('seed_student s', 's.id=r.student_id')->where('r.teacher_id=:teacher_id', array(':teacher_id' => $id))->order('ctime desc')->limit(4, $pager->currentPage * $pager->pageSize)->queryAll();
}
//判断学员已关注老师
if ($userType === 'student') {
$is_focus = StudentTeacher::model()->findByAttributes(array('student_id' => $userId, 'teacher_id' => $id));
}
$this->render('view', array('is_focus' => $is_focus, 'teacher' => $teacher, 'lessons' => $lessons, 'reviews' => $reviews, 'books' => $books, 'userType' => $userType, 'reviewModel' => $reviewModel, 'count' => $count, 'pager' => $pager, 'list' => $_GET['list']));
}
示例11: run
public function run()
{
if (!Yii::app()->getUser()->getIsGuest() && !is_null($this->Response) && is_a($this->Response, 'Response') && $this->Response->isCompaniesReadyForReviews()) {
$currentUserCompanyId = Yii::app()->user->getProfile()->company_id;
if ($currentUserCompanyId == $this->Response->from_company_id) {
$companyForReview = $this->Response->to_company_id;
} else {
$companyForReview = $this->Response->from_company_id;
}
$Company = Company::model()->findByPk($companyForReview);
Yii::app()->getModule('rbac');
Yii::app()->getModule('dictionary');
Yii::app()->getModule('cabinet');
// from_company_id to_company_id response_id
$Review = Review::model()->findByAttributes(['response_id' => $this->Response->response_id, 'from_company_id' => $currentUserCompanyId, 'to_company_id' => $companyForReview]);
if (is_null($Review)) {
$labelCreateReview = Yii::t('default', 'Оставить отзыв');
} else {
$labelCreateReview = Yii::t('default', 'Посмотреть свой отзыв');
}
$this->render('index', ['Response' => $this->Response, 'labelCreateReview' => $labelCreateReview]);
}
}
示例12: print_r
" >
</div>
<a href="#none" class="btn-reply-customer" style="cursor:pointer;" data-replyid="<?php
print_r($review_id);
?>
" reply_list_b_id="<?php
echo $i;
?>
">  reply</a>
<div class="clr">
</div>
</div>
</div>
</div>
<?php
$review = Review::model()->reviewFind($review_id, Review::ENTITY_REVIEW, '');
$reviewDatas = $review[0];
$reviewCount = count($reviewDatas);
$pages = $review[1];
if ($reviewCount > 0) {
foreach ($reviewDatas as $reviewData) {
if (isset($reviewData->content)) {
?>
<div class="item-reply" style="display: block;">
<div class="reply-list">
<div class="reply-con">
<span class="u-name"><a><?php
$customer = User::model()->find(array('select' => 'username', 'condition' => 'id=?', 'params' => array($reviewData->customer_id)));
print_r($customer['username']);
?>
示例13: GetReview
/**
* Get user review for this good
* @return Review user review for this good
*/
public function GetReview()
{
$review = Review::model()->findByAttributes(array('good_id' => $this->id, 'user_id' => Yii::app()->user->id));
return $review;
}
示例14: afterDelete
public function afterDelete()
{
// delete dependencies
ProductAttribute::model()->deleteAll("product_id={$this->cacheId}");
ProductDescription::model()->deleteAll("product_id={$this->cacheId}");
ProductDiscount::model()->deleteAll("product_id={$this->cacheId}");
ProductFilter::model()->deleteAll("product_id={$this->cacheId}");
ProductImage::model()->deleteAll("product_id={$this->cacheId}");
ProductOption::model()->deleteAll("product_id={$this->cacheId}");
ProductOptionValue::model()->deleteAll("product_id={$this->cacheId}");
ProductRelated::model()->deleteAll("product_id={$this->cacheId}");
ProductRelated::model()->deleteAll("related_id={$this->cacheId}");
ProductReward::model()->deleteAll("product_id={$this->cacheId}");
ProductSpecial::model()->deleteAll("product_id={$this->cacheId}");
ProductToCategory::model()->deleteAll("product_id={$this->cacheId}");
ProductToDownload::model()->deleteAll("product_id={$this->cacheId}");
ProductToLayout::model()->deleteAll("product_id={$this->cacheId}");
ProductToStore::model()->deleteAll("product_id={$this->cacheId}");
Review::model()->deleteAll("product_id={$this->cacheId}");
UrlAlias::model()->deleteAll("query='product_id={$this->cacheId}'");
parent::afterDelete();
}
示例15: actionReviewClose
/**
* Закрытие отрицательных отзывов, если на них не отреагировали в течении N-дней
*/
public function actionReviewClose()
{
$days_fc = 10;
if (isset(Yii::app()->params['days_for_close_negative_reviews_wo_arbitration'])) {
$days_fc = Yii::app()->params['days_for_close_negative_reviews_wo_arbitration'];
}
$criteria = new CDbCriteria();
$criteria->addCondition("DAY(NOW())-DAY(`create`) >= :days_fc");
$criteria->params['days_fc'] = $days_fc;
$criteria->addColumnCondition(['rating' => 'negative', 'status' => 'new']);
Yii::app()->getModule('rbac');
Yii::app()->getModule('dictionary');
Yii::app()->getModule('cabinet');
// $arrReviews = Review::model()->findAll($criteria);
// Yii::log("actionReviewClose count=[".count( $arrReviews )."]","info");
// foreach( $arrReviews as $v ) {
// Yii::log("actionReviewClose v=[".print_r( $v->attributes )."]","info");
// }
Review::model()->updateAll(['status' => 'close'], $criteria);
}