modules/Emails/EmailUI.php

Show: inherited
Table of Contents

\EmailUI

Package:

Properties

Propertypublic  $addressSeparators= 'array(";", ",")'
Default valuearray(";", ",")Details
Type
n/a
Propertypublic  $cacheTimeouts= 'array( 'messages' => 86400, // 24 hours 'folders' => 300, // 5 mins 'attachments' => 86400, // 24 hours )'
Default valuearray( 'messages' => 86400, // 24 hours 'folders' => 300, // 5 mins 'attachments' => 86400, // 24 hours )Details
Type
n/a
Propertypublic  $coreDynamicFolderQuery= '"SELECT emails.id polymorphic_id, 'Emails' polymorphic_module FROM emails JOIN emails_text on emails.id = emails_text.email_id WHERE (type = '::TYPE::' OR status = '::STATUS::') AND assigned_user_id = '::USER_ID::' AND emails.deleted = '0'"'
Default value"SELECT emails.id polymorphic_id, 'Emails' polymorphic_module FROM emails JOIN emails_text on emails.id = emails_text.email_id WHERE (type = '::TYPE::' OR status = '::STATUS::') AND assigned_user_id = '::USER_ID::' AND emails.deleted = '0'"Details
Type
n/a
Propertypublic  $db= ''
Details
Type
n/a
Propertypublic  $folder= ''
Details
Type
n/a
Propertypublic  $folderStates= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $groupCss= '"<span class='groupInbox'>"'
Default value"<span class='groupInbox'>"Details
Type
n/a
Propertypublic  $rolloverStyle= '"<style>div#rollover {position: relative;float: left;margin: none;text-decoration: none;}div#rollover a:hover {padding: 0;}div#rollover a span {display: none;}div#rollover a:hover span {text-decoration: none;display: block;width: 250px;margin-top: 5px;margin-left: 5px;position: absolute;padding: 10px;color: #333; border: 1px solid #ccc; background-color: #fff; font-size: 12px;z-index: 1000;}</style>\n"'
Default value"<style>div#rollover {position: relative;float: left;margin: none;text-decoration: none;}div#rollover a:hover {padding: 0;}div#rollover a span {display: none;}div#rollover a:hover span {text-decoration: none;display: block;width: 250px;margin-top: 5px;margin-left: 5px;position: absolute;padding: 10px;color: #333; border: 1px solid #ccc; background-color: #fff; font-size: 12px;z-index: 1000;}</style>\n"Details
Type
n/a
Propertypublic  $smarty= ''
Details
Type
n/a
Propertypublic  $userCacheDir= ''''
Default value''Details
Type
n/a

Methods

methodpublicEmailUI( ) : void

Sole constructor

methodpublic_cleanUIDList( mixed $uids, bool $returnString = false ) : mixed

Cleans UID lists

Parameters
Name Type Description
$uids mixed
$returnString bool

False will return an array

Returns
Type Description
mixed
methodpublic_generateComposeConfigData( String $type = "email_compose_light" ) : void

Generate the config data needed for the Full Compose UI and the Quick Compose UI. The set of config data returned is the minimum set needed by the quick compose UI.

Parameters
Name Type Description
$type String

Drives which tinyMCE options will be included.

methodpublic_getPeopleUnionQuery(  $whereArr,  $person ) : void

Generates a UNION query to get one list of users, contacts, leads, and prospects; used specifically for the addressBook

Parameters
Name Type Description
$whereArr
$person
methodprotected_loadQuickCreateModules( ) : array

Load the modules from the metadata file and include in a custom one if it exists

Returns
Type Description
array
methodpublic_writeCacheFile( array $array, string $file ) : bool

Performs the actual file write. Abstracted from writeCacheFile() for flexibility

Parameters
Name Type Description
$array array

The array to write to the cache

$file string

Full path (relative) with cache file name

Returns
Type Description
bool
methodpublicaddContactsToList( string $list_id, array $contacts, string $newName, bool $truncate = false ) : void

Adds contact items to a mailing list

Parameters
Name Type Description
$list_id string

list_id GUID

$contacts array

contacts

$newName string

newName

$truncate bool

truncate

methodpublicarrayToXML( array $a, string $paramName ) : string

takes an array and creates XML

Parameters
Name Type Description
$a array

Array to convert

$paramName string

Name to wrap highest level items in array

Returns
Type Description
string XML
methodpublicbuildTreeNode(  $key,  $label,  $mbox, string $ieId, string $nodePath, bool $isGroup, bool $ie ) : mixed

Builds up a TreeView Node object

Parameters
Name Type Description
$key

mixed

$label

mixed

$mbox

string

$ieId string

ID of InboundEmail instance

$nodePath string

nodePath Serialized path from root node to current node

$isGroup bool

isGroup

$ie bool

forceRefresh

Returns
Type Description
mixed
methodpublicclearInboundAccountCache(  $ieId ) : void

Parameters
Name Type Description
$ieId
methodpubliccreateCopyOfInboundAttachment(  $ie,  $ret,  $uid ) : void

Parameters
Name Type Description
$ie
$ret
$uid
methodpubliccreateList( string $name ) : void

Creates a blank mailing list

Parameters
Name Type Description
$name string

name

methodpublicdeleteEmailCacheForFolders(  $cacheRoot ) : void

Parameters
Name Type Description
$cacheRoot
methodpublicdisplayComposeEmail( object $email ) : void

Returns the templatized compose screen. Used by reply, forwards and draft status messages.

Parameters
Name Type Description
$email object

email Email bean in focus

methodpublicdisplayEmailFrame( ) : void

Renders the frame for emails

methodpublicdisplayQuickComposeEmailFrame( ) : \JSON

Generate the frame needed for the quick compose email UI. This frame is loaded dynamically by an ajax call.

Returns
Type Description
\JSON An object containing html markup and js script variables.
methodpublicdisplaySuccessMessage( string $type ) : void

Formats a display message on successful async call

Parameters
Name Type Description
$type string

Type of message to display

methodpublicdistDirect( \$user $user, \$mailIds $mailIds ) : boolean

distributes emails to 1 user

Parameters
Name Type Description
$user \$user

users to dist to

$mailIds \$mailIds

array of email ids to push

Returns
Type Description
boolean true on success
methodpublicdistLeastBusy( \$userIds $userIds, \$mailIds $mailIds ) : boolean

distributes emails to users on Least Busy basis

Parameters
Name Type Description
$userIds \$userIds

array of users to dist to

$mailIds \$mailIds

array of email ids to push on those users

Returns
Type Description
boolean true on success
methodpublicdistRoundRobin( \$userIds $userIds, \$mailIds $mailIds ) : boolean

distributes emails to users on Round Robin basis

Parameters
Name Type Description
$userIds \$userIds

array of users to dist to

$mailIds \$mailIds

array of email ids to push on those users

Returns
Type Description
boolean true on success
methodpublicdoAssignment(  $distributeMethod,  $ieid,  $folder,  $uids,  $users ) : void

Parameters
Name Type Description
$distributeMethod
$ieid
$folder
$uids
$users
methodpublicdoDistributionWithMethod(  $users,  $emailIds,  $distributionMethod ) : void

Parameters
Name Type Description
$users
$emailIds
$distributionMethod
methodpublicemptyTrash( object $ie ) : void

Identifies subscribed mailboxes and empties the trash

Parameters
Name Type Description
$ie object

InboundEmail

methodpublicfindEmailFromBeanIds(  $beanIds,  $beanType,  $whereArr ) : void

Parameters
Name Type Description
$beanIds
$beanType
$whereArr
methodpublicgenerateComposePackageForQuickCreate( Array $composeData, String $fullLinkUrl,  $lazyLoad = false, \SugarBean $bean = null ) : \JSON

Generate the composePackage for the quick compose email UI. The package contains key/value pairs generated by the Compose.php file which are then set into the quick compose email UI (eg. to addr, parent id, parent type, etc)

Parameters
Name Type Description
$composeData Array

Associative array read and processed by generateComposeDataPackage.

$fullLinkUrl String

A link that contains all pertinant information so the user can be directed to the full compose screen if needed

$lazyLoad
$bean \SugarBean

Optional - the parent object bean with data

Returns
Type Description
\JSON Object containg composePackage and fullLinkUrl
methodpublicgenerateComposePackageForQuickCreateFromComposeUrl( String $emailLinkUrl,  $lazyLoad = false ) : \JSON

Given an email link url (eg. index.php?action=Compose&parent_type=Contacts...) break up the request components and create a compose package that can be used by the quick compose UI. The result is typically passed into the js call SUGAR.quickCompose.init which initalizes the quick compose UI.

Parameters
Name Type Description
$emailLinkUrl String
$lazyLoad
Returns
Type Description
\JSON Object containing the composePackage and full link url
methodpublicgenerateDynamicFolderQuery( string $type, string $userId ) : string

Parses the core dynamic folder query

Parameters
Name Type Description
$type string

'inbound', 'draft', etc.

$userId string
Returns
Type Description
string
methodpublicgenerateExpandableAddrs( string $str ) : string

Generate to/cc addresses string in email detailview.

Parameters
Name Type Description
$str string
Returns
Type Description
string $str
methodpublicgetAssignedEmailsCountForUsers(  $userIds ) : void

Parameters
Name Type Description
$userIds
methodpublicgetCacheTimestamp( string $ieId, string $type, string $file ) : string

retrieves the cache file last touched time

Parameters
Name Type Description
$ieId string
$type string

Type of cache file: folders, messages, etc.

$file string

The cachefile name

Returns
Type Description
string
methodpublicgetCacheValue( string $ieId, string $type, string $file, string $key ) : mixed

retrieves the cached value

Parameters
Name Type Description
$ieId string
$type string

Type of cache file: folders, messages, etc.

$file string

The cachefile name

$key string

name of cache value

Returns
Type Description
mixed
methodpublicgetContacts( ) : array

Retrieves all relationship metadata for a user's address book

Returns
Type Description
array
methodpublicgetDetailViewForEmail2(  $emailId ) : void

This function returns the detail view for email in new 2.0 interface

Parameters
Name Type Description
$emailId
methodpublicgetDraftAttachments( array $ret ) : array

Used exclusively by draft code. Returns Notes and Documents as attachments.

Parameters
Name Type Description
$ret array
Returns
Type Description
array
methodpublicgetEditContact( string $id, string $module ) : array

Prepares the Edit Contact mini-form via template assignment

Parameters
Name Type Description
$id string

id ID of contact in question

$module string

module Module in focus

Returns
Type Description
array
methodpublicgetEditMailingList( string $id ) : string

Returns metadata including the full HTML form to edit a mailing list

Parameters
Name Type Description
$id string

id ID of the Mailing List

Returns
Type Description
string HTML, empty on error
methodpublicgetEmailTemplatesArray( ) : array

returns an array of EmailTemplates that the user has access to for the compose email screen

Returns
Type Description
array
methodpublicgetFromAccountsArray(  $ie ) : void

Parameters
Name Type Description
$ie
methodpublicgetFromAllAccountsArray( \unknown_type $ie,  $ret ) : \unknown

This function will return all the accounts this user has access to based on the match of the emailId passed in as a parameter

Parameters
Name Type Description
$ie \unknown_type
$ret
Returns
Type Description
\unknown
methodpublicgetImportForm( array $vars, object $email,  $formName = 'ImportEditView' ) : array

Renders the Import form from Smarty and returns HTML

Parameters
Name Type Description
$vars array

request variable global

$email object

Fetched email object

$formName
Returns
Type Description
array
methodpublicgetLastRobin(  $ie ) : void

Parameters
Name Type Description
$ie
methodpublicgetListEmails( \GUID $ieId, string $mbox, int $folderListCacheOffset,  $forceRefresh = 'false' ) : string

Returns the HTML for a list of emails in a given folder

Parameters
Name Type Description
$ieId \GUID

GUID to InboundEmail instance

$mbox string

Mailbox path name in dot notation

$folderListCacheOffset int

Seconds for valid cache file

$forceRefresh
Returns
Type Description
string HTML render of list.
methodpublicgetLists( ) : array

Returns metadata to construct a user's mailing lists

Returns
Type Description
array
methodpublicgetMailBoxesFromCacheValue(  $mailAccount ) : void

Parameters
Name Type Description
$mailAccount
methodpublicgetMailboxNodes( ) : object

returns an array of nodes that correspond to IMAP mailboxes.

Returns
Type Description
object TreeView object
methodpublicgetQuickCreateForm( array $vars, object $email,  $addToAddressBookButton = false ) : array

Renders the QuickCreate form from Smarty and returns HTML

Parameters
Name Type Description
$vars array

request variable global

$email object

Fetched email object

$addToAddressBookButton
Returns
Type Description
array
methodpublicgetRelatedEmail(  $beanType, \$condition $whereArr,  $relatedBeanInfoArr = '' ) : \array('query'

get emails of related bean for a given bean id

Parameters
Name Type Description
$beanType
$whereArr \$condition

array of conditions inclued bean id

$relatedBeanInfoArr
Returns
Type Description
\array('query' => $q, 'countQuery' => $countq);
methodpublicgetShowAccountsOptions(  $ie ) : void

Re-used option getter for Show Accounts multiselect pane

Parameters
Name Type Description
$ie
methodpublicgetShowAccountsOptionsForSearch(  $ie ) : void

Parameters
Name Type Description
$ie
methodpublicgetSingleMessage(  $ie ) : array

returns the metadata defining a single email message for display. Uses cache file if it exists

Parameters
Name Type Description
$ie
Returns
Type Description
array
methodpublicgetTeams( ) : array

get team id and team set id from request

Returns
Type Description
array
methodpublicgetUnreadCount(  $ie,  $mailbox ) : void

Totals the unread emails

Parameters
Name Type Description
$ie
$mailbox
methodpublicgetUserContacts( array $contacts, object $user = null ) : array

Retrieves a concatenated list of contacts, those with assigned_user_id = user's id and those in the address_book table

Parameters
Name Type Description
$contacts array

Array of contact types -> IDs

$user object

User in focus

Returns
Type Description
array
methodpublicgetUserPrefsJS( ) : void

methodpublichandleReplyType( object $email, string $type ) : object

Formats email body on reply/forward

Parameters
Name Type Description
$email object

email Email object in focus

$type string

type

Returns
Type Description
object email
methodpublicjsonOuput( array $data, string $resultsParam,  $count = 0,  $fromCache = true,  $unread = -1 ) : string

Generate JSON encoded data to be consumed by yui datatable.

Parameters
Name Type Description
$data array
$resultsParam string

The resultsList name

$count
$fromCache
$unread
Returns
Type Description
string
methodpublicmarkEmails( string $type, string $ieId, string $folder, string $uids ) : void

Marks emails with the passed flag type. This will be applied to local cache files as well as remote emails.

Parameters
Name Type Description
$type string

Flag type

$ieId string
$folder string

IMAP folder structure or SugarFolder GUID

$uids string

Comma sep list of UIDs or GUIDs

methodpublicparseAttachmentInfo(  $actualAttachmentInfo,  $attachmentHtmlData ) : void

Parameters
Name Type Description
$actualAttachmentInfo
$attachmentHtmlData
methodpublicpreflightEmailCache(  $cacheRoot ) : void

Generates cache folder structure

Parameters
Name Type Description
$cacheRoot
methodpublicpreflightUser( object $user ) : void

Creates defaults for the User

Parameters
Name Type Description
$user object

User in focus

methodpublicpreflightUserCache( ) : void

Preps the User's cache dir

methodpublicremoveContacts( array $ids ) : void

Removes contacts from the user's address book

Parameters
Name Type Description
$ids array

ids

methodpublicremoveLists( array $removeIds ) : void

Removes selected lists from User's preferences

Parameters
Name Type Description
$removeIds array

IDs of lists to remove

methodpublicretrieveTeamInfoForSettingsUI( ) : void

methodpublicsaveContactEdit( string $str ) : void

saves editted Contact info

Parameters
Name Type Description
$str string

JSON serialized object

methodpublicsaveFolderOpenState(  $focusFolder,  $focusFolderOpen ) : void

Stickies folder collapse/open state

Parameters
Name Type Description
$focusFolder
$focusFolderOpen
methodpublicsaveListView(  $ieId,  $folder ) : void

saves a folder's view state

Parameters
Name Type Description
$ieId
$folder
methodpublicsaveListViewSortOrder(  $ieId,  $focusFolder,  $sortBy,  $sortDir ) : void

Saves user sort prefernces

Parameters
Name Type Description
$ieId
$focusFolder
$sortBy
$sortDir
methodpublicsaveNewFolder( string $nodeLabel,  $parentId,  $isGroup = 0 ) : void

Creates a new Sugar folder

Parameters
Name Type Description
$nodeLabel string

New sugar folder name

$parentId
$isGroup
methodpublicsetCacheTimestamp( string $ieId, string $type, string $file ) : void

Updates the timestamp for a cache file - usually to mark a "check email" process

Parameters
Name Type Description
$ieId string
$type string

Type of cache file: folders, messages, etc.

$file string

The cachefile name

methodpublicsetContacts( array $contacts ) : void

Saves changes to a user's address book

Parameters
Name Type Description
$contacts array

contacts

methodpublicsetLastRobin(  $ie,  $lastRobin ) : void

Parameters
Name Type Description
$ie
$lastRobin
methodpublicsetReadFlag(  $ieId,  $mbox,  $uid ) : void

Sets the "read" flag in the overview cache

Parameters
Name Type Description
$ieId
$mbox
$uid
methodpublicunifyEmailString( String $str ) : String

Unify the seperator as ,

Parameters
Name Type Description
$str String

email address string

Returns
Type Description
String converted string
methodpublicvalidCacheFileExists( string $ieId, string $type, string $file, int $refreshOffset = -1 ) : \mixed.

Validates existence and expiration of a cache file

Parameters
Name Type Description
$ieId string
$type string

Type of cache file: folders, messages, etc.

$file string

The cachefile name

$refreshOffset int

refreshOffset Refresh time in secs.

Returns
Type Description
\mixed.
methodpublicwriteCacheFile( string $key, mixed $var, string $ieId, string $type, string $file ) : void

Writes caches to flat file in cache dir.

Parameters
Name Type Description
$key string

Key to the main cache entry (not timestamp)

$var mixed

Variable to be cached

$ieId string

I-E focus ID

$type string

Folder in cache

$file string

Cache file name

methodpublicxmlOutput(  $a, string $paramName,  $count = 0,  $fromCache = true,  $unread = -1 ) : string

generates XML output from an array

Parameters
Name Type Description
$a

array

$paramName string

master list Item

$count
$fromCache
$unread
Returns
Type Description
string
Documentation was generated by DocBlox 0.18.1.