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


PHP UserConfig::model方法代码示例

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


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

示例1: saveEmailAlerts

 /**
  * @param User $model
  * Add new email alerts and delete older
  */
 private function saveEmailAlerts(User $model)
 {
     if (isset($_POST['User'])) {
         UserConfig::model()->deleteAll("userId=" . $model->use_id . " AND configType ='" . UserConfig::TYPE_EMAIL_ALERT . "' AND configKey='" . UserConfig::KEY_EMAIL_ALERT_DEAL_STATUS . "'");
         if (isset($_POST['User']['emailAlertForDealStatus'])) {
             $emailAlerts = $_POST['User']['emailAlertForDealStatus'];
             foreach ($emailAlerts as $k => $v) {
                 if ($v == 1) {
                     $userConfig = new UserConfig();
                     $userConfig->unsetAttributes();
                     $userConfig->userId = $model->use_id;
                     $userConfig->configType = UserConfig::TYPE_EMAIL_ALERT;
                     $userConfig->configKey = UserConfig::KEY_EMAIL_ALERT_DEAL_STATUS;
                     $userConfig->configValue = $k;
                     $userConfig->save();
                 }
             }
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:24,代码来源:UserController.php

示例2: sendEmailOnStatusChange

 /**
  * @param $instruction
  */
 private function sendEmailOnStatusChange(Deal $instruction)
 {
     if ($instruction) {
         /** @var  $instruction Deal [ ] */
         $status = $instruction->dea_status;
         $address = $instruction->property->address->getFullAddressString(', ');
         $userConfigs = UserConfig::model()->findAll("configType =:configType AND configKey=:configKey AND configValue = :configValue", array('configType' => UserConfig::TYPE_EMAIL_ALERT, 'configKey' => UserConfig::KEY_EMAIL_ALERT_DEAL_STATUS, 'configValue' => $status));
         $userIds = [];
         foreach ($userConfigs as $userConfig) {
             $userIds[] = $userConfig->userId;
         }
         $criteria = new CDbCriteria();
         $criteria->scopes = ["emailAlertsForDealStatus"];
         $criteria->addInCondition('use_id', $userIds);
         $users = User::model()->findAll($criteria);
         foreach ($users as $user) {
             /** @var $user User[ ] */
             if ($user->use_email) {
                 $fromEmail = "admin@woosterstock.co.uk";
                 $recipient = $user->use_email;
                 $emailMessage = "From:\t" . $fromEmail . "\n\n";
                 $emailMessage .= "Dear " . ($user->fullName ? $user->fullName : $user->use_fname) . ",\n\n";
                 $emailMessage .= "Following property status has changed to " . $status . " \n\n";
                 $emailMessage .= $address;
                 $emailMessage .= "\n\nSent:\t" . date("d/m/Y H:i");
                 try {
                     include_once "Zend/Mail.php";
                     $mailToUser = new Zend_Mail("UTF-8");
                     $mailToUser->addTo($recipient);
                     $mailToUser->setFrom($fromEmail);
                     $mailToUser->setSubject("Property status changed");
                     $mailToUser->setBodyText($emailMessage);
                     $mailToUser->send();
                 } catch (Exception $e) {
                 }
             }
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:42,代码来源:InstructionController.php


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