ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSystemNotification Class Reference

Wrapper classes for system notifications. More...

+ Inheritance diagram for ilSystemNotification:
+ Collaboration diagram for ilSystemNotification:

Public Member Functions

 setSubjectLangId ($a_lang_id)
 Set subject lang id.
 setIntroductionLangId ($a_lang_id)
 Set introduction lang id.
 setIntroductionDirect ($a_text)
 Set introduction text.
 setTaskLangId ($a_lang_id)
 Set task lang id.
 setReasonLangId ($a_lang_id)
 Set reason lang id.
 setGotoLangId ($a_lang_id)
 Set goto lang id.
 setChangedByUserId ($a_id)
 Set changed by user id.
 addAdditionalInfo ($a_lang_id, $a_value, $a_multiline=false)
 Add additional information.
 sendMail (array $a_user_ids, $a_goto_additional=null, $a_permission="read")
 Send notification(s)
 compose ($a_user_id, $a_goto_additional=null, $a_permission="read", $a_append_signature_direct=false)
 Compose notification to single recipient.
 composeAndGetMessage ($a_user_id, $a_goto_additional=null, $a_permission="read", $a_append_signature_direct=false)
 Compose notification to single recipient.
- Public Member Functions inherited from ilMailNotification
 __construct ($a_is_personal_workspace=false)
 Constructor.
 setType ($a_type)
 Set notification type.
 getType ()
 Get notification type.
 setSender ($a_usr_id)
 Set sender of mail.
 getSender ()
 get sender of mail
 setRecipients ($a_rcp)
 set mail recipients
 getRecipients ()
 get array of recipients
 setAttachments ($a_att)
 Set attachments.
 getAttachments ()
 Get attachments.
 setLangModules (array $a_modules)
 Set lang modules.
 getUserLanguage ($a_usr_id)
 Get user language.
 setRefId ($a_id)
 Set ref id.
 getRefId ()
 get reference id
 getObjId ()
 get object id
 setObjId ($a_obj_id)
 set obj id
 getObjType ()
 Get object type.
 setAdditionalInformation ($a_info)
 Additional information for creating notification mails.
 getAdditionalInformation ()
 Get additional information for generating notification mails.
 sendMail ($a_rcp, $a_type, $a_parse_recipients=true)
 Send Mail.
 getBlockBorder ()
 Get (ascii) block border.

Protected Member Functions

 composeAndSendMail ($a_user_id, $a_goto_additional=null, $a_permission="read")
 Send notification to single recipient.
- Protected Member Functions inherited from ilMailNotification
 setSubject ($a_subject)
 Set mail subject.
 getSubject ()
 Get mail subject.
 setBody ($a_body)
 Set mail body.
 appendBody ($a_body)
 Append body text.
 getBody ()
 Get body.
 initLanguage ($a_usr_id)
 Init language.
 initLanguageByIso2Code ($a_code= '')
 Init language by ISO2 code.
 setLanguage ($a_language)
 A language.
 getLanguage ()
 get language object
 getLanguageText ($a_keyword)
 Replace new lines.
 getObjectTitle ($a_shorten=false)
 Get object title.
 initMail ()
 Init mail.
 getMail ()
 Get mail object.
 createPermanentLink ($a_params=array(), $a_append= '')
 Create a permanent link for an object.
 userToString ($a_usr_id)
 Utility function.
 isRefIdAccessible ($a_user_id, $a_ref_id, $a_permission="read")
 Check if ref id is accessible for user.

Protected Attributes

 $subject_lang_id
 $introduction
 $introduction_direct
 $task
 $reason
 $additional
 $goto_caption
 $changed_by
 $all_ref_ids
- Protected Attributes inherited from ilMailNotification
 $type = null
 $sender = null
 $mail = null
 $subject = ''
 $body = ''
 $attachments = array()
 $language = null
 $lang_modules = array()
 $recipients = array()
 $ref_id = null
 $obj_id = null
 $obj_type = null
 $additional_info = array()
 $is_in_wsp
 $wsp_tree
 $wsp_access_handler

Additional Inherited Members

- Data Fields inherited from ilMailNotification
const SUBJECT_TITLE_LENGTH = 60

Detailed Description

Wrapper classes for system notifications.

See Also
FeatureWiki/Guidelines/System Notification Guideline
Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Id:
class.ilObjExerciseGUI.php 24003 2010-05-26 14:35:42Z akill

Definition at line 16 of file class.ilSystemNotification.php.

Member Function Documentation

ilSystemNotification::addAdditionalInfo (   $a_lang_id,
  $a_value,
  $a_multiline = false 
)

Add additional information.

Parameters
string$a_lang_id
mixed$a_value
bool$a_multiline

