ILIAS  release_7 Revision v7.30-3-g800a261c036
ilPRGMessagePrinter.php
Go to the documentation of this file.
1<?php declare(strict_types = 1);
2
8{
12 protected $collection;
13
17 protected $lng;
18
19 public function __construct(
22 ) {
23 $this->collection = $collection;
24 $this->lng = $lng;
25 }
26
27 public function getMessageCollection(string $topic) : ilPRGMessageCollection
28 {
29 return $this->collection->withNewTopic($topic);
30 }
31
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 }
58}
An exception for terminatinating execution or to throw for unit testing.
language handling
Holds information about multi-actions, mainly in context of member-assignemnts and status changes.
withNewTopic(string $description)
Util around ilPRGMessageCollection factors and output collections.
getMessageCollection(string $topic)
__construct(ilPRGMessageCollection $collection, ilLanguage $lng)
showMessages(ilPRGMessageCollection $msg)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$message
Definition: xapiexit.php:14