ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilMailTemplatePlaceholderResolver Class Reference

Class ilMailTemplaceProcessor. More...

+ Collaboration diagram for ilMailTemplatePlaceholderResolver:

Public Member Functions

 __construct (ilMailTemplateContext $context, $a_message)
 ilMailTemplateProcessor constructor. More...
 
 resolve (ilObjUser $user=null, $a_context_params=array(), $replace_empty=true)
 

Protected Attributes

 $context
 
 $message
 

Detailed Description

Class ilMailTemplaceProcessor.

Definition at line 7 of file class.ilMailTemplatePlaceholderResolver.php.

Constructor & Destructor Documentation

◆ __construct()

ilMailTemplatePlaceholderResolver::__construct ( ilMailTemplateContext  $context,
  $a_message 
)

ilMailTemplateProcessor constructor.

Parameters
ilMailTemplateContext$context
string$a_message

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

References $context.

25  {
26  $this->context = $context;
27  $this->message = $a_message;
28  }

Member Function Documentation

◆ resolve()

ilMailTemplatePlaceholderResolver::resolve ( ilObjUser  $user = null,
  $a_context_params = array(),
  $replace_empty = true 
)
Parameters
ilObjUser | null$user
array$a_context_params
$replace_emptyboolean
Returns
string

Definition at line 37 of file class.ilMailTemplatePlaceholderResolver.php.

References $message, and $result.

38  {
40 
41  foreach($this->context->getPlaceholders() as $key => $ph_definition)
42  {
43  $result = $this->context->resolvePlaceholder($key, $a_context_params, $user);
44 
45  if(!$replace_empty && strlen($result) === 0)
46  {
47  continue;
48  }
49 
50  $message = str_replace('[' . $ph_definition['placeholder'] . ']', $result, $message);
51  }
52 
53  return $message;
54  }
$result

Field Documentation

◆ $context

ilMailTemplatePlaceholderResolver::$context
protected

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

Referenced by __construct().

◆ $message

ilMailTemplatePlaceholderResolver::$message
protected

Definition at line 17 of file class.ilMailTemplatePlaceholderResolver.php.

Referenced by resolve().


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