QfqController.php 1.29 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<?php
/**
 * @author Rafael Ostertag <rafael.ostertag@math.uzh.ch>
 */

namespace IMATHUZH\Qfq\Controller;

use qfq;

require_once(__DIR__ . '/../../qfq/qfq/QuickFormQuery.php');
11
12
require_once(__DIR__ . '/../../qfq/qfq/exceptions/UserFormException.php');
require_once(__DIR__ . '/../../qfq/qfq/exceptions/UserReportExtension.php');
13
14
15
16
17
18
19
20
21
22
23
require_once(__DIR__ . '/../../qfq/qfq/exceptions/CodeException.php');
require_once(__DIR__ . '/../../qfq/qfq/exceptions/DbException.php');

class QfqController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
    public function showAction() {

        try {
            $contentObject = $this->configurationManager->getContentObject();
            $qfq = new \qfq\QuickFormQuery($contentObject->data);
            $html = $qfq->process();

24
        } catch (qfq\UserFormException $e) {
25
            $html = $e->formatMessage();
26
27
        } catch (qfq\UserReportException $e) {
            $html = $e->formatMessage();
28
29
30
31
32
33
34
35
36
37
38
39
40
        } catch (qfq\CodeException $e) {
            $html = $e->formatMessage();
        } catch (qfq\DbException $e) {
            $html = $e->formatMessage();
        } catch (\Exception $e) {
            $html = "Generic Exception: " . $e->getMessage();
        }

        $this->view->assign('qfqOutput', $html);
        return $this->view->render();
    }

}