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


PHP Messages::save方法代码示例

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


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

示例1: actionSavemessage

 public function actionSavemessage()
 {
     $subject = Yii::app()->Ini->v('subject');
     $message = Yii::app()->Ini->v('message');
     $to_usertype = Yii::app()->Ini->v('to_usertype');
     $from_id = Yii::app()->user->getId();
     $from_user_type = Yii::app()->user->role;
     $to_id = Yii::app()->Ini->v('receiver_id');
     $sent_date = date("Y-m-d H:i:s");
     $messages = new Messages();
     $messages->subject = $subject;
     $messages->message = $message;
     $messages->from_id = $from_id;
     $messages->to_id = $to_id;
     $messages->to_user_type = 'to_usertype';
     $messages->from_user_type = $from_user_type;
     $messages->date_sent = $sent_date;
     $this->sendEmailNotification($subject, $message, $to_id, Yii::app()->name);
     if ($messages->save()) {
         $status = array('success' => true);
     } else {
         $status = array('success' => false, 'error_message' => print_r($messages->getErrors()));
     }
     $this->renderJSON($status);
 }
开发者ID:seph-krueger,项目名称:handyman,代码行数:25,代码来源:HomeownerController.php

示例2: action_delete

 public function action_delete()
 {
     $id = $this->request->param('id');
     DB::delete('address')->where('id', '=', $id)->execute();
     Messages::save('Address was successfully deleted!', 'info');
     $this->redirect('/address');
 }
开发者ID:Alex-AG,项目名称:exeltek-po,代码行数:7,代码来源:Address.php

示例3: actionCreate

 /** Receives the form submission from the new action and creates the new object. */
 public function actionCreate()
 {
     // create a new message
     $messages = new Messages();
     $name = $messages->generateNewName($this->request->getPost());
     if (empty($name)) {
         $this->flashFail = 'The message cannot be blank';
         $this->redirectTo('topics/new');
     }
     $stamp = date("Y-m-d H:i:s", mktime());
     $save['name'] = $this->userRow['name'];
     // create new topic
     $save['name'] = $this->request->getPost('name');
     $save['created_at'] = $save['updated_at'] = $stamp;
     $save['created_by'] = $this->userRow['name'];
     $save['is_archived'] = 0;
     $topicId = $this->topics->save($save);
     // create new message... read by us
     $newId = $messages->save(array('topics_id' => $topicId, 'created_at' => $stamp, 'name' => $name, 'user' => $this->userRow['name'], 'read_by' => "!{$this->userRow['id']}!"));
     // create new mailer
     //$mailer = new Mailer();
     // save the text
     $nodes = new Nodes();
     $nodes->saveMessage(0, $this->request->getPost(0), $topicId, $newId, $this->userRow['name'], $mailer);
     // send email to all recipients
     //$users = new Users();
     //foreach ($users->select('email')->findAll() as $user) $recipients[] = $user['email'];
     //$mailer->sendMessage($recipients, $newId, $topicId, $this->topics);
     // redirect to the new message
     $this->redirectTo("messages/show/{$topicId}/{$newId}");
 }
开发者ID:radekstepan,项目名称:Fireside,代码行数:32,代码来源:TopicsPresenter.php

示例4: action_index

 public function action_index()
 {
     if (!Group::current('allow_assign')) {
         throw new HTTP_Exception_403('Forbidden');
     }
     $ids = array_keys(Arr::get($_POST, 'job', array()));
     if (!$ids) {
         Messages::save('Please, select at least one job!');
     } else {
         $jobs = Database_Mongo::collection('jobs');
         $result = $jobs->find(array('_id' => array('$in' => $ids)));
         $count = 0;
         foreach ($result as $job) {
             if (Arr::get($job, 'status') == Enums::STATUS_ARCHIVE || Arr::get($job, 'status') == Enums::STATUS_COMPLETE || Arr::get($job, 'status') == Enums::STATUS_PENDING) {
                 if ($job['status'] == Enums::STATUS_PENDING) {
                     $submissions = Database_Mongo::collection('submissions')->find(array('job_key' => $job['_id'], 'active' => 1))->count();
                     if ($submissions) {
                         continue;
                     }
                 }
                 $update = array('$set' => array('last_update' => time()));
                 if (Arr::get($job, 'assigned')) {
                     $update['$set']['status'] = Enums::STATUS_ALLOC;
                 } else {
                     $update['$unset']['status'] = 1;
                 }
                 $jobs->update(array('_id' => $job['_id']), $update);
                 $count++;
             }
         }
         Messages::save($count . ' jobs were succesfully reset to initial state', 'success');
     }
     $this->redirect('/search');
 }
