Upload
rtripault
View
668
Download
15
Embed Size (px)
Citation preview
● PHP controllers● Smarty template engine 3.0.4● PHP processors (and connectors)● ExtJS 3.4● The “gateway”, index.php
Used technologies to build the manager
The request service
modManagerRequest
● Sanitizes the request parameters● Sets some defaults if needed (action/namespace)● Fires some system events (OnHandleRequest,
OnManagerPageInit)● Delegates to the response service
The response service
modManagerResponse● Loads all namespaces data from cache● Validates the currently requested action● Checks for any modMenu entry (for user
permissions)● Tries to “translate” the current
action/namespace to a controller class name
Controller class name
● Your namespace as prefix● Your action file name (minus .class.php)● ManagerController suffix
AppIndexManagerController
Loading the controller
● $namespace_path / controllers / $manager_theme_name /
● $namespace_path / controllers / default /● $namespace_path / $manager_theme_name /● $namespace_path / default /
The controller
modManagerController● New instance● Receives merged $_GET & $_POST as
properties● initialize()● render()
modManagerController::render()
● Additional permission check● Fires OnBeforeManagerPageInit system event● prepareLanguage() (making use of
getLanguageTopics())● A bunch of paths generated to pull Smarty
templates from● Registers/loads required core ExtJS/CSS
assets
modManagerController::render()
● Checks for Form Customization rules● A bunch of non critical/relevant methods
executed● Fires OnManagerPageBeforeRender● Process()… your logic!
modManagerController::process()
● Returns an array (to be used as Smarty placeholders)
● Returns a non empty string (to be used as HTML content)
● Returns an empty string/array (to… do nothing with it)
modManagerController::render()
● loadCustomCssJs()● getPagetitle()● And now is somehow the end of your duty
inside the controller
Controller...finishing
● getHeader()● getTemplateFile()● getFooter()● Fires OnManagerPageAfterRender system
event● Finally returns the generated HTML string to the
response service
modManagerController::process()
● Load MODX parser● Parse our HTML string● Return our parsed content!
Javascript to the rescue
● Target our HTML content in the DOM● Inject it as an ExtJS component, inside ExtJS
layout (so Ext becomes aware of our content!)
Pull Request
https://github.com/modxcms/revolution/pull/12555
modParsedManagerController class will be part of Revo 2.5
A few things to consider
● You are in the mgr context (some snippets might need you to specify a context)
● You are in the mgr context (no resource, no cache… check getCache if needed)
● Check existing manager CSS to build consistent UI
● Create resources inside 'mgr' context ?