本文整理汇总了PHP中SugarFolder::deleteEmailFromAllFolder方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarFolder::deleteEmailFromAllFolder方法的具体用法?PHP SugarFolder::deleteEmailFromAllFolder怎么用?PHP SugarFolder::deleteEmailFromAllFolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SugarFolder
的用法示例。
在下文中一共展示了SugarFolder::deleteEmailFromAllFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: moveEmails
/**
* moves emails from folder to folder
* @param string $fromIe I-E id
* @param string $fromFolder IMAP path to folder in which the email lives
* @param string $toIe I-E id
* @param string $toFolder
* @param string $uids UIDs of emails to move, either Sugar GUIDS or IMAP
* UIDs
* @param bool $copy Default false
* @return bool True on successful execution
*/
function moveEmails($fromIe, $fromFolder, $toIe, $toFolder, $uids, $copy = false)
{
global $app_strings;
global $current_user;
// same I-E server
if ($fromIe == $toIe) {
$GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from I-E to I-E");
//$exDestFolder = explode("::", $toFolder);
//preserve $this->mailbox
if (isset($this->mailbox)) {
$oldMailbox = $this->mailbox;
}
$this->retrieve($fromIe);
$this->mailbox = $fromFolder;
$this->connectMailserver();
$exUids = explode('::;::', $uids);
$uids = implode(",", $exUids);
// imap_mail_move accepts comma-delimited lists of UIDs
if ($copy) {
if (imap_mail_copy($this->conn, $uids, $toFolder, CP_UID)) {
$this->mailbox = $toFolder;
$this->connectMailserver();
$newOverviews = imap_fetch_overview($this->conn, $uids, FT_UID);
$this->updateOverviewCacheFile($newOverviews, 'append');
if (isset($oldMailbox)) {
$this->mailbox = $oldMailbox;
}
return true;
} else {
$GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_copy() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
}
} else {
if (imap_mail_move($this->conn, $uids, $toFolder, CP_UID)) {
$GLOBALS['log']->info("INBOUNDEMAIL: imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
imap_expunge($this->conn);
// hard deletes moved messages
// update cache on fromFolder
$newOverviews = $this->getOverviewsFromCacheFile($uids, $fromFolder, true);
$this->deleteCachedMessages($uids, $fromFolder);
// update cache on toFolder
$this->checkEmailOneMailbox($toFolder, true, true);
if (isset($oldMailbox)) {
$this->mailbox = $oldMailbox;
}
return true;
} else {
$GLOBALS['log']->debug("INBOUNDEMAIL: could not imap_mail_move() [ {$uids} ] to folder [ {$toFolder} ] from folder [ {$fromFolder} ]");
}
}
} elseif ($toIe == 'folder' && $fromFolder == 'sugar::Emails') {
$GLOBALS['log']->debug("********* SUGARFOLDER - moveEmails() moving email from SugarFolder to SugarFolder");
// move from sugar folder to sugar folder
require_once "include/SugarFolders/SugarFolders.php";
$sugarFolder = new SugarFolder();
$exUids = explode($app_strings['LBL_EMAIL_DELIMITER'], $uids);
foreach ($exUids as $id) {
if ($copy) {
$sugarFolder->copyBean($fromIe, $toFolder, $id, "Emails");
} else {
$fromSugarFolder = new SugarFolder();
$fromSugarFolder->retrieve($fromIe);
$toSugarFolder = new SugarFolder();
$toSugarFolder->retrieve($toFolder);
$email = new Email();
$email->retrieve($id);
$email->status = 'unread';
// when you move from My Emails to Group Folder, Assign To field for the Email should become null
if ($fromSugarFolder->is_dynamic && $toSugarFolder->is_group) {
$email->assigned_user_id = "";
$email->save();
if (!$toSugarFolder->checkEmailExistForFolder($id)) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
$toSugarFolder->addBean($email);
}
} elseif ($fromSugarFolder->is_group && $toSugarFolder->is_dynamic) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
$email->assigned_user_id = $current_user->id;
$email->save();
} else {
// If you are moving something from personal folder then delete an entry from all folder
if (!$fromSugarFolder->is_dynamic && !$fromSugarFolder->is_group) {
$fromSugarFolder->deleteEmailFromAllFolder($id);
}
// if
if ($fromSugarFolder->is_dynamic && !$toSugarFolder->is_dynamic && !$toSugarFolder->is_group) {
$email->assigned_user_id = "";
$toSugarFolder->addBean($email);
}
// if
//.........这里部分代码省略.........