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


PHP Notifications::generate方法代码示例

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


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

示例1: actionRetrieve

 /** 
  * Generates a new random password and creates a new Notification item
  */
 public function actionRetrieve($id, $redirect)
 {
     $model = $this->loadModel($id);
     $new_pass = Users::model()->generatePassword();
     $model->attributes = array('password' => Users::model()->hashPassword($new_pass));
     $model->save();
     //Notification
     Notifications::generate('Users', $model->username, 'users', 'retrieve', $new_pass);
     if ($redirect == 'admin') {
         Yii::app()->user->setFlash('success', Yii::t('user', 'The new password is generated and was sent to user e-mail.'));
     } else {
         Yii::app()->user->setFlash('retrieve', Yii::t('user', 'The new password is generated and was sent to your e-mail.'));
     }
     $this->redirect(array($redirect));
 }
开发者ID:Gnafu,项目名称:wiz,代码行数:18,代码来源:UsersController.php

示例2: actionRetrieve

 /** 
  * Generates a new random password and creates a new Notification item
  */
 public function actionRetrieve()
 {
     $model = new LoginForm();
     if (isset($_POST['LoginForm'])) {
         $user = Users::model()->findByPk($_POST['LoginForm']['username']);
         if ($user === null) {
             $model->addError('username', Yii::t('user', 'Username not valid'));
         } else {
             $new_pass = Users::model()->generatePassword();
             $user->attributes = array('password' => Users::model()->hashPassword($new_pass));
             $user->save();
             //Notification
             Notifications::generate('Users', $user->username, 'users', 'retrieve', $new_pass);
             // display the login form
             Yii::app()->user->setFlash('retrieve', 'The new password was sent to you via email.');
             $this->redirect(array('login'));
         }
     }
     // display the retrieve form
     $this->render('retrieve', array('model' => $model));
 }
开发者ID:Gnafu,项目名称:wiz,代码行数:24,代码来源:SiteController.php

示例3: afterSave

 /** 
  * This method is invoked after saving a record.
  * It creates a new Notification item
  */
 public function afterSave()
 {
     //perform this operation only in the first save
     if ($this->isNewRecord && $this->role->name == 'planner') {
         //Notification
         Notifications::generate('Users', $this->username, 'users', 'create');
     }
     return parent::afterSave();
 }
开发者ID:Gnafu,项目名称:wiz,代码行数:13,代码来源:Users.php


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