Generates output by using flash messages

@return string
511826
protected function generateOutput()
    {
        $output = '';

        foreach ($this->messageList as $message) {
            $flashMessage = GeneralUtility::makeInstance(
                'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
                $message[2],
                $message[1],
                $message[0]
            );
            $output .= $flashMessage->render();
        }

        return $output;
    }
556264
protected function sendFlashMessage()
    {
        $bFlashOn = $this->property(self::PROPERTY_FLASH_ON);
        if (!$bFlashOn) {
            return;
        }

        $sMessage = Result::message();
        if (empty($sMessage)) {
            return;
        }

        if (Result::status()) {
            Flash::success($sMessage);
        } else {
            Flash::error($sMessage);
        }
    }
1135866
public function printMessage() {
		$messages = $_SESSION[$this->sessionKey];
		$html = '';
		
		foreach ($messages as $message){
			$html .='<div id="message" class="' . $message['type'] . '"><p>' . $message['message'] . '</p></div>';
		}
		
		$this->clearSession();
		
		return $html;
	}
1018289
public function generate()
	{
		$arrOptions = array();
		$strClass = 'tl_select';
		$strStyle = '<style>.group-result {padding-top: 5px !important; line-height: 20px !important;}';
		$count = 1;

		if ($this->multiple)
		{
			$this->strName .= '[]';
			$strClass = 'tl_mselect';
		}

		// Add an empty option (XHTML) if there are none
		if (empty($this->arrOptions))
		{
			$this->arrOptions = array(array('value'=>'', 'label'=>'-'));
		}
		
		foreach ($this->arrOptions as $strKey=>$arrOption)
		{
			if (isset($arrOption['value']))
			{
				$arrOptions[] = sprintf('<option value="%s"%s>%s</option>',
										 \StringUtil::specialchars($arrOption['value']),
										 $this->isSelected($arrOption),
										 $arrOption['label']);

				if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
				{
					$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
				}
				
				if ($objImage === null)
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
				}
				else
				{
					$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
				}
			}
			else
			{
				$arrOptgroups = array();

				foreach ($arrOption as $arrOptgroup)
				{
					$arrOptgroups[] = sprintf('<option value="%s"%s>%s</option>',
											   \StringUtil::specialchars($arrOptgroup['value']),
											   $this->isSelected($arrOptgroup),
											   $arrOptgroup['label']);

					if (isset($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]))
					{
						$objImage = \FilesModel::findByUuid($GLOBALS['TL_CTB_IMG'][$arrOptgroup['value']]);
					}

					if ($objImage === null)
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee; background-size: 60px 40px;}';
					}
					else
					{
						$strStyle .= '#ctrl_type_chzn_o_'.$count.' {position: relative; padding-left: 90px; line-height: 41px;}#ctrl_type_chzn_o_'.$count++.'::before {content: ""; position: absolute; left: 20px; top:2px; width: 60px; height: 40px; border: 1px solid #ccc; background: #eee url('.$objImage->path.'); background-size: 60px 40px;}';
					}

				}

				$arrOptions[] = sprintf('<optgroup label="&nbsp;%s">%s</optgroup>', \StringUtil::specialchars($strKey), implode('', $arrOptgroups));
				$count++;
			}
		}

		// Chosen
		if ($this->chosen)
		{
			$strClass .= ' tl_chosen';
		}


		$strStyle .= '</style>';
	
		return sprintf('%s<select name="%s" id="ctrl_%s" class="%s%s"%s onfocus="Backend.getScrollOffset()">%s</select>%s',
						($this->multiple ? '<input type="hidden" name="'. rtrim($this->strName, '[]') .'" value="">' : ''),
						$this->strName,
						$this->strId,
						$strClass,
						(($this->strClass != '') ? ' ' . $this->strClass : ''),
						$this->getAttributes(),
						implode('', $arrOptions),
						$strStyle);
	}
