/**
  * Generate the log error report
  *
  * @return string HTML code
  */
 public static function displayLogErrors()
 {
     // query
     $query = array();
     $query['SELECT'] = 'COUNT(*) AS "nb",details,MAX(tstamp) as "tstamp"';
     $query['FROM'] = 'sys_log';
     $query['WHERE'] = 'error>0';
     $query['GROUPBY'] = 'details';
     $query['ORDERBY'] = 'nb DESC,tstamp DESC';
     $query['LIMIT'] = '';
     $orderby = TYPO3\CMS\Core\Utility\GeneralUtility::_GP('orderby');
     if ($orderby !== null) {
         $query['ORDERBY'] = $orderby;
     }
     $content = tx_additionalreports_util::writeInformation(self::getLl('flushalllog'), 'DELETE FROM sys_log WHERE error>0;');
     $logErrors = array();
     $view = TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Fluid\\View\\StandaloneView');
     $view->setTemplatePathAndFilename(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('additional_reports') . 'Resources/Private/Templates/logerrors-fluid.html');
     $view->assign('extconf', unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['additional_reports']));
     $view->assign('baseUrl', tx_additionalreports_util::getBaseUrl());
     $view->assign('requestDir', TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_DIR'));
     $view->assign('query', $query);
     return $content . $view->render();
 }
 /**
  * creates the searchbox
  * 1. fills the marker for marker based templating and renders the searchbox
  * 2. fills fluid variables for fluid based templating to $this->fluidTemplateVariables
  *
  * @return string rendered searchbox (for static or ajax templating, not for fluid templating)
  */
 public function getSearchboxContent()
 {
     // get main template code
     $content = $this->cObj->getSubpart($this->templateCode, '###SEARCHBOX_STATIC###');
     // set page = 1 if not set yet or if we are in static mode
     if (!$this->piVars['page'] || $this->conf['renderMethod'] == 'static' || $this->conf['renderMethod'] == "fluidtemplate") {
         $pageValue = 1;
     } else {
         $pageValue = $this->piVars['page'];
     }
     $content = $this->cObj->substituteMarker($content, '###HIDDEN_PAGE_VALUE###', $pageValue);
     $this->fluidTemplateVariables['page'] = $pageValue;
     // submit
     $content = $this->cObj->substituteMarker($content, '###SUBMIT_VALUE###', $this->pi_getLL('submit'));
     $this->fluidTemplateVariables['submitAltText'] = $this->pi_getLL('submit');
     // searchword input value
     $searchString = $this->piVars['sword'];
     if (!empty($searchString) && $searchString != $this->pi_getLL('searchbox_default_value')) {
         $this->swordValue = $searchString;
         $searchboxFocusJS = '';
         $searchboxBlurJS = '';
     } else {
         $this->swordValue = $this->pi_getLL('searchbox_default_value');
         // set javascript for resetting searchbox value
         $searchboxFocusJS = 'searchboxFocus(this);';
         $searchboxBlurJS = 'searchboxBlur(this);';
     }
     $content = $this->cObj->substituteMarker($content, '###SWORD_VALUE###', htmlspecialchars($this->swordValue));
     $this->fluidTemplateVariables['searchword'] = htmlspecialchars($this->swordValue);
     $content = $this->cObj->substituteMarker($content, '###SEARCHBOX_DEFAULT_VALUE###', htmlspecialchars($this->pi_getLL('searchbox_default_value')));
     $this->fluidTemplateVariables['searchwordDefault'] = htmlspecialchars($this->pi_getLL('searchbox_default_value'));
     $content = $this->cObj->substituteMarker($content, '###SWORD_ONFOCUS###', $searchboxFocusJS);
     $content = $this->cObj->substituteMarker($content, '###SWORD_ONBLUR###', $searchboxBlurJS);
     $content = $this->cObj->substituteMarker($content, '###SORTBYFIELD###', $this->piVars['sortByField']);
     $this->fluidTemplateVariables['sortByField'] = $this->piVars['sortByField'];
     $content = $this->cObj->substituteMarker($content, '###SORTBYDIR###', $this->piVars['sortByDir']);
     $this->fluidTemplateVariables['sortByDir'] = $this->piVars['sortByDir'];
     // set onsubmit action
     if ($this->conf['renderMethod'] != 'static') {
         $onSubmitMarker = 'onsubmit="document.getElementById(\'pagenumber\').value=1;"';
     } else {
         $onSubmitMarker = '';
     }
     $content = $this->cObj->substituteMarker($content, '###ONSUBMIT###', $onSubmitMarker);
     // get filters
     $renderedFilters = $this->renderFilters();
     $content = $this->cObj->substituteMarker($content, '###FILTER###', $renderedFilters);
     $this->fluidTemplateVariables['filter'] = $renderedFilters;
     // set form action pid
     $content = $this->cObj->substituteMarker($content, '###FORM_TARGET_PID###', $this->conf['resultPage']);
     $this->fluidTemplateVariables['targetpage'] = $this->conf['resultPage'];
     // set form action
     $siteUrl = TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL');
     $lParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('L');
     $mpParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GET('MP');
     $typeParam = TYPO3\CMS\Core\Utility\GeneralUtility::_GP('type');
     $actionUrl = $siteUrl . 'index.php';
     $content = $this->cObj->substituteMarker($content, '###FORM_ACTION###', $actionUrl);
     $this->fluidTemplateVariables['actionUrl'] = $actionUrl;
     // set other hidden fields
     $hiddenFieldsContent = '';
     // language parameter
     if (isset($lParam)) {
         $hiddenFieldValue = intval($lParam);
         $hiddenFieldsContent .= '<input type="hidden" name="L" value="' . $hiddenFieldValue . '" />';
         $this->fluidTemplateVariables['lparam'] = $hiddenFieldValue;
     }
     // mountpoint parameter
     if (isset($mpParam)) {
         // the only allowed characters in the MP parameter are digits and , and -
         $hiddenFieldValue = preg_replace('/[^0-9,-]/', '', $mpParam);
         $hiddenFieldsContent .= '<input type="hidden" name="MP" value="' . $hiddenFieldValue . '" />';
         $this->fluidTemplateVariables['mpparam'] = $hiddenFieldValue;
     }
     $content = $this->cObj->substituteMarker($content, '###HIDDENFIELDS###', $hiddenFieldsContent);
     // type param
     if ($typeParam) {
         $hiddenFieldValue = intval($typeParam);
         $typeContent = $this->cObj->getSubpart($this->templateCode, '###SUB_PAGETYPE###');
         $typeContent = $this->cObj->substituteMarker($typeContent, '###PAGETYPE###', $typeParam);
         $this->fluidTemplateVariables['typeparam'] = $hiddenFieldValue;
     } else {
         $typeContent = '';
     }
     $content = $this->cObj->substituteSubpart($content, '###SUB_PAGETYPE###', $typeContent, $recursive = 1);
     // add submit button in static mode
     if ($this->conf['renderMethod'] == 'static') {
         $submitButton = '<input type="submit" value="' . $this->pi_getLL('submit') . '" />';
     } else {
         $submitButton = '';
     }
     $content = $this->cObj->substituteMarker($content, '###SUBMIT###', $submitButton);
     // set reset link
     unset($linkconf);
     $linkconf['parameter'] = $this->conf['resultPage'];
     $resetUrl = $this->cObj->typoLink_URL($linkconf);
     $this->fluidTemplateVariables['resetUrl'] = $resetUrl;
     $resetLink = '<a href="' . $resetUrl . '" class="resetButton"><span>' . $this->pi_getLL('reset_button') . '</span></a>';
     $content = $this->cObj->substituteMarker($content, '###RESET###', $resetLink);
     // init onDomReadyAction
     $this->initDomReadyAction();
     return $content;
 }