當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。