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


PHP Reply::save方法代码示例

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


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

示例1: actionReadTopic

 public function actionReadTopic($id)
 {
     $thread = Thread::model()->getThreadInfoById($id);
     $this->areaLarge = $thread['program_name'];
     $this->areaSmall = $thread['semester_name'];
     $reply = new Reply();
     $complaint = new Complaint('postComplaint');
     if (isset($_POST['Reply'])) {
         $reply->attributes = $_POST['Reply'];
         $reply->post_item_id = $id;
         if ($reply->save()) {
             Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.reply.success'));
             $reply->unsetAttributes();
         } else {
             Yii::app()->user->setFlash('error', Yii::t('forum', 'forum.view.reply.error'));
         }
     }
     if (isset($_POST['Complaint'])) {
         $complaint->attributes = $_POST['Complaint'];
         if ($complaint->save()) {
             if ($complaint->post_item_id == $id) {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             } else {
                 Yii::app()->user->setFlash('success', Yii::t('forum', 'forum.view.complaint.success'));
             }
             $complaint->unsetAttributes();
         } else {
             Yii::app()->clientScript->registerScript('show_modal', "\$('#reportModal').modal('show');", CClientScript::POS_READY);
         }
     }
     $dataProvider = Thread::model()->getPostsDataInThread($id);
     Yii::log(CVarDumper::dumpAsString($dataProvider->getData()));
     $this->render('application.modules.community.views.front.post.view', array('thread' => $thread, 'threadId' => $id, 'dataProvider' => $dataProvider, 'reply' => $reply, 'complaint' => $complaint));
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:34,代码来源:PostController.php

示例2: run

 public function run()
 {
     $this->controller->layout = false;
     if (Yii::app()->request->isPostRequest) {
         //当前登录用户id
         $uid = Yii::app()->user->id;
         if (!$uid) {
             exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'You Need Login'))));
         }
         $cid = intval($_POST['cid']);
         $reply_id = intval($_POST['reply_id']);
         $content = $_POST['content'];
         $comment = Comment::model()->findByPk($cid);
         $reply = Reply::model()->findByPk($reply_id);
         if ($comment) {
             //不能对自己的评论和回复而回复
             if ($comment->user_id == $uid && !$reply || $reply && $reply->user_id == $uid) {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'You Can not Rely Yourself'))));
             }
             if (!$content || strlen($content) < 10) {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Content Is Too Small'))));
             }
             $model = new Reply('create');
             $model->cid = $cid;
             $model->user_id = $uid;
             $model->reply_id = $reply_id;
             $model->content = $content;
             $model->status = 'Y';
             $model->create_time = time();
             if ($model->save()) {
                 exit(CJSON::encode(array('status' => 'success', 'message' => Yii::t('common', 'Reply Success'))));
             } else {
                 exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
             }
         } else {
             exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
         }
     } else {
         exit(CJSON::encode(array('status' => 'error', 'message' => Yii::t('common', 'Reply Failed'))));
     }
 }
开发者ID:jerrylsxu,项目名称:yiifcms,代码行数:41,代码来源:ReplyAction.php

示例3: actionReplyMsg

 public function actionReplyMsg()
 {
     $message_id = Yii::app()->request->getParam('message_id');
     $content = Yii::app()->request->getParam('content');
     if (!$content) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '回复内容不能为空'));
     }
     if (!$message_id) {
         $this->errorOutput(array('errorCode' => 2, 'errorText' => '没有留言id'));
     }
     $model = new Reply();
     $model->message_id = $message_id;
     $model->user_id = -1;
     $model->content = $content;
     $model->create_time = time();
     if ($model->save()) {
         $this->output(array('success' => 1, 'successText' => '回复成功'));
     } else {
         $this->errorOutput(array('errorCode' => 3, 'errorText' => '回复失败'));
     }
 }
开发者ID:elite-lcf,项目名称:mictfood,代码行数:21,代码来源:MessageController.php

示例4: actionReplyMessage

 public function actionReplyMessage()
 {
     $message_id = Yii::app()->request->getParam('reply_id');
     $reply_content = Yii::app()->request->getParam('reply_content');
     if (!isset(Yii::app()->user->member_userinfo)) {
         $this->errorOutput(array('errorCode' => 1, 'errorText' => '你还未登录,请先去登录'));
     } else {
         $user_id = Yii::app()->user->member_userinfo['id'];
     }
     if (!$reply_content) {
         $this->errorOutput(array('errorCode' => 2, 'errorText' => '回复内容不能为空'));
     }
     if (!$message_id) {
         $this->errorOutput(array('errorCode' => 3, 'errorText' => '未选择回复留言'));
     }
     $model = new Reply();
     $model->message_id = $message_id;
     $model->user_id = $user_id;
     $model->content = $reply_content;
     $model->create_time = time();
     if ($model->save()) {
         $this->output(array('success' => 1, 'successText' => '回复成功'));
     } else {
         $this->errorOutput(array('errorCode' => 4, 'errorText' => '回复失败'));
     }
 }
