本文整理汇总了PHP中EmailUI::getLastRobin方法的典型用法代码示例。如果您正苦于以下问题:PHP EmailUI::getLastRobin方法的具体用法?PHP EmailUI::getLastRobin怎么用?PHP EmailUI::getLastRobin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类EmailUI
的用法示例。
在下文中一共展示了EmailUI::getLastRobin方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pollMonitoredInboxes
/**
* Job 1
*/
function pollMonitoredInboxes()
{
$_bck_up = array('team_id' => $GLOBALS['current_user']->team_id, 'team_set_id' => $GLOBALS['current_user']->team_set_id);
Log::info('----->Scheduler fired job of type pollMonitoredInboxes()');
global $dictionary;
global $app_strings;
require_once 'modules/Emails/EmailUI.php';
$ie = new InboundEmail();
$emailUI = new EmailUI();
$r = $ie->db->query('SELECT id, name FROM inbound_email WHERE is_personal = 0 AND deleted=0 AND status=\'Active\' AND mailbox_type != \'bounce\'');
Log::debug('Just got Result from get all Inbounds of Inbound Emails');
while ($a = $ie->db->fetchByAssoc($r)) {
Log::debug('In while loop of Inbound Emails');
$ieX = new InboundEmail();
$ieX->retrieve($a['id']);
$GLOBALS['current_user']->team_id = $ieX->team_id;
$GLOBALS['current_user']->team_set_id = $ieX->team_set_id;
$mailboxes = $ieX->mailboxarray;
foreach ($mailboxes as $mbox) {
$ieX->mailbox = $mbox;
$newMsgs = array();
$msgNoToUIDL = array();
$connectToMailServer = false;
if ($ieX->isPop3Protocol()) {
$msgNoToUIDL = $ieX->getPop3NewMessagesToDownloadForCron();
// get all the keys which are msgnos;
$newMsgs = array_keys($msgNoToUIDL);
}
if ($ieX->connectMailserver() == 'true') {
$connectToMailServer = true;
}
// if
Log::debug('Trying to connect to mailserver for [ ' . $a['name'] . ' ]');
if ($connectToMailServer) {
Log::debug('Connected to mailserver');
if (!$ieX->isPop3Protocol()) {
$newMsgs = $ieX->getNewMessageIds();
}
if (is_array($newMsgs)) {
$current = 1;
$total = count($newMsgs);
require_once "include/SugarFolders/SugarFolders.php";
$sugarFolder = new SugarFolder();
$groupFolderId = $ieX->groupfolder_id;
$isGroupFolderExists = false;
$users = array();
if ($groupFolderId != null && $groupFolderId != "") {
$sugarFolder->retrieve($groupFolderId);
$isGroupFolderExists = true;
}
// if
$messagesToDelete = array();
if ($ieX->isMailBoxTypeCreateCase()) {
$users[] = $sugarFolder->assign_to_id;
$distributionMethod = $ieX->get_stored_options("distrib_method", "");
if ($distributionMethod != 'roundRobin') {
$counts = $emailUI->getAssignedEmailsCountForUsers($users);
} else {
$lastRobin = $emailUI->getLastRobin($ieX);
}
Log::debug('distribution method id [ ' . $distributionMethod . ' ]');
}
foreach ($newMsgs as $k => $msgNo) {
$uid = $msgNo;
if ($ieX->isPop3Protocol()) {
$uid = $msgNoToUIDL[$msgNo];
} else {
$uid = imap_uid($ieX->conn, $msgNo);
}
// else
if ($isGroupFolderExists) {
if ($ieX->importOneEmail($msgNo, $uid)) {
// add to folder
$sugarFolder->addBean($ieX->email);
if ($ieX->isPop3Protocol()) {
$messagesToDelete[] = $msgNo;
} else {
$messagesToDelete[] = $uid;
}
if ($ieX->isMailBoxTypeCreateCase()) {
$userId = "";
if ($distributionMethod == 'roundRobin') {
if (sizeof($users) == 1) {
$userId = $users[0];
$lastRobin = $users[0];
} else {
$userIdsKeys = array_flip($users);
// now keys are values
$thisRobinKey = $userIdsKeys[$lastRobin] + 1;
if (!empty($users[$thisRobinKey])) {
$userId = $users[$thisRobinKey];
$lastRobin = $users[$thisRobinKey];
} else {
$userId = $users[0];
$lastRobin = $users[0];
}
}
//.........这里部分代码省略.........