ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilMailGlobalServices Class Reference

Class for global mail information (e.g. More...

+ Collaboration diagram for ilMailGlobalServices:

Static Public Member Functions

static getMailObjectRefId ()
 Determines the reference id of the mail object and stores this information in a local cache variable.
static getNumberOfNewMailsByUserId ($usr_id)
 Determines the number of new mails for the passed user id and stores this information in a local cache variable.

Data Fields

const CACHE_TYPE_REF_ID = 0
const CACHE_TYPE_NEW_MAILS = 1

Static Protected Attributes

static $global_mail_services_cache = array()

Detailed Description

Class for global mail information (e.g.

in main menu). This class should only contain methods for fetching data which is necessary in global parts of ILIAS, e.g. the main menu. We should keep this class as small as possible. Maybe we duplicate some code which already exists in class ilMail, but we need an efficient class.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 12 of file class.ilMailGlobalServices.php.

Member Function Documentation

static ilMailGlobalServices::getMailObjectRefId ( )
static

Determines the reference id of the mail object and stores this information in a local cache variable.

public

Returns
integer The reference id of the mail object

Definition at line 52 of file class.ilMailGlobalServices.php.

References $ilDB, $res, $row, and CACHE_TYPE_REF_ID.

Referenced by ilPersonalDesktopGUI\executeCommand(), ilUsersOnlineBlockGUI\fillRow(), ilUsersOnlineBlockGUI\getListRowData(), ilMainMenuGUI\ilMainMenuGUI(), ilMail\readMailObjectReferenceId(), ilMainMenuGUI\renderDropDown(), and ilMainMenuGUI\renderEntry().

{
global $ilDB;
if(isset(self::$global_mail_services_cache[CACHE_TYPE_REF_ID]) &&
null !== self::$global_mail_services_cache[CACHE_TYPE_REF_ID])
{
return self::$global_mail_services_cache[CACHE_TYPE_REF_ID];
}
// mail settings id is set by a constant in ilias.ini. Keep the select for some time until everyone has updated his ilias.ini
if(!MAIL_SETTINGS_ID)
{
$res = $ilDB->queryf('
SELECT object_reference.ref_id FROM object_reference, tree, object_data
WHERE tree.parent = %s
AND object_data.type = %s
AND object_reference.ref_id = tree.child
AND object_reference.obj_id = object_data.obj_id',
array('integer', 'text'),
array(SYSTEM_FOLDER_ID, 'mail'));
while($row = $ilDB->fetchAssoc($res))
{
self::$global_mail_services_cache[CACHE_TYPE_REF_ID] = $row['ref_id'];
}
}
else
{
self::$global_mail_services_cache[CACHE_TYPE_REF_ID] = MAIL_SETTINGS_ID;
}
return self::$global_mail_services_cache[CACHE_TYPE_REF_ID];
}

+ Here is the caller graph for this function:

static ilMailGlobalServices::getNumberOfNewMailsByUserId (   $usr_id)
static

Determines the number of new mails for the passed user id and stores this information in a local cache variable.

public

Returns
integer The number on unread mails (system messages + inbox mails) for the passed user id
Parameters
integerA user id of an ILIAS user account

Definition at line 97 of file class.ilMailGlobalServices.php.

References $ilDB, $res, $row, and CACHE_TYPE_NEW_MAILS.

Referenced by ilMailbox\_countNewMails(), ilSoapUserAdministration\hasNewMail(), and ilMainMenuGUI\renderStatusBox().

{
global $ilDB;
if(!$usr_id)
{
return 0;
}
if(isset(self::$global_mail_services_cache[CACHE_TYPE_NEW_MAILS][$usr_id]) &&
null !== self::$global_mail_services_cache[CACHE_TYPE_NEW_MAILS][$usr_id])
{
return self::$global_mail_services_cache[CACHE_TYPE_NEW_MAILS][$usr_id];
}
// Read system mails
$res = $ilDB->queryf('
SELECT COUNT(mail_id) cnt FROM mail
WHERE folder_id = %s
AND user_id = %s
AND m_status = %s',
array('integer', 'integer', 'text'),
array('0', $usr_id, 'unread'));
$row = $ilDB->fetchAssoc($res);
$res = $ilDB->queryf('
SELECT COUNT(mail_id) cnt FROM mail m,mail_obj_data mo
WHERE m.user_id = mo.user_id
AND m.folder_id = mo.obj_id
AND mo.m_type = %s
AND m.user_id = %s
AND m.m_status = %s',
array('text', 'integer', 'text'),
array('inbox', $usr_id, 'unread'));
$row2 = $ilDB->fetchAssoc($res);
self::$global_mail_services_cache[CACHE_TYPE_NEW_MAILS][$usr_id] = $row['cnt'] + $row2['cnt'];
return self::$global_mail_services_cache[CACHE_TYPE_NEW_MAILS][$usr_id];
}

+ Here is the caller graph for this function:

Field Documentation

ilMailGlobalServices::$global_mail_services_cache = array()
staticprotected

Definition at line 41 of file class.ilMailGlobalServices.php.

const ilMailGlobalServices::CACHE_TYPE_NEW_MAILS = 1

Definition at line 30 of file class.ilMailGlobalServices.php.

Referenced by getNumberOfNewMailsByUserId().

const ilMailGlobalServices::CACHE_TYPE_REF_ID = 0

Definition at line 21 of file class.ilMailGlobalServices.php.

Referenced by getMailObjectRefId().


The documentation for this class was generated from the following file: