本文整理匯總了PHP中InboundEmail::retrieveAllByGroupId方法的典型用法代碼示例。如果您正苦於以下問題:PHP InboundEmail::retrieveAllByGroupId方法的具體用法?PHP InboundEmail::retrieveAllByGroupId怎麽用?PHP InboundEmail::retrieveAllByGroupId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類InboundEmail
的用法示例。
在下文中一共展示了InboundEmail::retrieveAllByGroupId方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getMailboxNodes
/**
* returns an array of nodes that correspond to IMAP mailboxes.
* @param bool $forceRefresh
* @return object TreeView object
*/
function getMailboxNodes()
{
global $sugar_config;
global $current_user;
global $app_strings;
$tree = new Tree("frameFolders");
$tree->tree_style = 'include/ytree/TreeView/css/check/tree.css';
$nodes = array();
$ie = new InboundEmail();
$refreshOffset = $this->cacheTimeouts['folders'];
// 5 mins. this will be set via user prefs
$rootNode = new ExtNode($app_strings['LBL_EMAIL_HOME_FOLDER'], $app_strings['LBL_EMAIL_HOME_FOLDER']);
$rootNode->dynamicloadfunction = '';
$rootNode->expanded = true;
$rootNode->dynamic_load = true;
$showFolders = unserialize(base64_decode($current_user->getPreference('showFolders', 'Emails')));
if (empty($showFolders)) {
$showFolders = array();
}
// INBOX NODES
if ($current_user->hasPersonalEmail()) {
$personals = $ie->retrieveByGroupId($current_user->id);
foreach ($personals as $k => $personalAccount) {
if (in_array($personalAccount->id, $showFolders)) {
// check for cache value
$cacheRoot = sugar_cached("modules/Emails/{$personalAccount->id}");
$this->preflightEmailCache($cacheRoot);
if ($this->validCacheFileExists($personalAccount->id, 'folders', "folders.php")) {
$mailboxes = $this->getMailBoxesFromCacheValue($personalAccount);
} else {
$mailboxes = $personalAccount->getMailboxes();
}
$acctNode = new ExtNode('Home::' . $personalAccount->name, $personalAccount->name);
$acctNode->dynamicloadfunction = '';
$acctNode->expanded = false;
$acctNode->set_property('cls', 'ieFolder');
$acctNode->set_property('ieId', $personalAccount->id);
$acctNode->set_property('protocol', $personalAccount->protocol);
if (array_key_exists('Home::' . $personalAccount->name, $this->folderStates)) {
if ($this->folderStates['Home::' . $personalAccount->name] == 'open') {
$acctNode->expanded = true;
}
}
$acctNode->dynamic_load = true;
$nodePath = $acctNode->_properties['id'];
foreach ($mailboxes as $k => $mbox) {
$acctNode->add_node($this->buildTreeNode($k, $k, $mbox, $personalAccount->id, $nodePath, false, $personalAccount));
}
$rootNode->add_node($acctNode);
}
}
}
// GROUP INBOX NODES
$beans = $ie->retrieveAllByGroupId($current_user->id, false);
foreach ($beans as $k => $groupAccount) {
if (in_array($groupAccount->id, $showFolders)) {
// check for cache value
$cacheRoot = sugar_cached("modules/Emails/{$groupAccount->id}");
$this->preflightEmailCache($cacheRoot);
//$groupAccount->connectMailserver();
if ($this->validCacheFileExists($groupAccount->id, 'folders', "folders.php")) {
$mailboxes = $this->getMailBoxesFromCacheValue($groupAccount);
} else {
$mailboxes = $groupAccount->getMailBoxesForGroupAccount();
}
$acctNode = new ExtNode($groupAccount->name, "group.{$groupAccount->name}");
$acctNode->dynamicloadfunction = '';
$acctNode->expanded = false;
$acctNode->set_property('isGroup', 'true');
$acctNode->set_property('ieId', $groupAccount->id);
$acctNode->set_property('protocol', $groupAccount->protocol);
if (array_key_exists('Home::' . $groupAccount->name, $this->folderStates)) {
if ($this->folderStates['Home::' . $groupAccount->name] == 'open') {
$acctNode->expanded = true;
}
}
$acctNode->dynamic_load = true;
$nodePath = $rootNode->_properties['id'] . "::" . $acctNode->_properties['id'];
foreach ($mailboxes as $k => $mbox) {
$acctNode->add_node($this->buildTreeNode($k, $k, $mbox, $groupAccount->id, $nodePath, true, $groupAccount));
}
$rootNode->add_node($acctNode);
}
}
// SugarFolder nodes
/* SugarFolders are built at onload when the UI renders */
$tree->add_node($rootNode);
return $tree;
}
示例2: retrieveAllByGroupId
public function retrieveAllByGroupId($group_id)
{
$inboundEmail = new InboundEmail();
$result = $inboundEmail->retrieveAllByGroupId($group_id);
$this->assertTrue(is_array($result));
foreach ($result as $ie) {
$this->assertInstanceOf('InboundEmail', $ie);
}
}