开发者ID:elite-lcf,项目名称:mictfood,代码行数:26,代码来源:SiteController.php

示例5: post_replyticket

 public function post_replyticket()
 {
     $postStr = Input::get('data');
     parse_str($postStr, $post);
     $validator = Validator::make(array('Reply' => $post['inputReplyTicket'], 'tid' => $post['tid']), array('Reply' => 'required', 'tid' => 'required|integer'), array('Reply.required' => 'Please enter a reply.', 'tid.required' => 'The system cannot find a ticket to reply to.', 'tid.integer' => 'The system has been sent an invalid ticket id to reply to.'));
     //Verify some smart ass didn't try to change the hidden input field (tid) or reply to a closed ticket.
     $count = Ticket::where('id', '=', $post['tid'])->where('vid', '=', Auth::user()->get()->cid)->where('status', '=', '1')->count();
     if ($count == 0) {
         //Damn them.
         echo '<div class="alert alert-error"><li>Seriously? Nice try.</li></div>';
     }
     if ($validator->fails()) {
         $messages = $validator->messages();
         $errorStr = '';
         foreach ($messages->all('<li>:message</li>') as $message) {
             $errorStr .= '<div class="alert alert-error">' . $message . '</div>';
         }
         echo $errorStr;
     } else {
         $reply = new Reply();
         $reply->tid = $post['tid'];
         $reply->author = Auth::user()->get()->cid;
         $reply->content = $post['inputReplyTicket'];
         //Save our ticket update
         $reply->save();
         //Find or reply id
         $reply = Reply::orderBy('updated_at', 'DESC')->first();
         //Finally we need to update the updated_at field of our master ticket table
         $ticket = Ticket::find($post['tid']);
         $ticket->updated_at = $reply->updated_at;
         //Save our ticket update
         $ticket->save();
         //Check to see if there is an assigned auditor. If so send them an email notification
         if (!empty($ticket->assigned)) {
             $data = array();
             $auditor = ConsoleUser::find($ticket->assigned);
             if (!empty($auditor)) {
                 $data['auditor'] = $auditor;
                 $data['subject'] = "VATSIM VA New Ticket Update";
                 if (!empty($auditor->email)) {
                     $body = "Hello " . ConsoleUser::getName($ticket->assigned) . ",<br /><br />There has been an update to your assigned ticket " . $ticket->subject . " by VA Administrator " . User::getFullName($ticket->vid) . ". <br /><br />" . $reply->content . "<br /><br /><br /> <strong>Do not reply to this email. If you wish to reply to this ticket, please do so through the auditor console.</strong>";
                     Mail::send('email.default', array("content" => $body), function ($message) use($data) {
                         $message->to($data['auditor']->email, $data['auditor']->name)->subject($data['subject']);
                     });
                 }
             }
         }
         //Return 1 to inform the client this was successful.
         echo '1';
     }
 }
开发者ID:A-Lawrence,项目名称:VASOPS,代码行数:51,代码来源:AjaxController.php

示例6: reply

 /**
  * Send a reply
  *
  * @param int 	$id
  * @return Response
  */
 public function reply($id)
 {
     $chat = Chat::findOrfail($id);
     $chat->last_reply = date("Y-m-d H:i:s");
     $chat->save();
     $reply = new Reply();
     $reply->text = Input::get('text');
     $reply->chat_id = $chat->id;
     $reply->user_id = Auth::user()->id;
     $reply->save();
     //Set up notifications for this chat
     foreach ($chat->user()->get() as $user) {
         $reply->notification()->save($user);
     }
     $notification = Notification::where('user_id', '=', Auth::user()->id)->where('reply_id', '=', $reply->id)->firstOrFail();
     $notification->has_read = 1;
     $notification->save();
     return Redirect::to('/community/chats/' . $id)->with('flash_chat', 'Your chat has been sent!')->with('alert_class', 'alert-success');
 }
开发者ID:alisha,项目名称:seed,代码行数:25,代码来源:ChatController.php

示例7: actionReplyMessage

 public function actionReplyMessage()
 {
     $message_id = Yii::app()->request->getParam('reply_id');
     $reply_content = Yii::app()->request->getParam('reply_content');
     $user_id = $this->module->user['id'];
     if (!$message_id) {
         Error::output(Error::ERR_NO_MSGID);
     }
     if (!$reply_content) {
         Error::output(Error::ERR_NO_REPLY_CONTENT);
     }
     $model = new Reply();
     $model->message_id = $message_id;
     $model->user_id = $user_id;
     $model->content = $reply_content;
     $model->create_time = time();
     if ($model->save()) {
         Out::jsonOutput(array('return' => 1));
         //留言成功
     } else {
         Error::output(Error::ERR_SAVE_FAIL);
     }
 }
开发者ID:RoyZeng,项目名称:dinner,代码行数:23,代码来源:CenterController.php


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