ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPRGMessagePrinter Class Reference

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

+ Collaboration diagram for ilPRGMessagePrinter:

Public Member Functions

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

Protected Attributes

 $collection
 
 $lng
 

Detailed Description

Util around ilPRGMessageCollection factors and output collections.

Definition at line 7 of file ilPRGMessagePrinter.php.

Constructor & Destructor Documentation

◆ __construct()

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

Definition at line 19 of file ilPRGMessagePrinter.php.

22 {
23 $this->collection = $collection;
24 $this->lng = $lng;
25 }

References $collection, and $lng.

Member Function Documentation

◆ getMessageCollection()

ilPRGMessagePrinter::getMessageCollection ( string  $topic)

Definition at line 27 of file ilPRGMessagePrinter.php.

28 {
29 return $this->collection->withNewTopic($topic);
30 }
Holds information about multi-actions, mainly in context of member-assignemnts and status changes.
withNewTopic(string $description)

References ilPRGMessageCollection\withNewTopic().

+ Here is the call graph for this function:

◆ showMessages()

ilPRGMessagePrinter::showMessages ( ilPRGMessageCollection  $msg)

Definition at line 32 of file ilPRGMessagePrinter.php.

33 {
34 if ($msg->hasSuccess()) {
35 $out = sprintf(
36 $this->lng->txt($msg->getDescription()),
37 count($msg->getSuccess())
38 );
39 \ilUtil::sendSuccess($out, true);
40 }
41
42 if ($msg->hasErrors()) {
43 $errmsg = [];
44 foreach ($msg->getErrors() as $err) {
45 list($message, $rec_indentifier) = $err;
46 $errmsg[] = sprintf('<li>%s (%s)</li>', $rec_indentifier, $this->lng->txt($message));
47 }
48
49 $out = sprintf(
50 $this->lng->txt($msg->getDescription() . '_failed'),
51 count($errmsg)
52 )
53 . '<ul>' . implode('', $errmsg) . '</ul>';
54
56 }
57 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$message
Definition: xapiexit.php:14

References $message, $out, ilPRGMessageCollection\getDescription(), ilPRGMessageCollection\getErrors(), ilPRGMessageCollection\getSuccess(), ilPRGMessageCollection\hasErrors(), ilPRGMessageCollection\hasSuccess(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

Field Documentation

◆ $collection

ilPRGMessagePrinter::$collection
protected

Definition at line 12 of file ilPRGMessagePrinter.php.

Referenced by __construct().

◆ $lng

ilPRGMessagePrinter::$lng
protected

Definition at line 17 of file ilPRGMessagePrinter.php.

Referenced by __construct().


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