*/ namespace IMATHUZH\Qfq\Controller; use qfq; require_once(__DIR__ . '/../../qfq/qfq/QuickFormQuery.php'); require_once(__DIR__ . '/../../qfq/qfq/exceptions/UserFormException.php'); require_once(__DIR__ . '/../../qfq/qfq/exceptions/UserReportException.php'); require_once(__DIR__ . '/../../qfq/qfq/exceptions/CodeException.php'); require_once(__DIR__ . '/../../qfq/qfq/exceptions/DbException.php'); /** * Class QfqController * @package IMATHUZH\Qfq\Controller */ class QfqController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController { /** * @return string * @throws qfq\CodeException * @throws qfq\UserFormException */ public function showAction() { $origErrorReporting = ''; $flagOk = false; try { $contentObject = $this->configurationManager->getContentObject(); // By T3 default 'E_NOTICE' is unset. E.g. 'Undefined Index' will throw an exception. // QFQ like to see those 'E_NOTICE' $origErrorReporting = error_reporting(); error_reporting($origErrorReporting | E_NOTICE); $qfq = new \qfq\QuickFormQuery($contentObject->data); $html = $qfq->process(); $flagOk = true; } catch (qfq\UserFormException $e) { $html = $e->formatMessage(); } catch (qfq\UserReportException $e) { $html = $e->formatMessage(); } catch (qfq\CodeException $e) { $html = $e->formatMessage(); } catch (qfq\DbException $e) { $html = $e->formatMessage(); } catch (qfq\ShellException $e) { $html = $e->formatMessage(); } catch (qfq\DownloadException $e) { $html = $e->formatMessage(); } catch (\Exception $e) { $html = "Generic Exception: " . $e->getMessage(); } if (!$flagOk) { $html = "
$html
"; } // Restore has to be outside of try/catch - E_NOTICE needs to unset for further T3 handling after an QFQ Exception. error_reporting($origErrorReporting); $this->view->assign('qfqOutput', $html); return $this->view->render(); } }