开发者ID:nikulinsanya,项目名称:exeltek,代码行数:34,代码来源:Reset.php

示例5: action_index

 public function action_index()
 {
     if (!Group::current('allow_assign')) {
         throw new HTTP_Exception_403('Forbidden');
     }
     $ids = array_keys(Arr::get($_POST, 'job', array()));
     if (!$ids) {
         Messages::save('Please, select at least one job!');
     } else {
         $jobs = Database_Mongo::collection('jobs');
         $submissions = Database_Mongo::collection('submissions')->distinct('job_key', array('job_key' => array('$in' => $ids), 'active' => 1));
         $ids = array_values(array_diff($ids, $submissions));
         $result = Database_Mongo::collection('jobs')->find(array('_id' => array('$in' => $ids)));
         print_r($result->explain());
         $count = 0;
         foreach ($result as $job) {
             if (!in_array(Arr::get($job, 'status'), array(Enums::STATUS_ARCHIVE, Enums::STATUS_COMPLETE))) {
                 $jobs->update(array('_id' => $job['_id']), array('$set' => array('last_update' => time(), 'status' => Enums::STATUS_COMPLETE)));
                 $count++;
             }
         }
         Messages::save($count . ' jobs were succesfully completed', 'success');
     }
     $this->redirect('/search');
 }
开发者ID:nikulinsanya,项目名称:exeltek,代码行数:25,代码来源:Complete.php

示例6: createMessage

 public static function createMessage($fromUserId, $toUserId, $data)
 {
     $messages = new Messages();
     $messages->from_user_id = $fromUserId;
     $messages->to_user_id = $toUserId;
     $messages->attributes = $data;
     return $messages->save();
 }
开发者ID:romeo14,项目名称:pow,代码行数:8,代码来源:MessagesApi.php

示例7: action_delete

 public function action_delete()
 {
     $id = $this->request->param('id');
     if (!Group::get(User::get($id, 'group_id'), 'is_admin')) {
         DB::delete('users')->where('id', '=', $id)->execute();
         Messages::save('User successfully deleted!', 'info');
     }
     $this->redirect('/security/users');
 }
开发者ID:nikulinsanya,项目名称:exeltek,代码行数:9,代码来源:Users.php

示例8: save

 public function save()
 {
     $message = new Messages();
     $message->sender_id = Yii::app()->user->id;
     $message->receiver_id = $this->receiver_id;
     $message->text = $this->text;
     $message->is_new = TRUE;
     $message->save();
 }
开发者ID:andrelinoge,项目名称:rezydent,代码行数:9,代码来源:MessageForm.php

示例9: action_delete

 public function action_delete()
 {
     if (!User::current('is_admin') && !Group::current('item_remove')) {
         throw new HTTP_Exception_403('Forbidden');
     }
     $id = $this->request->param('id');
     DB::delete('items')->where('id', '=', $id)->execute();
     Messages::save('Item was successfully deleted!', 'info');
     $this->redirect('/items');
 }
开发者ID:Alex-AG,项目名称:exeltek-po,代码行数:10,代码来源:Items.php

示例10: action_delete

 public function action_delete()
 {
     $id = $this->request->param('id');
     $users = DB::select('id')->from('users')->where('company_id', '=', $id)->limit(1)->execute()->get('id');
     if (!$users) {
         DB::delete('companies')->where('id', '=', $id)->execute();
         Messages::save('Company successfully deleted!', 'info');
     }
     $this->redirect('/security/companies');
 }
开发者ID:nikulinsanya,项目名称:exeltek,代码行数:10,代码来源:Companies.php

示例11: render

 function render()
 {
     $message = new Messages($this->db);
     $message->key = 'Second message';
     $message->message = 'This is the second message inserted from code';
     $message->save();
     $messages = new Messages($this->db);
     $msg = $messages->all()[0];
     $this->f3->set('msg', $msg);
     $template = new Template();
     echo $template->render('template.htm');
 }
