當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Comments::getErrors方法代碼示例

本文整理匯總了PHP中Comments::getErrors方法的典型用法代碼示例。如果您正苦於以下問題:PHP Comments::getErrors方法的具體用法?PHP Comments::getErrors怎麽用?PHP Comments::getErrors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Comments的用法示例。


在下文中一共展示了Comments::getErrors方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: createComment

 /**
  * Creates a new comment
  * TODO: Figure out how to fix the email issues
  * @param  int  $id   The Comment id
  * @return array
  */
 private function createComment()
 {
     $model = new Comments();
     $model->attributes = $_POST;
     $model->approved = Cii::getConfig('autoApproveComments', 0);
     if ($model->save()) {
         return $model->getApiAttributes();
     }
     return $this->returnError(400, NULL, $model->getErrors());
 }
開發者ID:fandikurnia,項目名稱:CiiMS,代碼行數:16,代碼來源:CommentController.php

示例2: beforeAction

 protected function beforeAction($action)
 {
     if (isset($_REQUEST['Comments'])) {
         $comment = $_REQUEST['Comments'];
         //Yii::app()->notify->add("Добавлен комментарий");
         if (isset($comment)) {
             if (isset($comment['id']) and isset($comment['model'])) {
             }
             $entry = new Comments();
             $entry->entryid = $comment['id'];
             $entry->comment = $comment['comment'];
             $entry->model = "Solutions";
             $entry->student = Yii::app()->my->id;
             if ($entry->save()) {
                 Yii::app()->notify->add("Добавлен комментарий ");
             } else {
                 Yii::app()->notify->addErrors($entry->getErrors());
             }
         }
     }
     return true;
 }
開發者ID:Kapodastr,項目名稱:grow,代碼行數:22,代碼來源:Controller.php

示例3: actionReply

 public function actionReply($id)
 {
     $reply = Comments::model()->findByPk($id);
     $comment = new Comments();
     if (isset($_POST['Comments'])) {
         $comment->attributes = $_POST['Comments'];
         $comment->model = $reply->model;
         $comment->object_id = $reply->object_id;
         $comment->user_id = !Yii::app()->user->isGuest ? Yii::app()->user->id : 0;
         if ($comment->validate()) {
             $comment->appendTo($reply);
             Yii::app()->session['caf'] = CMS::time();
             $data = array('code' => 'success', 'flash_message' => Yii::t('CommentsModule.default', 'COMM_SUCCESS_REPLY'));
         } else {
             $data = array('code' => 'fail', 'response' => $comment->getErrors());
         }
         echo CJSON::encode($data);
     } else {
         $reply->unsetAttributes(array('text'));
         Yii::app()->clientScript->scriptMap = array('jquery.js' => false);
         $this->render('_reply_form', array('model' => $reply), false, true);
     }
 }
開發者ID:buildshop,項目名稱:bs-common,代碼行數:23,代碼來源:DefaultController.php

示例4: addComment

 public function addComment($params = array())
 {
     extract($params);
     if (isset($dynamic_id) && isset($user_id) && $user_id && $dynamic_id) {
         $comment = array('dynamic_id' => $dynamic_id, 'user_id' => $user_id);
         if (isset($content) && $content) {
             $comment['content'] = $content;
         }
         if (isset($image) && $image) {
             if (!is_null(json_decode($image))) {
                 $images = json_decode($image);
                 $comment['images'] = implode(',', $images);
             } else {
                 $comment['images'] = $image;
             }
         }
         if (isset($content) && $content || isset($image) && $image) {
             $model = new Comments();
             $model->attributes = $comment;
             if ($model->validate() && $model->save()) {
                 $ret = $this->notice('OK', 0, '成功', []);
             } else {
                 $ret = $this->notice('ERR', 307, '操作數據錯誤', $model->getErrors());
             }
         } else {
             $ret = $this->notice('ERR', 303, '沒有評論內容', []);
         }
     } else {
         $ret = $this->notice('ERR', 301, '缺少關鍵參數', []);
     }
     return $ret;
 }
開發者ID:kl0428,項目名稱:urtime,代碼行數:32,代碼來源:AllianceService.php

示例5: actionAfterPost

 public function actionAfterPost($st_id, $c_id, $j_id, $pr_id)
 {
     $model = new Comments();
     // uncomment the following code to enable ajax-based validation
     /*
     if(isset($_POST['ajax']) && $_POST['ajax']==='job-profile-_form-form')
     {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     */
     if (isset($_POST['Comments'])) {
         $model->txt = $_POST['Comments']['txt'];
         $model->st_id = $st_id;
         $model->c_id = $c_id;
         $model->j_id = $j_id;
         $model->pr_id = Yii::App()->user->id;
         if ($model->validate()) {
             // form inputs are valid, do something here
             $model->save();
             Yii::app()->user->setFlash('success', 'Comment Posted Successfully ');
             $this->redirect(array('index'));
             return;
         } else {
             var_dump($model->getErrors());
             echo 'validation problem';
         }
     }
 }
開發者ID:shobhit6993,項目名稱:Placement-Portal,代碼行數:29,代碼來源:PlacementRepController.php


注:本文中的Comments::getErrors方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。