当前位置: 首页>>代码示例>>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;未经允许,请勿转载。