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


PHP Draft::addEmailRecipient方法代码示例

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


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

示例1: saveEmail

 /**
  * Method used to save the draft response in the database for
  * further use.
  *
  * @access  public
  * @param   integer $issue_id The issue ID
  * @param   string $to The primary recipient of the draft
  * @param   string $cc The secondary recipients of the draft
  * @param   string $subject The subject of the draft
  * @param   string $message The draft body
  * @param   integer $parent_id The ID of the email that this draft is replying to, if any
  * @param   string $unknown_user The sender of the draft, if not a real user
  * @param   boolean $add_history_entry Whether to add a history entry automatically or not
  * @return  integer 1 if the update worked, -1 otherwise
  */
 function saveEmail($issue_id, $to, $cc, $subject, $message, $parent_id = FALSE, $unknown_user = FALSE, $add_history_entry = TRUE)
 {
     $issue_id = Misc::escapeInteger($issue_id);
     $parent_id = Misc::escapeInteger($parent_id);
     if (empty($parent_id)) {
         $parent_id = 'NULL';
     }
     // if unknown_user is not empty, set the usr_id to be the system user.
     if (!empty($unknown_user)) {
         $usr_id = APP_SYSTEM_USER_ID;
     } else {
         $usr_id = Auth::getUserID();
     }
     $stmt = "INSERT INTO\n                    " . APP_DEFAULT_DB . "." . APP_TABLE_PREFIX . "email_draft\n                 (\n                    emd_updated_date,\n                    emd_usr_id,\n                    emd_iss_id,\n                    emd_sup_id,\n                    emd_subject,\n                    emd_body";
     if (!empty($unknown_user)) {
         $stmt .= ", emd_unknown_user";
     }
     $stmt .= ") VALUES (\n                    '" . Date_API::getCurrentDateGMT() . "',\n                    {$usr_id},\n                    {$issue_id},\n                    {$parent_id},\n                    '" . Misc::escapeString($subject) . "',\n                    '" . Misc::escapeString($message) . "'";
     if (!empty($unknown_user)) {
         $stmt .= ", '" . Misc::escapeString($unknown_user) . "'";
     }
     $stmt .= ")";
     $res = $GLOBALS["db_api"]->dbh->query($stmt);
     if (PEAR::isError($res)) {
         Error_Handler::logError(array($res->getMessage(), $res->getDebugInfo()), __FILE__, __LINE__);
         return -1;
     } else {
         $new_emd_id = $GLOBALS['db_api']->get_last_insert_id();
         Draft::addEmailRecipient($new_emd_id, $to, false);
         $cc = str_replace(',', ';', $cc);
         $ccs = explode(';', $cc);
         foreach ($ccs as $cc) {
             Draft::addEmailRecipient($new_emd_id, $cc, true);
         }
         Issue::markAsUpdated($issue_id, "draft saved");
         if ($add_history_entry) {
             History::add($issue_id, $usr_id, History::getTypeID('draft_added'), 'Email message saved as a draft by ' . User::getFullName($usr_id));
         }
         return 1;
     }
 }
开发者ID:juliogallardo1326,项目名称:proc,代码行数:56,代码来源:class.draft.php


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