Concept - DataProcessors
DataProcessors are the communication ports on the srever your client connects to. They handle authorization, nesting, binding and control of the data.
It's most basic actions are:
"getForm"
,
"getData"
,
"saveData"
.
You are free to define additional specialized actions, for instance for file upload and download, file generation and preparation, etc. For oversight is advisable to define any additional communication interfaces to outside environments here aswell.
Basic buildup of a DataProcessor:
<?php
require_once "../../../core/php/headers/dp.php";
if($action=="getForm") {
if(hasRole("user")) {
$myFormProcessor = new AX_FormProcessor();
$myFormProcessor->loadForm('../forms/Customer.xml');
$myFormProcessor->renderAsXML();
}
else {
exitJSONError("Missing rights");
}
}
if($action=="getData") {
if(hasRole("user")) {
$myCustomer = new Customer($data->id);
if($myCustomer->probeUTS($plUID,$plProps)) {
;
}
else {
$myCustomer->load();
$myCustomer->nestTasks();
$myCustomer->nestInvoices();
$myCustomer->prepare();
$myCustomer->addLock();
}
$myCustomer->renderAsJSON();
}
else {
exitJSONError("Missing rights");
}
}
if($action=="saveData") {
if(hasRole("user")) {
$myCustomer = new Customer($data->id);
$myCustomer->probeUTS($plUID,$plProps);
$myCustomer->overwriteWithData($data);
if($myCustomer->isValid()) {
$myCustomer->save();
$myCustomer->discardUTS();
}
$myCustomer->renderErrorStackAsJSON();
}
else {
exitJSONError("Missing rights");
}
}
if($action=="showLog") {
if(hasRole("user")) {
$myCompany = new Customer($data->id);
$myCompany->renderLogAsJSON();
}
else {
exitJSONError("Missing rights");
}
}
Typical DataProcessor handler:
-
$action=="getForm"
Provide the client with a rendered, dynamic version of the corresponding form.
-
$action=="getData"
A quick-start guide to all the basics you need to get up and running now. Vestibulum lacinia nibh vel porttitor lacinia.
-
$action=="saveData"
A quick-start guide to all the basics you need to get up and running now. Vestibulum lacinia nibh vel porttitor lacinia.
-
$action=="getPDF"
A quick-start guide to all the basics you need to get up and running now. Vestibulum lacinia nibh vel porttitor lacinia.
-
$action=="uploadImage"
A quick-start guide to all the basics you need to get up and running now. Vestibulum lacinia nibh vel porttitor lacinia.
-
$action=="showLog"
A quick-start guide to all the basics you need to get up and running now. Vestibulum lacinia nibh vel porttitor lacinia.