513454
public static function renderMessages() : string {
		$result = '';
		// we need to see if we have postponed messages and render them first
		$postponed = Session::get(['numbers', 'messages']);
		if (!empty($postponed)) {
			Session::set(['numbers', 'messages'], []);
			foreach ($postponed as $k => $v) {
				$result.= \HTML::message(['options' => $v, 'type' => $k]);
			}
		}
		// regular messages
		$messages = Application::get(array('messages'));
		if (!empty($messages)) {
			foreach ($messages as $k => $v) {
				$result.= \HTML::message(['options' => $v, 'type' => $k]);
			}
		}
		return $result;
	}
1179549
public function getFlashMessage()
    {
        if (Session::get('FMess') === true) {

            $response = array(
                'type' => Session::get('FMessType'),
                'message' => Session::get('FMessMsg')
            );
            Session::destroy('FMess');
            Session::destroy('FMessType');
            Session::destroy('FMessMsg');

            return $response;
        }
        return false;
    }
1366985
public function transformMessage()
	{
		$UrlPtrn  = "[^=\"\'](https?:|mailto:|ftp:|gopher:|news:|file:)" . "([^ |\\/\"\']*\\/)*([^ |\\t\\n\\/\"\']*[A-Za-z0-9\\/?=&~_])";

		$message = str_replace("\n", "\n ", stripslashes($this->get('message')));
		$message = preg_replace_callback("/$UrlPtrn/", array($this,'autolink'), $message);
		$message = nl2br($message);
		$message = str_replace("\t", '&nbsp;&nbsp;&nbsp;&nbsp;', $message);

		return $message;
	}
1018703
public function outputHtml()
    {
        $result = '';
        if (!is_null($this->dom)) {
            //SaveXML : <br/><img/>
            //SaveHTML: <br><img>
            $result = trim($this->dom->saveXML($this->getRealElement()));
            $result = str_replace($this->TEMP_CONTENT, '', $result);
            $parentTagNameLength = strlen($this->PARENT_TAG_NAME);
            $result = substr($result, $parentTagNameLength + 2, -($parentTagNameLength + 3));
        }
        return $result;
    }
620217
public function headerFlashMessengerAction()
    {
        $melisKey = $this->params()->fromRoute('melisKey', '');
        $flashMessenger = $this->getServiceLocator()->get('MelisCoreFlashMessenger');
         
        $view = new ViewModel();
        $view->melisKey = $melisKey;
        $view->flashMessages = $this->getflashMessageAction();
        
        return $view;
    }
630293
protected function outputUploadOutcome()
    {
        $json = new \stdClass();
        // errors
        if(!$this->uploadOk) {
            if($this->uploader->getMessages()) {
                $this->uploadMessages[] = implode('\n', $this->uploader->getMessages());
            }
            $json->error = implode('\n', $this->uploadMessages);
            $this->httpResponse = $this->httpResponse->withStatus('412', $json->error);
        } else {
            //input file informations
            $json->input = [
                'name' => $this->uploadFields[$this->uploadedField]->getInputFile(),
                'hash' => $this->uploadFields[$this->uploadedField]->getInputHash()
            ];
            // generated file(s) paths
            $json->outputs = $this->uploadFields[$this->uploadedField]->getOutputsFiles();
        }
        return json_encode($json);
    }
930510
final public function output (){

        if($this->_outputOnlyHeaders){
            $this->sendHttpHeaders();
            return true;
        }
    
        $this->_httpHeaders['Content-Type'] =
                'application/atom+xml;charset=' . $this->charset;

        if(!$this->infos->updated){
            $this->infos->updated = date("Y-m-d H:i:s");
        }

        // generate the main content, in a buffer
        // so we can handle errors
        $this->_template->assign ('atom', $this->infos);
        $this->_template->assign ('items', $this->itemList);
        $this->_template->assign ('lang',$this->lang);
        $content = $this->_template->fetch ($this->_mainTpl);

        $this->sendHttpHeaders();
        echo '<?xml version="1.0" encoding="'. $this->charset .'"?>', "\n";
        $this->_outputXmlHeader ();
        echo $content;
        return true;
    }
