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


PHP CommentForm::defineShowRating方法代码示例

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


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

示例1: run

 public function run()
 {
     $newComment = $this->createComment();
     $comments = $newComment->getCommentsThree();
     $form = new CommentForm();
     $form->url = $this->url;
     $form->modelName = $this->getModelName();
     $form->modelId = $this->getModelId();
     $form->defineShowRating();
     $this->render('commentsListWidget', array('comments' => $comments, 'newComment' => $newComment, 'form' => $form));
 }
开发者ID:alexjkitty,项目名称:estate,代码行数:11,代码来源:commentListWidget.php

示例2: actionWriteComment

 public function actionWriteComment()
 {
     $model = new CommentForm();
     if (isset($_POST['CommentForm']) && BlockIp::checkAllowIp(Yii::app()->controller->currentUserIpLong)) {
         $model->attributes = $_POST['CommentForm'];
         $model->defineShowRating();
         if ($model->validate() && Comment::checkExist(null, $model->modelName, $model->modelId)) {
             if ($model->modelName == 'News' && !param('enableCommentsForNews', 1) || $model->modelName == 'Apartment' && !param('enableCommentsForApartments', 1) || $model->modelName == 'Menu' && !param('enableCommentsForPages', 0) || $model->modelName == 'Article' && !param('enableCommentsForFaq', 1) || $model->modelName == 'InfoPages' && !param('enableCommentsForPages', 0)) {
                 throw404();
             }
             $comment = new Comment();
             $comment->body = $model->body;
             $comment->parent_id = $model->rel;
             $comment->user_ip = Yii::app()->controller->currentUserIp;
             $comment->user_ip_ip2_long = Yii::app()->controller->currentUserIpLong;
             if ($model->rel == 0) {
                 $comment->rating = $model->rating;
             } else {
                 $comment->rating = -1;
             }
             $comment->model_name = $model->modelName;
             $comment->model_id = $model->modelId;
             if (Yii::app()->user->isGuest) {
                 $comment->user_name = $model->user_name;
                 $comment->user_email = $model->user_email;
             } else {
                 $comment->owner_id = Yii::app()->user->id;
             }
             if (param('commentNeedApproval', 1) && !Yii::app()->user->checkAccess('backend_access')) {
                 $comment->status = Comment::STATUS_PENDING;
                 Yii::app()->user->setFlash('success', Yii::t('module_comments', 'Thank you for your comment. Your comment will be posted once it is approved.'));
             } else {
                 $comment->status = Comment::STATUS_APPROVED;
                 Yii::app()->user->setFlash('success', Yii::t('module_comments', 'Thank you for your comment.'));
             }
             $comment->save(false);
             $this->redirect($model->url);
         }
     }
     $this->render('commentForm', array('model' => $model));
 }
开发者ID:barricade86,项目名称:raui,代码行数:41,代码来源:MainController.php

示例3: _calcRating

 public function _calcRating()
 {
     $form = new CommentForm();
     $form->modelName = $this->model_name;
     $form->defineShowRating();
     if ($form->enableRating && $this->rating != -1) {
         $rating = self::calcRating($this->model_name, $this->model_id);
         $tmp = new $this->model_name();
         $tmp->writeRating($this->model_id, $rating);
     }
 }
开发者ID:barricade86,项目名称:raui,代码行数:11,代码来源:Comment.php


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