ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilMailTemplatePlaceholderResolver.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
8 {
12  protected $context;
13 
17  protected $message;
18 
24  public function __construct(ilMailTemplateContext $context, $a_message)
25  {
26  $this->context = $context;
27  $this->message = $a_message;
28  }
29 
37  public function resolve(ilObjUser $user = null, $a_context_params = array(), $replace_empty = true)
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  }
55 }
resolve(ilObjUser $user=null, $a_context_params=array(), $replace_empty=true)
$result
__construct(ilMailTemplateContext $context, $a_message)
ilMailTemplateProcessor constructor.
Class ilMailTemplateContext.
Create styles array
The data for the language used.