There are five main types of flows: Routed Page, Routed Do, Files, File Upload, and Scheduled Processes.
Routed Pages look like a normal link. When domain.com/contacts/123 is clicked:
- NGINX intercepts the Request and sends it to index.php.
- index.php loads init.php which loads Xanadu constants, classes, functions, and settings.
- index.php loads Aloe for PHP from Tim Dietrich. Aloe helps with Sessions Management, Request Handling, and Response Handling.
- index.php loads router.php.
- router.php examines the path components, the 'contacts' and '123' parts, of the link and directs the processing of content-0-page.php for Contacts.
- content-0-page.php directs the processing of content-1-cards which loads each specific card.
- Finally return reaches back to index.php which returns the Aloe Response.
Routed Do are Xanadu's way of calling functions without reloading the Page via AJAX. AJAX leverages Javascript to make a Request and wait for a Response all in the background. The flow is similar to a Routed Page except data or a portion of the page are returned rather than an entire page. One example is Printing. When someone clicks the Actions > Print PDF:
- XanDo function is called with parameters which immediately displays 'Printing PDF',
- XanDo runs in the background and is routed like the Routed Page except router.php routes to contacts-do.php which is a sub router specifically for processing Contacts functions.
- contacts-do.php examines the XanDo parameters and when it sees 'ContactsPrint', it processes do-contacts-print.php.
- do-contacts-print.php queries for the Contact Record, creates the html, and creates a PDF from the html which is saved into a temp folder and a link to the PDF is returned.
- XanDo sees that a URL was returned, opens a new tab/page and loads the URL to the PDF for the user.
File Downloads are accessed directly via a URL in either the 'bucket' or 'brief' directories. Files in Bucket would be like a Contact Photo. Files in Brief would have been created like when printing to PDF.
File Uploads are accessed directly via a URL. When a file is uploaded, it is moved to the Bucket specified sub directory like: domain.com/bucket/Contacts/123/PhotoFN/image.png and the File Name is stored on the Contact Record in the PhotoFN column.
Scheduled Processes are accessed directly via a URL to the php file. Files can be scheduled via crontab using curl to request the URL to the php file.