ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilPRGMessagePrinter Class Reference

Util around ilPRGMessageCollection factors and output collections. More...

+ Collaboration diagram for ilPRGMessagePrinter:

Public Member Functions

 __construct (ilPRGMessageCollection $collection, ilLanguage $lng, ilGlobalTemplateInterface $tpl)
 
 getMessageCollection (string $topic)
 
 showMessages (ilPRGMessageCollection $msg)
 

Protected Attributes

ilPRGMessageCollection $collection
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 

Detailed Description

Util around ilPRGMessageCollection factors and output collections.

Definition at line 25 of file ilPRGMessagePrinter.php.

Constructor & Destructor Documentation

◆ __construct()

ilPRGMessagePrinter::__construct ( ilPRGMessageCollection  $collection,
ilLanguage  $lng,
ilGlobalTemplateInterface  $tpl 
)

Definition at line 31 of file ilPRGMessagePrinter.php.

References $collection, $lng, $tpl, and ILIAS\Repository\lng().

35  {
36  $this->collection = $collection;
37  $this->lng = $lng;
38  $this->tpl = $tpl;
39  }
ilGlobalTemplateInterface $tpl
ilPRGMessageCollection $collection
+ Here is the call graph for this function:

Member Function Documentation

◆ getMessageCollection()

ilPRGMessagePrinter::getMessageCollection ( string  $topic)

Definition at line 41 of file ilPRGMessagePrinter.php.

References ilPRGMessageCollection\withNewTopic().

42  {
43  return $this->collection->withNewTopic($topic);
44  }
withNewTopic(string $description)
Holds information about multi-actions, mainly in context of member-assignemnts and status changes...
+ Here is the call graph for this function:

◆ showMessages()

ilPRGMessagePrinter::showMessages ( ilPRGMessageCollection  $msg)

Definition at line 46 of file ilPRGMessagePrinter.php.

References $message, $out, ilPRGMessageCollection\getDescription(), ilPRGMessageCollection\getErrors(), ilPRGMessageCollection\getSuccess(), ilPRGMessageCollection\hasErrors(), ilPRGMessageCollection\hasSuccess(), and ILIAS\Repository\lng().

46  : void
47  {
48  if ($msg->hasSuccess()) {
49  $out = sprintf(
50  $this->lng->txt($msg->getDescription()),
51  count($msg->getSuccess())
52  );
53  $this->tpl->setOnScreenMessage("success", $out, true);
54  }
55 
56  if ($msg->hasErrors()) {
57  $errmsg = [];
58  foreach ($msg->getErrors() as $err) {
59  [$message, $rec_indentifier] = $err;
60  $errmsg[] = sprintf('<li>%s (%s)</li>', $rec_indentifier, $this->lng->txt($message));
61  }
62 
63  $out = sprintf(
64  $this->lng->txt($msg->getDescription() . '_failed'),
65  count($errmsg)
66  )
67  . '<ul>' . implode('', $errmsg) . '</ul>';
68 
69  $this->tpl->setOnScreenMessage("failure", $out, true);
70  }
71  }
$out
Definition: buildRTE.php:24
$message
Definition: xapiexit.php:31
+ Here is the call graph for this function:

Field Documentation

◆ $collection

ilPRGMessageCollection ilPRGMessagePrinter::$collection
protected

Definition at line 27 of file ilPRGMessagePrinter.php.

Referenced by __construct().

◆ $lng

ilLanguage ilPRGMessagePrinter::$lng
protected

Definition at line 28 of file ilPRGMessagePrinter.php.

Referenced by __construct().

◆ $tpl

ilGlobalTemplateInterface ilPRGMessagePrinter::$tpl
protected

Definition at line 29 of file ilPRGMessagePrinter.php.

Referenced by __construct().


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