當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。