Commit 9566e140 authored by Marc Egger's avatar Marc Egger Committed by Carsten Rose

Switch to psr4 composer

parent 1a63db46
......@@ -58,7 +58,7 @@ Bug Fixes
^^^^^^^^^
* Fix uniqIdQfq() - returned always badcaffeee1234
* Refactor functions.sql to function.sql. Implement constants for Version numbers.
* Refactor function.sql to function.sql. Implement constants for Version numbers.
* Update NewDoc.md
Version 19.6.0
......@@ -495,7 +495,7 @@ Notes
* Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'):
.../typo3conf/ext/qfq/Source/external/autocron.php
.../typo3conf/ext/qfq/Classes/External/autocron.php
Features
^^^^^^^^
......@@ -513,7 +513,7 @@ Features
to FormEditor example page.
* Move bootstrap.php and BindParamTest.php due to refactoring.
* phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Source/core/...'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Classes/Core/...'
* Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to
fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'.
* Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH
......
......@@ -135,7 +135,7 @@ Different browser prints the same page in different variations. To prevent this,
Provide a `print this page`-link (replace 'current pageId' )::
<a href="typo3conf/ext/qfq/Source/api/print.php?id={current pageId}">Print this page</a>
<a href="typo3conf/ext/qfq/Classes/api/print.php?id={current pageId}">Print this page</a>
Any parameter specified after `print.php` will be delivered to `wkhtmltopdf` as part of the URL.
......@@ -143,7 +143,7 @@ Typoscript code to implement a print link on every page::
10 = TEXT
10 {
wrap = <a href="typo3conf/ext/qfq/Source/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a>
wrap = <a href="typo3conf/ext/qfq/Classes/api/print.php?id=|&type=99"><span class="glyphicon glyphicon-print" aria-hidden="true"></span> Printview</a>
data = page:uid
}
......@@ -5775,11 +5775,11 @@ Link Examples
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "p:form_person|C:green" AS _link | <a href="?form_person"><img alttext="Check" src="typo3conf/ext/qfq/Resources/Public/icons/checked-green.gif"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "U:form=Person&r=123|x|D" as _link | <a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234"><span class="glyphicon glyphicon-trash" ></span>"></a> |
| SELECT "U:form=Person&r=123|x|D" as _link | <a href="typo3conf/ext/qfq/Classes/api/delete.php?s=badcaffee1234"><span class="glyphicon glyphicon-trash" ></span>"></a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "U:form=Person&r=123|x|t:Delete" as _link | <a href="typo3conf/ext/qfq/Source/api/delete.php?s=badcaffee1234">Delete</a> |
| SELECT "U:form=Person&r=123|x|t:Delete" as _link | <a href="typo3conf/ext/qfq/Classes/api/delete.php?s=badcaffee1234">Delete</a> |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "s:1|d:full.pdf|M:pdf|p:id=det1&r=12|p:id=det2|F:cv.pdf| | <a href="typo3conf/ext/qfq/Source/api/download.php?s=badcaffee1234">Download</a> |
| SELECT "s:1|d:full.pdf|M:pdf|p:id=det1&r=12|p:id=det2|F:cv.pdf| | <a href="typo3conf/ext/qfq/Classes/api/download.php?s=badcaffee1234">Download</a> |
| t:Download|a:Create complete PDF - please wait" as _link | |
+-----------------------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+
| SELECT "y:iatae3Ieem0jeet|t:Password|o:Clipboard|b" AS _link | <button class="btn btn-info" onClick="new QfqNS.Clipboard({text: 'iatae3Ieem0jeet'});" title='Copy to clipboard'>Password</button> |
......@@ -7015,7 +7015,7 @@ element. Such HTML element:
A `<div>` example HTML output (HTML send to the browser): ::
<div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234">
<div class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Classes/api/dragAndDrop.php?s=badcaffee1234">
<div class="anyClass" id="<uniq1>" data-dnd-id="55">
Numbero Uno
</div>
......@@ -7045,7 +7045,7 @@ A `<table>` based setup is also possible. Note the attribute `data-columns="3"`
which is the same column width as the outer table. ::
<table>
<tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Source/api/dragAndDrop.php?s=badcaffee1234" data-columns="3">
<tbody class="qfq-dnd-sort" data-dnd-api="typo3conf/ext/qfq/Classes/api/dragAndDrop.php?s=badcaffee1234" data-columns="3">
<tr> class="anyClass" id="<uniq1>" data-dnd-id="55">
<td>Numbero Uno</td><td>Numbero Uno.2</td><td>Numbero Uno.3</td>
</tr>
......@@ -7608,24 +7608,24 @@ four most used REST HTTP methods:
GET - Read
Shows a list of database records or a single record. The QFQ form holds the definition which and what to show.
List: ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/``
List: ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/``
Data (id=123): ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123``
Data (id=123): ``curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123``
POST - Create new record
The QFQ form defines wich columns will be written in which table. Most of QFQ Form functionality can be used. Example:
``curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/" -d '{"name":"Miller","firstname":"Joe"}'``
``curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/" -d '{"name":"Miller","firstname":"Joe"}'``
PUT - Update a record
Similar to POST, but a given record will be updated.
``curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123" -d '{"name":"Miller","firstname":"Joe"}'``
``curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123" -d '{"name":"Miller","firstname":"Joe"}'``
DELETE - Delete a record
Similar to a QFQ Delete form.
``curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123"``
``curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123"``
All data will imported / exported in JSON notation.
......@@ -7636,19 +7636,19 @@ Endpoint
.. tip::
The basic REST API endpoint: ``<domain>/typo3conf/ext/qfq/Source/api/rest.php``
The basic REST API endpoint: ``<domain>/typo3conf/ext/qfq/Classes/api/rest.php``
``<domain>/typo3conf/ext/qfq/Source/api/rest.php/<level1>/<id1>/<level2>/<id2>/.../?<var1>=<value1>&...``
``<domain>/typo3conf/ext/qfq/Classes/api/rest.php/<level1>/<id1>/<level2>/<id2>/.../?<var1>=<value1>&...``
Append level names and ids after `.../rest.php/`, each separated by '/' .
E.g.:
1. List of all persons: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person`
2. Data of person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123`
3. Adresses of person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123/address`
4. Adress details of address 45 from person 123: `<domain>/typo3conf/ext/qfq/Source/api/rest.php/person/123/address/45`
1. List of all persons: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person`
2. Data of person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123`
3. Adresses of person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address`
4. Adress details of address 45 from person 123: `<domain>/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address/45`
QFQ 'Forms' are used as a 'container' (to define all details).
......@@ -7862,7 +7862,7 @@ Example: ::
form.parameter.restToken=myCrypticString0123456789
Test via commandline: curl -X GET -H 'Authorization: Token token=myCrypticString0123456789' "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/person/123/address/"
Test via commandline: curl -X GET -H 'Authorization: Token token=myCrypticString0123456789' "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/person/123/address/"
The static setup with ``form.parameter.restToken=myCrypticString0123456789`` is fine, as long as only one token
exist. In case of multiple tokens, replace the static string against a SQL query.
......@@ -7899,7 +7899,7 @@ The `AutoCron` service fires periodically jobs like `open a webpage` (typically
actions) or `send mail`.
* AutoCron will be triggered via system cron. Minimal time distance therefore is 1 minute. If this is not sufficient,
any process who starts `.../typo3conf/ext/qfq/Source/external/autocron.php` via `/usr/bin/php` frequently might be used.
any process who starts `.../typo3conf/ext/qfq/Classes/External/autocron.php` via `/usr/bin/php` frequently might be used.
* Custom start time and frequency.
* Per job:
......@@ -7922,7 +7922,7 @@ Setup
Cron task: ::
* * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/Source/external/autocron.php
* * * * * /usr/bin/php /var/www/html/typo3conf/ext/qfq/Classes/External/autocron.php
AutoCron Jobs of type 'website' needs the php.ini setting: ::
......
......@@ -58,7 +58,7 @@ Bug Fixes
^^^^^^^^^
* Fix uniqIdQfq() - returned always badcaffeee1234
* Refactor functions.sql to function.sql. Implement constants for Version numbers.
* Refactor function.sql to function.sql. Implement constants for Version numbers.
* Update NewDoc.md
Version 19.6.0
......@@ -495,7 +495,7 @@ Notes
* Autocron: update the system crontab entry to the new path (old 'qfq', new 'Source'):
.../typo3conf/ext/qfq/Source/external/autocron.php
.../typo3conf/ext/qfq/Classes/External/autocron.php
Features
^^^^^^^^
......@@ -513,7 +513,7 @@ Features
to FormEditor example page.
* Move bootstrap.php and BindParamTest.php due to refactoring.
* phpunit.xml: implement const 'PHPUNIT_QFQ'. Store.php: set self::$phpUnit on const 'PHPUNIT_QFQ'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Source/core/...'
* Refactor: 'extension/qfq/qfq/...' to 'extension/Classes/Core/...'
* Refactor: Manual.rst update config variables (reorder), add 'qfqLog'. Support.php: formSubmitLog hardcoded to
fileadmin/protected/log. DOCUMENTATION_QFQ > SYSTEM_DOCUMENTATION_QFQ. Remove config var 'logDir'.
* Refactor: SITE_PATH >> sitePath, EXT_PATH >> extPath, SYSTEM_PATH_EXT >> SYSTEM_EXT_PATH
......
......@@ -8,7 +8,7 @@ RELEASE_DATE = $(shell date '+%Y%m%d%H%M')
GIT_REVISION_SHORT = $(shell git rev-parse --short HEAD || true)
GIT_REVISION_LONG = $(shell git rev-parse HEAD || true)
EXTENSION_CONTENT = Classes Configuration Source Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt vendor
EXTENSION_CONTENT = Classes Configuration Resources ext_emconf.php ext_localconf.php ext_tables.php ext_icon.png ext_conf_template.txt config.qfq.example.php RELEASE.txt vendor
DISTDIR=dist
......
......@@ -4,6 +4,13 @@
"description": "Framework to build web applications: Form generator (bootstrap based), dynamic update, typeahead, multi language, image annotation (via fabric), reports (defined via SQL), SIP protected links, PDF rendering, send mail (dynamic attachments, PDFs), multiple databases, record locking, secure up/download.",
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "^8.7"
"typo3/cms-core": "^8.7",
"ext-json": "*",
"ext-apache": "*",
"ext-mysqli": "*",
"ext-fileinfo": "*",
"ext-ldap": "*",
"ext-intl": "*",
"ext-iconv": "*"
}
}
\ No newline at end of file
......@@ -12,11 +12,11 @@ General Concept
* There is one PHP file to handle all REST calls:
typo3conf/ext/qfq/Source/api/rest.php
typo3conf/ext/qfq/Classes/api/rest.php
* All further endpoints are appended after rest.php, seperated by '/'. Example:
http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1/restAddress/123?myEmail=jonni@miller.com
http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1/restAddress/123?myEmail=jonni@miller.com
The argument 'myEmail' is just to show how GET variables will be submitted.
......@@ -39,7 +39,7 @@ GET - export
Example:
curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson"
curl -X GET "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson"
Details:
......@@ -55,7 +55,7 @@ POST - insert
Example:
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson" -d '{"name":"Miller","firstname":"Jonni"}'
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson" -d '{"name":"Miller","firstname":"Jonni"}'
Details:
......@@ -69,7 +69,7 @@ PUT - update
Example:
curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1" -d '{"name":"Miller","firstname":"Jonni"}'
curl -X PUT "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1" -d '{"name":"Miller","firstname":"Jonni"}'
Details:
......@@ -83,7 +83,7 @@ Delete
Example:
curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/1"
curl -X DELETE "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/1"
Details:
......@@ -97,7 +97,7 @@ Header Token Authorization
Example:
curl -X GET -H 'Authorization: Token token="mySuperSecretToken"' "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson/"
curl -X GET -H 'Authorization: Token token="mySuperSecretToken"' "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson/"
Static token
------------
......@@ -120,6 +120,6 @@ Append the GET variable `?XDEBUG_SESSION_START=1`
Example:
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Source/api/rest.php/restPerson?XDEBUG_SESSION_START=1" -d '{"name":"Miller","firstname":"Jonni"}'
curl -X POST "http://localhost/qfq/typo3conf/ext/qfq/Classes/api/rest.php/restPerson?XDEBUG_SESSION_START=1" -d '{"name":"Miller","firstname":"Jonni"}'
PhpStorm with activated debugger will stop at any breakpoint and 'stepping' through the code is possible.
......@@ -6,14 +6,13 @@
* Time: 6:16 PM
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
use IMATHUZH\Qfq\Core\Store\Store;
require_once(__DIR__ . '/../core/QuickFormQuery.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
/**
......@@ -75,7 +74,7 @@ $flagSuccess = false;
try {
try {
$qfq = new \qfq\QuickFormQuery(['bodytext' => '']);
$qfq = new QuickFormQuery(['bodytext' => '']);
$answer = $qfq->delete();
......@@ -100,7 +99,7 @@ try {
case MODE_HTML:
if ($targetUrl === false || $targetUrl === '') {
throw new CodeException('Missing target URL', ERROR_MISSING_VALUE);
throw new \CodeException('Missing target URL', ERROR_MISSING_VALUE);
}
if ($flagSuccess) {
......@@ -109,11 +108,11 @@ try {
break;
default:
throw new CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE);
throw new \CodeException('Unknown mode: ' . $modeAnswer, ERROR_UNKNOWN_MODE);
break;
}
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
......@@ -126,9 +125,9 @@ try {
$answer[API_FIELD_MESSAGE] = $val;
}
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
......
......@@ -6,13 +6,11 @@
* Time: 6:17 PM
*/
namespace IMATHUZH\Qfq\Api;
namespace qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
use qfq;
require_once(__DIR__ . '/../core/form/Dirty.php');
require_once(__DIR__ . '/../core/Constants.php');
use IMATHUZH\Qfq\Core\Form\Dirty;
/**
......@@ -20,7 +18,7 @@ require_once(__DIR__ . '/../core/Constants.php');
*
*/
try {
$dirty = new \qfq\Dirty();
$dirty = new Dirty();
$answer = $dirty->process();
......
......@@ -8,19 +8,14 @@
* Check: CODING.md > Download
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/report/Download.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/exceptions/DownloadException.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
require_once(__DIR__ . '/../core/exceptions/DbException.php');
require_once(__DIR__ . '/../core/exceptions/ErrorHandler.php');
use IMATHUZH\Qfq\Core\Report\Download;
set_error_handler("\\qfq\\ErrorHandler::exception_error_handler");
set_error_handler("\\IMATHUZH\\Qfq\\Core\\Exception\\ErrorHandler::exception_error_handler");
$output = '';
......@@ -31,11 +26,11 @@ try {
// If all is fine: process() will output file via print() !!
$output = $download->process(STORE_SIP, OUTPUT_MODE_DIRECT);
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$output = $e->formatMessage();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$output = $e->formatMessage();
} catch (qfq\DownloadException $e) {
} catch (\DownloadException $e) {
$output = $e->formatMessage();
}
} catch (\Exception $e) {
......
......@@ -6,18 +6,12 @@
* Time: 6:17 PM
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/QuickFormQuery.php');
//require_once(__DIR__ . '/../qfq/exceptions/UserFormException.php');
//require_once(__DIR__ . '/../qfq/exceptions/CodeException.php');
//require_once(__DIR__ . '/../qfq/exceptions/DbException.php');
//require_once(__DIR__ . '/../qfq/exceptions/ErrorHandler.php');
require_once(__DIR__ . '/../../vendor/autoload.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
/**
* Return JSON encoded answer
......@@ -68,11 +62,11 @@ try {
// unset($answer[API_FORM_UPDATE][API_ELEMENT_UPDATE]);
// $answer[API_ELEMENT_UPDATE] = [ 'dynamic-125' => [ 'content' => 'latest news', 'attr' => [ 'title' => 'latest title'] ] ];
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
} catch (\Exception $e) {
......
......@@ -6,15 +6,12 @@
* Time: 8:02 PM
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/File.php');
require_once(__DIR__ . '/../core/exceptions/UserFormException.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
use IMATHUZH\Qfq\Core\File;
/**
* Process File Upload - immediately when the the user selects a file.
......@@ -50,9 +47,9 @@ try {
// $answer[API_REDIRECT] = API_ANSWER_REDIRECT_NO;
$answer[API_STATUS] = API_ANSWER_STATUS_SUCCESS;
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
} catch (\Exception $e) {
......
......@@ -6,13 +6,13 @@
* Time: 6:17 PM
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/QuickFormQuery.php');
use IMATHUZH\Qfq\Core\Store\Store;
use IMATHUZH\Qfq\Core\QuickFormQuery;
/**
......@@ -63,7 +63,7 @@ try {
$answer[API_ELEMENT_UPDATE] = $data[API_ELEMENT_UPDATE];
// unset($answer[API_FORM_UPDATE][API_ELEMENT_UPDATE]);
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
......@@ -74,9 +74,9 @@ try {
if ($val !== false)
$answer[API_FIELD_MESSAGE] = $val;
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
......
......@@ -7,14 +7,11 @@
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
//require_once(__DIR__ . '/../qfq/store/Config.php');
//require_once(__DIR__ . '/../qfq/Constants.php');
require_once(__DIR__ . '/../core/report/Html2Pdf.php');
//require_once(__DIR__ . '/../qfq/helper/KeyValueStringParser.php');
use IMATHUZH\Qfq\Core\Report\Html2Pdf;
/**
* Main
......
......@@ -6,14 +6,13 @@
* Time: 15:40
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/QuickFormQuery.php');
require_once(__DIR__ . '/../core/exceptions/UserFormException.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
require_once(__DIR__ . '/../core/exceptions/DbException.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
use IMATHUZH\Qfq\Core\Helper\OnString;
$restId = array();
$restForm = array();
......@@ -40,7 +39,7 @@ try {
case REQUEST_METHOD_POST:
if ($id != 0) {
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id>0 with HTTP method $method",
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id>0 with HTTP method $method",
ERROR_MESSAGE_TO_DEVELOPER => '',
ERROR_MESSAGE_HTTP_STATUS => HTTP_400_BAD_REQUEST
]), ERROR_REST_INVALID_ID);
......@@ -52,7 +51,7 @@ try {
case REQUEST_METHOD_PUT:
if ($id == 0) {
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id==0 with HTTP method $method",
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id==0 with HTTP method $method",
ERROR_MESSAGE_TO_DEVELOPER => '',
ERROR_MESSAGE_HTTP_STATUS => HTTP_400_BAD_REQUEST
]), ERROR_REST_INVALID_ID);
......@@ -63,7 +62,7 @@ try {
case REQUEST_METHOD_DELETE:
if ($id == 0) {
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id==0 with HTTP method $method",
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Forbidden: id==0 with HTTP method $method",
ERROR_MESSAGE_TO_DEVELOPER => '',
ERROR_MESSAGE_HTTP_STATUS => HTTP_400_BAD_REQUEST
]), ERROR_REST_INVALID_ID);
......@@ -72,7 +71,7 @@ try {
break;
default:
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'Unsupported/unknown HTTP request method',
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => 'Unsupported/unknown HTTP request method',
ERROR_MESSAGE_TO_DEVELOPER => 'HTTP Code: ' . $method,
ERROR_MESSAGE_HTTP_STATUS => HTTP_403_METHOD_NOT_ALLOWED
]), ERROR_UNKNOWN_MODE);
......@@ -80,7 +79,7 @@ try {
}
if ($data === null) {
throw new UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Missing or broken JSON",
throw new \UserFormException(json_encode([ERROR_MESSAGE_TO_USER => "Missing or broken JSON",
ERROR_MESSAGE_TO_DEVELOPER => json_last_error_msg(),
ERROR_MESSAGE_HTTP_STATUS => HTTP_400_BAD_REQUEST
]), ERROR_BROKEN_PARAMETER);
......@@ -93,15 +92,15 @@ try {
$qfq = new QuickFormQuery(['bodytext' => $bodytext]);
$answer = $qfq->rest($restId, $restForm);
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$status = $e->getHttpStatus();
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$status = $e->getHttpStatus();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$status = $e->getHttpStatus();
}
......
......@@ -6,16 +6,13 @@
* Time: 6:16 PM
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/QuickFormQuery.php');
require_once(__DIR__ . '/../core/store/Store.php');
require_once(__DIR__ . '/../core/Constants.php');
require_once(__DIR__ . '/../core/exceptions/UserFormException.php');
require_once(__DIR__ . '/../core/exceptions/CodeException.php');
require_once(__DIR__ . '/../core/exceptions/DbException.php');
use IMATHUZH\Qfq\Core\QuickFormQuery;
use IMATHUZH\Qfq\Core\Store\Store;
/**
......@@ -78,7 +75,7 @@ try {
$answer[API_FORM_UPDATE] = $data[API_FORM_UPDATE];
}
} catch (qfq\UserFormException $e) {
} catch (\UserFormException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
$val = Store::getVar(SYSTEM_FORM_ELEMENT, STORE_SYSTEM);
......@@ -91,9 +88,9 @@ try {
$answer[API_FIELD_MESSAGE] = $val;
}
} catch (qfq\CodeException $e) {
} catch (\CodeException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
} catch (qfq\DbException $e) {
} catch (\DbException $e) {
$answer[API_MESSAGE] = $e->formatMessage();
}
} catch (\Exception $e) {
......
......@@ -7,12 +7,11 @@
*/
namespace qfq;
namespace IMATHUZH\Qfq\Api;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');
require_once(__DIR__ . '/../core/form/TypeAhead.php');
require_once(__DIR__ . '/../core/Constants.php');
use IMATHUZH\Qfq\Core\Form\TypeAhead;
/**
......@@ -20,7 +19,7 @@ require_once(__DIR__ . '/../core/Constants.php');
*
*/
try {
$typeAhead = new \qfq\TypeAhead();
$typeAhead = new TypeAhead();
$answer = $typeAhead->process();
......
......@@ -5,13 +5,12 @@
namespace IMATHUZH\Qfq\Controller;
use qfq;
require_once(__DIR__ . '/../../vendor/autoload.php');