本文整理汇总了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;
}
}