/**
  * Main method of the dispatcher. This method is called as a user function.
  *
  * @return string rendered view
  * @param string $content
  * @param array $setup The TypoScript config
  */
 public function main($content, $setup)
 {
     $this->pi_USER_INT_obj = 1;
     try {
         //init flexform
         $this->pi_initPIflexForm();
         /*
          * Parse values from flexform:
          * - Template file
          * - Translation file
          * - Predefined form
          * - E-mail settings
          * - Required fields
          * - Redirect page
          */
         $templateFile = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'template_file', 'sDEF');
         $langFile = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'lang_file', 'sDEF');
         $predef = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'predefined', 'sDEF');
         Tx_Formhandler_Globals::$predef = $predef;
         Tx_Formhandler_Globals::$cObj = $this->cObj;
         Tx_Formhandler_Globals::$overrideSettings = $setup;
         $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
         /*
          * set controller:
          * 1. Default controller
          * 2. TypoScript
          */
         $controller = 'Tx_Formhandler_Controller_Form';
         if ($setup['controller']) {
             $controller = $setup['controller'];
         }
         $controller = Tx_Formhandler_StaticFuncs::prepareClassName($controller);
         $controller = $this->componentManager->getComponent($controller);
         if (isset($content)) {
             $controller->setContent($this->componentManager->getComponent('Tx_Formhandler_Content', $content));
         }
         if (strlen($templateFile) > 0) {
             $controller->setTemplateFile($templateFile);
         }
         if (strlen($langFile) > 0) {
             $controller->setLangFiles(array($langFile));
         }
         if (strlen($predef) > 0) {
             $controller->setPredefined($predef);
         }
         $result = $controller->process();
     } catch (Exception $e) {
         $result = '<div style="color:red; font-weight: bold">Caught exception: ' . $e->getMessage() . '</div>';
         $result .= '<div style="color:red; font-weight: bold">File: ' . $e->getFile() . '(' . $e->getLine() . ')</div>';
     }
     if (Tx_Formhandler_Globals::$session && Tx_Formhandler_Globals::$session->get('debug')) {
         foreach (Tx_Formhandler_Globals::$debuggers as $idx => $debugger) {
             $debugger->outputDebugLog();
         }
     }
     return $result;
 }
 public static function getInstance()
 {
     if (self::$instance === NULL) {
         self::$instance = new Tx_Formhandler_Component_Manager();
     }
     return self::$instance;
 }
 public function main()
 {
     $this->init();
     if ($this->fieldname) {
         $randomID = t3lib_div::_GP('randomID');
         Tx_Formhandler_Globals::$randomID = $randomID;
         $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
         $validator = $this->componentManager->getComponent('Tx_Formhandler_Validator_Ajax');
         print $validator->validateAjax($this->fieldname, $this->value);
     }
 }
 protected function initializeDebuggers()
 {
     $this->addFormhandlerClass($this->settings['debuggers.'], 'Tx_Formhandler_Debugger_Print');
     foreach ($this->settings['debuggers.'] as $idx => $options) {
         if (intval($options['disable']) !== 1) {
             $debuggerClass = $options['class'];
             $debuggerClass = Tx_Formhandler_StaticFuncs::prepareClassName($debuggerClass);
             $debugger = $this->componentManager->getComponent($debuggerClass);
             $debugger->init($this->gp, $options['config.']);
             $debugger->validateConfig();
             Tx_Formhandler_Globals::$debuggers[] = $debugger;
         }
     }
 }
 /**
  * Main method of the class.
  *
  * @return string The HTML list of remaining files to be displayed in the form
  */
 public function main()
 {
     $this->init();
     if ($this->fieldname) {
         $this->globals->setCObj($GLOBALS['TSFE']->cObj);
         $randomID = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('randomID'));
         $this->globals->setRandomID($randomID);
         $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
         if (!$this->globals->getSession()) {
             $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
             $sessionClass = $this->utilityFuncs->getPreparedClassName($ts['session.'], 'Session_PHP');
             $this->globals->setSession($this->componentManager->getComponent($sessionClass));
         }
         $validator = $this->componentManager->getComponent('Tx_Formhandler_Validator_Ajax');
         $errors = array();
         $valid = $validator->validateAjax($this->fieldname, $this->value, $errors);
         $this->settings = $this->globals->getSession()->get('settings');
         $content = '';
         if ($valid) {
             $content = $this->utilityFuncs->getSingle($this->settings['ajax.']['config.'], 'ok');
             if (strlen($content) === 0) {
                 $content = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('formhandler') . 'Resources/Images/ok.png' . '" />';
             } else {
                 $gp = array($_GET['field'] => $_GET['value']);
                 $view = $this->initView($content);
                 $content = $view->render($gp, $errors);
             }
             $content = '<span class="success">' . $content . '</span>';
         } else {
             $content = $this->utilityFuncs->getSingle($this->settings['ajax.']['config.'], 'notOk');
             if (strlen($content) === 0) {
                 $content = '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('formhandler') . 'Resources/Images/notok.png' . '" />';
             } else {
                 $view = $this->initView($content);
                 $gp = array($_GET['field'] => $_GET['value']);
                 $content = $view->render($gp, $errors);
             }
             $content = '<span class="error">' . $content . '</span>';
         }
         print $content;
     }
 }
 /**
  * Initialize the class. Read GET parameters
  *
  * @return void
  */
 protected function init()
 {
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     tslib_eidtools::connectDB();
     $this->utilityFuncs->initializeTSFE($this->id);
     $elementUID = intval($_GET['uid']);
     $row = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('*', 'tt_content', 'uid=' . $elementUID . ' AND pid=' . $this->id . $GLOBALS['TSFE']->cObj->enableFields('tt_content'));
     if (!empty($row)) {
         $GLOBALS['TSFE']->cObj->data = $row;
         $GLOBALS['TSFE']->cObj->current = 'tt_content_' . $elementUID;
     }
     $this->globals->setCObj($GLOBALS['TSFE']->cObj);
     $randomID = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('randomID'));
     $this->globals->setRandomID($randomID);
     $this->globals->setAjaxMode(TRUE);
     if (!$this->globals->getSession()) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = $this->utilityFuncs->getPreparedClassName($ts['session.'], 'Session_PHP');
         $this->globals->setSession($this->componentManager->getComponent($sessionClass));
     }
     $this->settings = $this->globals->getSession()->get('settings');
     $this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->utilityFuncs->getPreparedClassName($this->settings['ajax.'], 'AjaxHandler_JQuery');
         $ajaxHandler = $this->componentManager->getComponent($class);
         $this->globals->setAjaxHandler($ajaxHandler);
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
 protected function init()
 {
     $this->fieldName = $_GET['field'];
     $this->uploadedFileName = $_GET['uploadedFileName'];
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     tslib_eidtools::connectDB();
     $this->initializeTSFE($this->id);
     Tx_Formhandler_Globals::$cObj = $GLOBALS['TSFE']->cObj;
     $randomID = t3lib_div::_GP('randomID');
     Tx_Formhandler_Globals::$randomID = $randomID;
     if (!Tx_Formhandler_Globals::$session) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = 'Tx_Formhandler_Session_PHP';
         if ($ts['session.']) {
             $sessionClass = Tx_Formhandler_StaticFuncs::prepareClassName($ts['session.']['class']);
         }
         Tx_Formhandler_Globals::$session = $this->componentManager->getComponent($sessionClass);
     }
     $this->settings = Tx_Formhandler_Globals::$session->get('settings');
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->settings['ajax.']['class'];
         if (!$class) {
             $class = 'Tx_Formhandler_AjaxHandler_JQuery';
         }
         $class = Tx_Formhandler_StaticFuncs::prepareClassName($class);
         $ajaxHandler = $this->componentManager->getComponent($class);
         Tx_Formhandler_Globals::$ajaxHandler = $ajaxHandler;
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
Esempio n. 8
0
 /**
  * Generates the module content
  *
  * @return	void
  */
 function moduleContent()
 {
     switch ((string) $this->MOD_SETTINGS['function']) {
         case 1:
             // Render content:
             $componentManager = Tx_Formhandler_Component_Manager::getInstance();
             $controllerClass = 'Tx_Formhandler_Controller_Backend';
             $controller = $componentManager->getComponent($controllerClass);
             $controller->setId($this->id);
             $content = $controller->process();
             $this->content .= $this->doc->section('', $content, 0, 1);
             break;
         case 2:
             // Render content:
             $componentManager = Tx_Formhandler_Component_Manager::getInstance();
             $controllerClass = 'Tx_Formhandler_Controller_BackendClearLogs';
             $controller = $componentManager->getComponent($controllerClass);
             $controller->setId($this->id);
             $content = $controller->process();
             $this->content .= $this->doc->section('', $content, 0, 1);
             break;
         case 3:
             $content = '<div align=center><strong>Menu item #3...</strong></div>';
             $this->content .= $this->doc->section('Message #3:', $content, 0, 1);
             break;
     }
 }
 /**
  * Function to generate a PDF file from submitted form values. This function is called by Tx_Formhandler_Controller_Backend
  *
  * @param array $records The records to export to PDF
  * @param array $exportFields A list of fields to export. If not set all fields are exported
  * @see Tx_Formhandler_Controller_Backend::generatePDF()
  * @return void
  */
 function generateModulePDF($records, $exportFields = array())
 {
     //init pdf object
     $this->pdf = $this->componentManager->getComponent('Tx_Formhandler_Template_TCPDF');
     $addedOneRecord = FALSE;
     //for all records,
     //check if the record is valid.
     //a valid record has at least one param to export
     //if no valid record is found render an error message in pdf file
     foreach ($records as $data) {
         $valid = FALSE;
         if (isset($data['params']) && is_array($data['params'])) {
             foreach ($data['params'] as $key => $value) {
                 if (count($exportFields) == 0 || in_array($key, $exportFields)) {
                     $valid = TRUE;
                 }
             }
         }
         if ($valid) {
             $addedOneRecord = TRUE;
             $this->pdf->AliasNbPages();
             $this->pdf->AddPage();
             $this->pdf->SetFont('Helvetica', '', 12);
             $standardWidth = 100;
             $nameWidth = 70;
             $valueWidth = 70;
             $feedWidth = 30;
             if (count($exportFields) == 0 || in_array('pid', $exportFields)) {
                 $this->pdf->Cell($standardWidth, '15', 'Page-ID:', 0, 0);
                 $this->pdf->Cell($standardWidth, '15', $data['pid'], 0, 1);
             }
             if (count($exportFields) == 0 || in_array('submission_date', $exportFields)) {
                 $this->pdf->Cell($standardWidth, '15', 'Submission date:', 0, 0);
                 $this->pdf->Cell($standardWidth, '15', date('d.m.Y H:i:s', $data['crdate']), 0, 1);
             }
             if (count($exportFields) == 0 || in_array('ip', $exportFields)) {
                 $this->pdf->Cell($standardWidth, '15', 'IP address:', 0, 0);
                 $this->pdf->Cell($standardWidth, '15', $data['ip'], 0, 1);
             }
             $this->pdf->Cell($standardWidth, '15', 'Submitted values:', 0, 1);
             $this->pdf->SetLineWidth(0.3);
             $this->pdf->Cell($feedWidth);
             $this->pdf->SetFillColor(255, 255, 255);
             $this->pdf->Cell($nameWidth, '6', 'Name', 'B', 0, 'C', TRUE);
             $this->pdf->Cell($valueWidth, '6', 'Value', 'B', 0, 'C', TRUE);
             $this->pdf->Ln();
             $this->pdf->SetFillColor(200, 200, 200);
             $fill = FALSE;
             foreach ($exportFields as $key => $field) {
                 if (strcmp($field, 'pid') == FALSE || strcmp($field, 'submission_date') == FALSE || strcmp($field, 'ip') == FALSE) {
                     unset($exportFields[$key]);
                 }
             }
             if (count($exportFields) == 0) {
                 $exportFields = array_keys($data['params']);
             }
             foreach ($exportFields as $idx => $key) {
                 if (isset($data['params'][$key])) {
                     $value = $data['params'][$key];
                     if (is_array($value)) {
                         $this->pdf->Cell($feedWidth);
                         $this->pdf->Cell($nameWidth, '6', $key, 0, 0, 'L', $fill);
                         $this->pdf->Cell($valueWidth, '6', array_shift($value), 0, 0, 'L', $fill);
                         $this->pdf->Ln();
                         foreach ($value as $v) {
                             $this->pdf->Cell($feedWidth);
                             $this->pdf->Cell($nameWidth, '6', '', 0, 0, 'L', $fill);
                             $this->pdf->Cell($valueWidth, '6', $v, 0, 0, 'L', $fill);
                             $this->pdf->Ln();
                         }
                         $fill = !$fill;
                     } else {
                         $this->pdf->Cell($feedWidth);
                         $this->pdf->Cell($nameWidth, '6', $key, 0, 0, 'L', $fill);
                         $this->pdf->Cell($valueWidth, '6', $value, 0, 0, 'L', $fill);
                         $this->pdf->Ln();
                         $fill = !$fill;
                     }
                 }
             }
         }
     }
     //if no valid record was found, render an error message
     if (!$addedOneRecord) {
         $this->pdf->AliasNbPages();
         $this->pdf->AddPage();
         $this->pdf->SetFont('Helvetica', '', 12);
         $this->pdf->Cell(300, 100, 'No valid records found! Try to select more fields to export!', 0, 0, 'L');
     }
     $this->pdf->Output('formhandler.pdf', 'D');
     exit;
 }
 /**
  * Main method of the dispatcher. This method is called as a user function.
  *
  * @return string rendered view
  * @param string $content
  * @param array $setup The TypoScript config
  */
 public function main($content, $setup)
 {
     $this->pi_USER_INT_obj = 1;
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     try {
         //init flexform
         $this->pi_initPIflexForm();
         /*
          * Parse values from flexform:
          * - Template file
          * - Translation file
          * - Predefined form
          * - E-mail settings
          * - Required fields
          * - Redirect page
          */
         $templateFile = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'template_file', 'sDEF');
         $langFile = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'lang_file', 'sDEF');
         $predef = $this->pi_getFFvalue($this->cObj->data['pi_flexform'], 'predefined', 'sDEF');
         $this->globals->setCObj($this->cObj);
         if ($setup['usePredef']) {
             $predef = $this->utilityFuncs->getSingle($setup, 'usePredef');
         }
         $this->globals->getCObj()->setCurrentVal($predef);
         $this->globals->setPredef($predef);
         $this->globals->setOverrideSettings($setup);
         $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
         /*
          * set controller:
          * 1. Default controller
          * 2. TypoScript
          */
         $controller = 'Tx_Formhandler_Controller_Form';
         if ($setup['controller']) {
             $controller = $setup['controller'];
         }
         $controller = $this->utilityFuncs->prepareClassName($controller);
         $controller = $this->componentManager->getComponent($controller);
         if (isset($content)) {
             $controller->setContent($this->componentManager->getComponent('Tx_Formhandler_Content', $content));
         }
         if (strlen($templateFile) > 0) {
             $controller->setTemplateFile($templateFile);
         }
         if (strlen($langFile) > 0) {
             $controller->setLangFiles(array($langFile));
         }
         if (strlen($predef) > 0) {
             $controller->setPredefined($predef);
         }
         $result = $controller->process();
     } catch (Exception $e) {
         \TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($e->getFile() . '(' . $e->getLine() . ')' . ' ' . $e->getMessage(), 'formhandler', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
         $result = $this->utilityFuncs->getTranslatedMessage($this->globals->getLangFiles(), 'fe-exception');
         if (!$result) {
             $result = '<div style="color:red; font-weight: bold">' . $this->utilityFuncs->getExceptionMessage('fe-exception') . '</div>';
         }
         if ($this->globals->getSession() && $this->globals->getSession()->get('debug')) {
             $result = '<div style="color:red; font-weight: bold">' . $e->getMessage() . '</div>';
             $result .= '<div style="color:red; font-weight: bold">File: ' . $e->getFile() . '(' . $e->getLine() . ')</div>';
             $result .= '<div style="color:red; font-weight: bold">' . $e->getTraceAsString() . '</div>';
         }
     }
     if ($this->globals->getSession() && $this->globals->getSession()->get('debug')) {
         $debuggers = $this->globals->getDebuggers();
         foreach ($debuggers as $idx => $debugger) {
             $debugger->outputDebugLog();
         }
     }
     return $result;
 }
 /**
  * Initialize the class. Read GET parameters
  *
  * @return void
  */
 protected function init()
 {
     $this->fieldName = htmlspecialchars($_GET['field']);
     $this->uploadedFileName = htmlspecialchars($_GET['uploadedFileName']);
     if (isset($_GET['pid'])) {
         $this->id = intval($_GET['pid']);
     } else {
         $this->id = intval($_GET['id']);
     }
     $this->componentManager = Tx_Formhandler_Component_Manager::getInstance();
     $this->globals = Tx_Formhandler_Globals::getInstance();
     $this->utilityFuncs = Tx_Formhandler_UtilityFuncs::getInstance();
     tslib_eidtools::connectDB();
     $this->utilityFuncs->initializeTSFE($this->id);
     $this->globals->setCObj($GLOBALS['TSFE']->cObj);
     $randomID = htmlspecialchars(\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('randomID'));
     $this->globals->setRandomID($randomID);
     if (!$this->globals->getSession()) {
         $ts = $GLOBALS['TSFE']->tmpl->setup['plugin.']['Tx_Formhandler.']['settings.'];
         $sessionClass = $this->utilityFuncs->getPreparedClassName($ts['session.'], 'Session_PHP');
         $this->globals->setSession($this->componentManager->getComponent($sessionClass));
     }
     $this->settings = $this->globals->getSession()->get('settings');
     $this->langFiles = $this->utilityFuncs->readLanguageFiles(array(), $this->settings);
     //init ajax
     if ($this->settings['ajax.']) {
         $class = $this->utilityFuncs->getPreparedClassName($this->settings['ajax.'], 'AjaxHandler_JQuery');
         $ajaxHandler = $this->componentManager->getComponent($class);
         $this->globals->setAjaxHandler($ajaxHandler);
         $ajaxHandler->init($this->settings['ajax.']['config.']);
         $ajaxHandler->initAjax();
     }
 }
 /**
  * Function to handle the generation of a CSV file.
  * Before the data gets exported, the data is checked and the user gets informed about different formats of the data.
  * Each format has to be exported in an own file. After the format selection, the user is able to select which fields to export in a selection view.
  * This enables the user to get rid of fields like submitted or mp-step.
  *
  * @param misc $detailId The record uids to export to csv
  * @return void/string selection view
  * @author Reinhard Führicht <*****@*****.**>
  */
 protected function generateCSV($detailId)
 {
     $where = '';
     if (!$detailId) {
         $where = '1=1';
     } elseif (!is_array($detailId)) {
         $where = 'uid=' . $detailId;
     } else {
         $where = 'uid IN (' . implode(',', $detailId) . ')';
     }
     //init gp params
     $params = t3lib_div::_GP('formhandler');
     //select the records to export
     $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('uid,pid,crdate,ip,params,key_hash', $this->logTable, $where);
     //if record were found
     if ($res && $GLOBALS['TYPO3_DB']->sql_num_rows($res) > 0) {
         $records = array();
         $count = 0;
         $hashes = array();
         $availableFormats = array();
         //loop through records
         while (FALSE !== ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))) {
             //unserialize the params array
             $row['params'] = unserialize($row['params']);
             //find the amount of different formats to inform the user.
             if (!in_array($row['key_hash'], $hashes)) {
                 $hashes[] = $row['key_hash'];
                 $availableFormats[] = $row['params'];
             }
             $records[] = $row;
         }
         $GLOBALS['TYPO3_DB']->sql_free_result($res);
         $availableFormatsCount = count($availableFormats);
         //only one format found
         if ($availableFormatsCount === 1) {
             $tsconfig = t3lib_BEfunc::getModTSconfig($this->id, 'tx_formhandler_mod1');
             $configParams = array();
             // check if TSconfig filter is set
             if ($tsconfig['properties']['config.']['csv'] != "") {
                 $configParams = t3lib_div::trimExplode(',', $tsconfig['properties']['config.']['csv'], 1);
                 $generator = $this->componentManager->getComponent('Tx_Formhandler_Generator_CSV');
                 $generator->generateModuleCSV($records, $configParams);
             } elseif (isset($params['exportParams'])) {
                 //if fields were chosen in the selection view, perform the export
                 $generator = $this->componentManager->getComponent('Tx_Formhandler_Generator_CSV');
                 $generator->generateModuleCSV($records, $params['exportParams']);
                 //no fields chosen, show selection view.
             } else {
                 return $this->generateCSVExportFieldsSelector($records[0]['params']);
             }
             //more than one format and user has chosen a format to export
         } elseif (isset($params['csvFormat'])) {
             $renderRecords = array();
             if ($params['csvFormat'] === '*') {
                 $renderRecords = $records;
             } else {
                 //select the format
                 $format = $hashes[$params['csvFormat']];
                 $renderRecords = array();
                 //find out which records belong to this format
                 foreach ($records as $record) {
                     if (!strcmp($record['key_hash'], $format)) {
                         $renderRecords[] = $record;
                     }
                 }
             }
             $tsconfig = t3lib_BEfunc::getModTSconfig($this->id, 'tx_formhandler_mod1');
             $configParams = array();
             // check if TSconfig filter is set
             if ($tsconfig['properties']['config.']['csv'] != "") {
                 $configParams = t3lib_div::trimExplode(',', $tsconfig['properties']['config.']['csv'], 1);
                 $generator = $this->componentManager->getComponent('Tx_Formhandler_Generator_CSV');
                 $generator->generateModuleCSV($renderRecords, $configParams);
             } elseif (isset($params['exportParams'])) {
                 //if fields were chosen in the selection view, perform the export
                 $generator = $this->componentManager->getComponent('Tx_Formhandler_Generator_CSV');
                 $generator->generateModuleCSV($renderRecords, $params['exportParams']);
                 //no fields chosen, show selection view.
             } else {
                 $fields = $renderRecords[0]['params'];
                 if ($params['csvFormat'] === '*') {
                     $exportParams = array();
                     foreach ($renderRecords as $record) {
                         foreach ($record['params'] as $key => $value) {
                             if (!array_key_exists($key, $exportParams)) {
                                 $exportParams[$key] = $value;
                             }
                         }
                     }
                     $fields = $exportParams;
                 }
                 return $this->generateCSVExportFieldsSelector($fields);
             }
             //more than one format and none chosen by now, show format selection view.
         } else {
             return $this->generateFormatsSelector($availableFormats, $detailId);
         }
     }
 }