Definition at line 107 of file class.ilSystemNotification.php.

{
$this->additional[$a_lang_id] = array(trim($a_value), (bool)$a_multiline);
}
ilSystemNotification::compose (   $a_user_id,
  $a_goto_additional = null,
  $a_permission = "read",
  $a_append_signature_direct = false 
)

Compose notification to single recipient.

Parameters
mixed$a_rcp
string$a_goto_additional
string$a_permission
bool$a_append_signature_direct
Returns
bool

Definition at line 182 of file class.ilSystemNotification.php.

References ilMailNotification\$ref_id, ilMail\_getAutoGeneratedMessageString(), ilMail\_getInstallationSignature(), ilMailNotification\appendBody(), ilMailNotification\createPermanentLink(), ilMailNotification\getBlockBorder(), ilMailNotification\getLanguage(), ilMailNotification\getLanguageText(), ilMailNotification\getMail(), ilUserUtil\getNamePresentation(), ilMailNotification\getObjectTitle(), ilMailNotification\getObjId(), ilMailNotification\getObjType(), ilMailNotification\getRefId(), ilMail\getSalutation(), ilMailNotification\initLanguage(), ilMailNotification\initMail(), ilMailNotification\isRefIdAccessible(), ilMailNotification\setBody(), and ilMailNotification\setSubject().

Referenced by composeAndGetMessage(), and composeAndSendMail().