开发者ID:bandjam,项目名称:site-base,代码行数:12,代码来源:MainController.php

示例12: action_index

 public function action_index()
 {
     $id = strval(Arr::get($_GET, 'id'));
     $job = Database_Mongo::collection('jobs')->findOne(array('_id' => $id), array('data' => 1));
     if (!$job) {
         throw new HTTP_Exception_404('Not found');
     }
     $point = strval(Arr::get($_GET, 'point'));
     $archive = Database_Mongo::collection('archive')->findOne(array('_id' => new MongoId($point)), array('update_time' => 1));
     if (!$archive) {
         throw new HTTP_Exception_404('Not found');
     }
     $result = Database_Mongo::collection('archive')->find(array('job_key' => $id, 'update_time' => array('$gt' => $archive['update_time'])))->sort(array('update_time' => -1));
     $ids = array();
     $values = array();
     foreach ($result as $item) {
         $ids[] = $item['_id'];
         foreach (Arr::get($item, 'data', array()) as $key => $data) {
             $job['data'][$key] = $values[$key] = $data['old_value'];
         }
     }
     foreach ($values as $key => $value) {
         if ($value) {
             $new['$set']['data.' . $key] = $value;
         } else {
             $new['$unset']['data.' . $key] = 1;
         }
     }
     if ($new) {
         $new['$set']['last_update'] = $archive['update_time'];
     }
     $submissions = array();
     $result = Database_Mongo::collection('submissions')->find(array('job_key' => $id, 'process_time' => array('$gt' => $archive['update_time'])));
     foreach ($result as $item) {
         if (Arr::path($job, $item['key'], '') != $item['value']) {
             $submissions[] = $item['_id'];
         }
     }
     if ($new) {
         Database_Mongo::collection('submissions')->update(array('_id' => array('$in' => $submissions)), array('$unset' => array('process_time' => 1), '$set' => array('active' => 1)));
         Database_Mongo::collection('jobs')->update(array('_id' => $id), $new);
         Database_Mongo::collection('archive')->remove(array('_id' => array('$in' => $ids)));
     }
     $message = '';
     if (count($ids)) {
         $message .= count($ids) . ' changes were removed. ';
     }
     if (count($submissions)) {
         $message .= count($submissions) . ' submissions were unapproved. ';
     }
     Messages::save('Ticket ' . $id . ' successfully rolled back to ' . date('d-m-Y H:i', $archive['update_time']) . '. ' . $message);
     die(json_encode(array('success' => true)));
 }
开发者ID:nikulinsanya,项目名称:exeltek,代码行数:53,代码来源:Timemachine.php

示例13: action_delete

 public function action_delete()
 {
     $id = $this->request->param('id');
     if (!User::get($id, 'is_admin')) {
         Database::instance()->begin();
         DB::delete('company_notifications')->where('user_id', '=', $id)->execute();
         DB::delete('users')->where('id', '=', $id)->execute();
         Database::instance()->commit();
         Messages::save('User successfully deleted!', 'info');
     }
     $this->redirect('/users');
 }
开发者ID:Alex-AG,项目名称:exeltek-mima,代码行数:12,代码来源:Users.php

示例14: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Messages();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Messages'])) {
         $model->attributes = $_POST['Messages'];
         if ($model->save()) {
             $this->redirect(array('index'));
         }
     }
     $this->renderPartial('create', array('model' => $model));
 }
开发者ID:holyshved,项目名称:guestbook,代码行数:17,代码来源:MessagesController.php

示例15: action_delete

 public function action_delete()
 {
     $id = $this->request->param('id');
     $users = DB::select('id')->from('users')->where('company_id', '=', $id)->limit(1)->execute()->get('id');
     if (!$users) {
         Database::instance()->begin();
         DB::delete('company_notifications')->where('company_id', '=', $id)->execute();
         DB::delete('companies')->where('id', '=', $id)->execute();
         Database::instance()->commit();
         Messages::save('Company successfully deleted!', 'info');
     }
     $this->redirect('/companies');
 }
开发者ID:Alex-AG,项目名称:exeltek-mima,代码行数:13,代码来源:Companies.php


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