1292243
public function showErrors()
    {
        if (count($this->errors)) {
            $messages = [];
            $messages[] = GeneralUtility::makeInstance(
                FlashMessage::class,
                'There were errors. Check ke_search log for details.'. "\n",
                '',
                \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
                false
            );
            return $this->renderFlashMessages($messages);
        } else {
            return '';
        }
    }
21600
public function render()
    {
        // get messages
        $allMessages = [
            'danger'  => array_unique(
                array_merge(
                    $this->flashMessenger->getErrorMessages(),
                    $this->flashMessenger->getCurrentErrorMessages()
                )
            ),
            'success' => array_unique(
                array_merge(
                    $this->flashMessenger->getSuccessMessages(),
                    $this->flashMessenger->getCurrentSuccessMessages()
                )
            ),
            'warning' => array_unique(
                array_merge(
                    $this->flashMessenger->getWarningMessages(),
                    $this->flashMessenger->getCurrentWarningMessages()
                )
            ),
            'info'    => array_unique(
                array_merge(
                    $this->flashMessenger->getInfoMessages(),
                    $this->flashMessenger->getCurrentInfoMessages()
                )
            ),
            'default' => array_unique(
                array_merge(
                    $this->flashMessenger->getMessages(),
                    $this->flashMessenger->getCurrentMessages()
                )
            ),
        ];

        // clear messages
        $this->flashMessenger->clearMessagesFromContainer();
        $this->flashMessenger->clearCurrentMessagesFromContainer();

        // initialize output
        $output = '';

        // loop through messages
        foreach ($allMessages as $groupKey => $groupMessages) {
            foreach ($groupMessages as $message) {
                $addClass = $groupKey == 'default' ? '' : 'alert-' . $groupKey;

                // setup view model
                $viewModel = new ViewModel();
                $viewModel->setVariable('alertClass', $addClass);
                $viewModel->setVariable('alertMessage', $message);
                $viewModel->setTemplate('zfrapid-library/widget/bootstrap-alert');

                // add rendered output
                $output .= $this->getView()->render($viewModel);
            }
        }

        // return output
        return $output . "\n";
    }
333696
public function outputMessages()
    {

        // Simple Wrapper for OutputActions::$render->renderMessages
        if (php_sapi_name() === 'cli' &&
            !empty($this->messages)
        ) {
            // Output the messages on the shell.
            $result = "\n\nkreXX messages\n";
            $result .= "==============\n";
            foreach ($this->messages as $message) {
                $result .= "$message\n";
            }

            echo $result . "\n\n";
        }

        // Return the rendered messages.
        return $this->pool->render->renderMessages($this->messages);
    }
781488
public function generate()
    {
        return sprintf(
            '<input type="hidden" id="ctrl_%s" name="%s" value="%s" /><div%s>%s</div>',
            $this->strId,
            $this->strName,
            StringUtil::specialchars($this->label ?: $this->varValue),
            $this->style ? ' style="' . $this->style . '"' : '',
            $this->label
        );
    }
542009
public function flashMessage($message, $type = 'default', $comment=null, $icon=null, $width=50, $iconSize="lg", $timeout=5)
    {
        $id = $this->getParameterId('flash');
        $presenter = $this->getPresenter();
        if($presenter instanceof Presenter){
            $messages = $presenter->getFlashSession()->$id;
        } else {
            $messages = null;
        }

        $messages[] = $flash = (object) [
             'title' => $message,
             'type' => $type,
             'comment' => $comment,
             'icon' => $icon,
             'width' => $width,
             'iconSize' =>$iconSize,
             'timeout' => $timeout
         ];
        $this->getTemplate()->flashes = $messages;
        if($presenter instanceof Presenter){
            $presenter->getFlashSession()->$id = $messages;
        }
        return $flash;
    }
408621
public function render()
    {
        $output = '';

        foreach ($this->items as $message) {
            $output .= $message->render();
        }

        return $output;
    }