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


PHP Msg::getParams方法代码示例

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


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

示例1: send

 public function send(Msg $msg)
 {
     // Get template file path.
     $templatePath = SPrintF('Notifies/SMS/%s.tpl', $msg->getTemplate());
     $smarty = JSmarty::get();
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     $smarty->assign('Config', Config());
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     try {
         $message = $smarty->fetch($templatePath);
     } catch (Exception $e) {
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
     }
     $recipient = $msg->getParam('User');
     if (!$recipient['Params']['NotificationMethods']['SMS']['Address']) {
         throw new jException('Mobile phone number not found for user: ' . $recipient['ID']);
     }
     $taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'SMS', 'Params' => array($recipient['Params']['NotificationMethods']['SMS']['Address'], $message, $recipient['ID'], $msg->getParam('ChargeFree') ? TRUE : FALSE));
     #Debug(SPrintF('[system/classes/SMS.class.php]: msg = %s,',print_r($msg,true)));
     $result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
     switch (ValueOf($result)) {
         case 'error':
             throw new jException("Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
 }
开发者ID:carriercomm,项目名称:jbs,代码行数:35,代码来源:SMS.class.php

示例2: send

 public function send(Msg $msg)
 {
     #-------------------------------------------------------------------------------
     // Get template file path.
     $templatePath = SPrintF('Notifies/ICQ/%s.tpl', $msg->getTemplate());
     #-------------------------------------------------------------------------------
     $smarty = JSmarty::get();
     #-------------------------------------------------------------------------------
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     #-------------------------------------------------------------------------------
     $smarty->assign('Config', Config());
     #-------------------------------------------------------------------------------
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     #-------------------------------------------------------------------------------
     try {
         #-------------------------------------------------------------------------------
         $message = $smarty->fetch($templatePath);
         #-------------------------------------------------------------------------------
     } catch (Exception $e) {
         #-------------------------------------------------------------------------------
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
         #-------------------------------------------------------------------------------
     }
     #-------------------------------------------------------------------------------
     $recipient = $msg->getParam('User');
     #-------------------------------------------------------------------------------
     if (!$recipient['Params']['NotificationMethods']['ICQ']['Address']) {
         throw new jException("ICQ UIN not found for user: " . $recipient['ID']);
     }
     #-------------------------------------------------------------------------------
     $taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'ICQ', 'Params' => array($recipient['Params']['NotificationMethods']['ICQ']['Address'], $message, $recipient['ID']));
     #-------------------------------------------------------------------------------
     $result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
     switch (ValueOf($result)) {
         case 'error':
             throw new jException("Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
     #-------------------------------------------------------------------------------
 }
开发者ID:carriercomm,项目名称:jbs,代码行数:49,代码来源:ICQ.class.php

示例3: send

 public function send(Msg $msg)
 {
     // Get template file path.
     $templatePath = SPrintF('Notifies/Email/%s.tpl', $msg->getTemplate());
     $smarty = JSmarty::get();
     $smarty->clearAllAssign();
     if (!$smarty->templateExists($templatePath)) {
         throw new jException('Template file not found: ' . $templatePath);
     }
     $smarty->assign('Config', Config());
     foreach (array_keys($msg->getParams()) as $paramName) {
         $smarty->assign($paramName, $msg->getParam($paramName));
     }
     $message = $smarty->fetch($templatePath);
     try {
         // Debug("msg->getParam('Theme'): "+ $msg->getParam('Theme'));
         if ($msg->getParam('Theme')) {
             // Debug("SET THEME FROM PARAMS");
             $theme = $msg->getParam('Theme');
         } else {
             // Debug("SET THEME FROM TEMPLATE");
             $theme = $smarty->getTemplateVars('Theme');
         }
         // Debug("THEME: "+$theme);
         if (!$theme) {
             $theme = '$Theme';
         }
     } catch (Exception $e) {
         throw new jException(SPrintF("Can't fetch template: %s", $templatePath), $e->getCode(), $e);
     }
     $recipient = $msg->getParam('User');
     if (!$recipient['Email']) {
         throw new jException('E-mail address not found for user: ' . $recipient['ID']);
     }
     $sender = $msg->getParam('From');
     $emailHeads = array(SPrintF('From: %s', $sender['Email']), 'MIME-Version: 1.0', 'Content-Transfer-Encoding: 8bit', SPrintF('Content-Type: multipart/mixed; boundary="----==--%s"', HOST_ID));
     // added by lissyara 2013-02-13 in 15:45 MSK, for JBS-609
     if ($msg->getParam('Message-ID')) {
         $emailHeads[] = SPrintF('Message-ID: %s', $msg->getParam('Message-ID'));
     }
     $Params = array();
     if ($msg->getParam('Recipient')) {
         $Params[] = $msg->getParam('Recipient');
     } else {
         $Params[] = $recipient['Email'];
     }
     $Params[] = $theme;
     $Params[] = $message;
     $Params[] = Implode("\r\n", $emailHeads);
     $Params[] = $recipient['ID'];
     if ($msg->getParam('EmailAttachments')) {
         $Params[] = $msg->getParam('EmailAttachments');
     } else {
         $Params[] = 'не определено';
     }
     $taskParams = array('UserID' => $recipient['ID'], 'TypeID' => 'Email', 'Params' => $Params);
     $result = Comp_Load('www/Administrator/API/TaskEdit', $taskParams);
     switch (ValueOf($result)) {
         case 'error':
             throw new jException("Couldn't add task to queue: " . $result);
         case 'exception':
             throw new jException("Couldn't add task to queue: " . $result->String);
         case 'array':
             return TRUE;
         default:
             throw new jException("Unexpected error.");
     }
 }
开发者ID:carriercomm,项目名称:jbs,代码行数:68,代码来源:Email.class.php


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