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


PHP Msg::getTo方法代码示例

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


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

示例1: sendMsg

 public static function sendMsg(Msg $msg, $Methods = array())
 {
     #-------------------------------------------------------------------------------
     $Executor = Comp_Load('www/Administrator/API/ProfileCompile', array('ProfileID' => 100));
     #-------------------------------------------------------------------------------
     switch (ValueOf($Executor)) {
         case 'error':
             return ERROR | @Trigger_Error(500);
         case 'exception':
             # No more...
             break;
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('Executor', $Executor['Attribs']);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $User = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'IsNotifies', 'Params'), array('UNIQ', 'ID' => $msg->getTo()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($User)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать получателя');
         case 'exception':
             return new gException('EMAIL_RECIPIENT_NOT_FOUND', 'Получатель письма не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $TypeID = $msg->getTemplate();
             #-------------------------------------------------------------------------------
             Debug(SPrintF('[system/classes/NotificationManager]: TypeID = %s', $TypeID));
             #-------------------------------------------------------------------------------
             if ($TypeID != 'UserPasswordRestore') {
                 if (!$User['IsNotifies']) {
                     return new gException('NOTIFIES_RECIPIENT_DISABLED', 'Уведомления для получателя отключены');
                 }
             }
             #-------------------------------------------------------------------------------
             $msg->setParam('User', $User);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $From = DB_Select('Users', array('ID', 'Name', 'Sign', 'Email', 'UniqID', 'Params'), array('UNIQ', 'ID' => $msg->getFrom()));
     #-------------------------------------------------------------------------------
     switch (ValueOf($From)) {
         case 'error':
             return ERROR | @Trigger_Error('[Email_Send]: не удалось выбрать отправителя');
         case 'exception':
             return new gException('EMAIL_SENDER_NOT_FOUND', 'Отправитель не найден');
         case 'array':
             #-------------------------------------------------------------------------------
             $msg->setParam('From', $From);
             #-------------------------------------------------------------------------------
             break;
             #-------------------------------------------------------------------------------
         #-------------------------------------------------------------------------------
         default:
             return ERROR | @Trigger_Error(101);
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $Config = Config();
     #-------------------------------------------------------------------------------
     $Notifies = $Config['Notifies'];
     #-------------------------------------------------------------------------------
     # вариант когда методы не заданы - значит все доступные
     if (SizeOf($Methods) == 0) {
         #-------------------------------------------------------------------------------
         $Array = array();
         #-------------------------------------------------------------------------------
         foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
             $Array[] = $MethodID;
         }
         #-------------------------------------------------------------------------------
         $Methods = $Array;
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     #-------------------------------------------------------------------------------
     $sentMsgCnt = 0;
     #-------------------------------------------------------------------------------
     foreach (Array_Keys($Notifies['Methods']) as $MethodID) {
         #-------------------------------------------------------------------------------
         if (!$Notifies['Methods'][$MethodID]['IsActive'] || !In_Array($MethodID, $Methods)) {
             continue;
         }
         #-------------------------------------------------------------------------------
         # проверяем контакт, если не мыло - должен быть подтверждён
         if ($MethodID != 'Email') {
             if (!$User['Params']['NotificationMethods'][$MethodID]['Confirmed']) {
//.........这里部分代码省略.........
开发者ID:carriercomm,项目名称:jbs,代码行数:101,代码来源:NotificationManager.class.php


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