{
$this->initLanguage($a_user_id);
$this->initMail();
$this->setSubject(
sprintf($this->getLanguageText($this->subject_lang_id), $this->getObjectTitle(true))
);
$this->setBody(ilMail::getSalutation($a_user_id, $this->getLanguage()));
$this->appendBody("\n\n");
if($this->introduction)
{
$this->appendBody($this->getLanguageText($this->introduction));
$this->appendBody("\n\n");
}
if($this->introduction_direct)
{
$this->appendBody($this->introduction_direct);
$this->appendBody("\n\n");
}
if($this->task)
{
$this->appendBody($this->getLanguageText($this->task));
$this->appendBody("\n\n");
}
// details table
if($this->getObjId())
{
$this->appendBody($this->getLanguageText("obj_".$this->getObjType()).": ".
$this->getObjectTitle()."\n");
}
if(sizeof($this->additional))
{
foreach($this->additional as $lang_id => $item)
{
if(!$item[1])
{
$this->appendBody($this->getLanguageText($lang_id).": ".
$item[0]."\n");
}
else
{
$this->appendBody("\n".$this->getLanguageText($lang_id)."\n".
$this->getBlockBorder().
$item[0]."\n".
$this->getBlockBorder()."\n");
}
}
}
$this->body = trim($this->body);
$this->appendBody("\n\n");
if($this->changed_by)
{
$this->appendBody($this->getLanguageText("system_notification_installation_changed_by").": ".
ilUserUtil::getNamePresentation($this->changed_by));
$this->appendBody("\n\n");
}
if($this->getObjId())
{
// try to find accessible ref_id
if(!$this->getRefId() && $this->all_ref_ids)
{
$find_ref_id = true;
foreach($this->all_ref_ids as $ref_id)
{
if($this->isRefIdAccessible($a_user_id, $ref_id, $a_permission))
{
$this->ref_id = $ref_id;
break;
}
}
}
// check if initially given ref_id is accessible for current recipient
if($this->getRefId() &&
!$find_ref_id &&
!$this->isRefIdAccessible($a_user_id, $this->getRefId(), $a_permission))
{
return false;
}
$goto = $this->createPermanentLink(array(), $a_goto_additional);
if($goto)
{
$this->appendBody($this->getLanguageText($this->goto_caption).": ".
$goto);
$this->appendBody("\n\n");
}
if($find_ref_id)
{
$this->ref_id = null;
}
}
if($this->reason)
{
$this->appendBody($this->getLanguageText($this->reason));
$this->appendBody("\n\n");
}
// signature will append new lines
$this->body = trim($this->body);
if(!$a_append_signature_direct)
{
$this->getMail()->appendInstallationSignature(true);
}
else
{
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSystemNotification::composeAndGetMessage (   $a_user_id,
  $a_goto_additional = null,
  $a_permission = "read",
  $a_append_signature_direct = false 
)

Compose notification to single recipient.

Parameters
mixed$a_user_id
string$a_goto_additional
string$a_permission
bool$a_append_signature_direct
Returns
string

Definition at line 334 of file class.ilSystemNotification.php.

References ilMailNotification\$body, and compose().

{
if($this->compose($a_user_id, $a_goto_additional, $a_permission, $a_append_signature_direct))
{
return $this->body;
}
}

+ Here is the call graph for this function:

ilSystemNotification::composeAndSendMail (   $a_user_id,
  $a_goto_additional = null,
  $a_permission = "read" 
)
protected

Send notification to single recipient.

Parameters
mixed$a_rcp
string$a_goto_additional
string$a_permission
Returns
bool

Definition at line 315 of file class.ilSystemNotification.php.

References compose(), and sendMail().

Referenced by sendMail().

{
if($this->compose($a_user_id, $a_goto_additional, $a_permission))
{
parent::sendMail(array($a_user_id), array('system'), is_numeric($a_user_id));
return true;
}
return false;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSystemNotification::sendMail ( array  $a_user_ids,
  $a_goto_additional = null,
  $a_permission = "read" 
)

Send notification(s)

Parameters
array$a_user_ids
string$a_goto_additional
string$a_permission
Returns
array recipient ids

Definition at line 120 of file class.ilSystemNotification.php.

References ilObject\_getAllReferences(), composeAndSendMail(), ilMailNotification\getObjId(), and ilMailNotification\getRefId().

Referenced by composeAndSendMail().

{
$this->all_ref_ids = null;
// prepare object related info
if($this->getObjId())
{
if(!$this->getRefId())
{
// try to find ref_id(s)
if(!$this->is_in_wsp)
{
$ref_ids = ilObject::_getAllReferences($this->getObjId());
if(sizeof($ref_ids) == 1)
{
$this->ref_id = array_shift($ref_ids);
}
else
{
$this->all_ref_ids = $ref_ids;
}
}
}
else if($this->is_in_wsp) // #11680
{
$this->ref_id = $this->wsp_tree->lookupNodeId($this->getObjId());
}
// default values
if(!$this->goto_caption)
{
$this->goto_caption = "url";
}
}
$recipient_ids = array();
foreach(array_unique($a_user_ids) as $user_id)
{
// author of change should not get notification
if($this->changed_by == $user_id)
{
continue;
}
if($this->composeAndSendMail($user_id, $a_goto_additional, $a_permission))
{
$recipient_ids[] = $user_id;
}
}
return $recipient_ids;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSystemNotification::setChangedByUserId (   $a_id)

Set changed by user id.

Parameters
int$a_id

Definition at line 93 of file class.ilSystemNotification.php.

{
$this->changed_by = (int)$a_id;
include_once "Services/User/classes/class.ilUserUtil.php";
}
ilSystemNotification::setGotoLangId (   $a_lang_id)

Set goto lang id.

Parameters
string$a_lang_id

Definition at line 83 of file class.ilSystemNotification.php.

{
$this->goto_caption = (string)$a_lang_id;
}
ilSystemNotification::setIntroductionDirect (   $a_text)

Set introduction text.

Parameters
string$a_text

Definition at line 53 of file class.ilSystemNotification.php.

{
$this->introduction_direct = trim($a_text);
}
ilSystemNotification::setIntroductionLangId (   $a_lang_id)

Set introduction lang id.

Parameters
string$a_lang_id

Definition at line 43 of file class.ilSystemNotification.php.

{
$this->introduction = (string)$a_lang_id;
}
ilSystemNotification::setReasonLangId (   $a_lang_id)

Set reason lang id.

Parameters
string$a_lang_id

Definition at line 73 of file class.ilSystemNotification.php.

{
$this->reason = (string)$a_lang_id;
}
ilSystemNotification::setSubjectLangId (   $a_lang_id)

Set subject lang id.

Parameters
string$a_lang_id

Definition at line 33 of file class.ilSystemNotification.php.

{
$this->subject_lang_id = (string)$a_lang_id;
}
ilSystemNotification::setTaskLangId (   $a_lang_id)

Set task lang id.

Parameters
string$a_lang_id

Definition at line 63 of file class.ilSystemNotification.php.

{
$this->task = (string)$a_lang_id;
}

Field Documentation

ilSystemNotification::$additional
protected

Definition at line 23 of file class.ilSystemNotification.php.

ilSystemNotification::$all_ref_ids
protected

Definition at line 26 of file class.ilSystemNotification.php.

ilSystemNotification::$changed_by
protected

Definition at line 25 of file class.ilSystemNotification.php.

ilSystemNotification::$goto_caption
protected

Definition at line 24 of file class.ilSystemNotification.php.

ilSystemNotification::$introduction
protected

Definition at line 19 of file class.ilSystemNotification.php.

ilSystemNotification::$introduction_direct
protected

Definition at line 20 of file class.ilSystemNotification.php.

ilSystemNotification::$reason
protected

Definition at line 22 of file class.ilSystemNotification.php.

ilSystemNotification::$subject_lang_id
protected

Definition at line 18 of file class.ilSystemNotification.php.

ilSystemNotification::$task
protected

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


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