Posted by Scorpio Documentor (Writer), Documentation on 19 Nov 2009 @ 20:31
Scaffold provides a very rudimentary CRUD framework. This makes basic forms for creating, retriving, updating and deleting records of a particular object. It is similar to the Ruby on Rails scaffold system except you need to pass in the object to be scaffold'd. The passed object must be an instance of systemDaoInterface.
The scaffold will intelligently remove static and private methods and properties that can not be used. If methods return objects, this is checked in the template and the result is not displayed.
Note: this does NOT perform any validation or authentication it is intended for prototyping only or for quick and dirty data entry during development - it should NOT be used in a production environment.
Example usage:
// include system.inc and then in a web accessible folder use scaffold // e.g. with an existing systemDaoObject scaffold::getInstance(new systemUser(), $_REQUEST['action'])->launch();
The scaffold engine uses Smarty internally and the templates can be customised if you want. The HTML produced can be easily modified and it does not wrap in tags so any additional code can be added e.g. on an intranet.
It will only parse out and display properties that have get and set methods. All others, including anything that returns arrays or objects will be ignored.
public __construct($oObject, [$inAction = 'retrieve'])
Creates a new instance of scaffold
public static getInstance($oObject, [$inAction = 'retrieve'])
Returns a new instance of the scaffold and maintains a reference to the combination of scaffold and object
public getReflectionObject()
Returns a new reflection object
public getMethodsByRegExp($inRegExp, [$inIgnoreList = array()])
Returns an array of method names matching the supplied regExp and where the method is not in the ignore array. Static, private and protected methods are ignored
public isAllowedAction($inAction)
Returns true if action is in permitted actions
public getProperties([$inGetValues = false])
Returns an array of properties for the object, if $inGetValues is true, returns associative array including default values
public getGetMethods()
Returns the Get methods for the object
public getSetMethods()
Returns the Get methods for the object
public launch()
Handles requests into the class
public buildRequestVars()
Filters inbound request data and returns as a filtered array
public doVarAssignment()
Assigns request vars to the DaoObject
public buildHtml()
Builds the HTML from the current template and returns it as a string
public goHome()
Returns to the home page (retrieval page)
public doCreate()
Handles creating a record; if action is not DO_CREATE returns HTML
public doRetrieve()
Handles retrieving a record, returns HTML
public doUpdate()
Handles performing an update to the DAO object; if action is not DO_UPDATE returns HTML code
public doDelete()
Handles delete request; if action is not DO_DELETE returns HTML code
public getAction()
Returns the value of $_Action
public setAction($inAction)
Sets the value of $_Action to $inAction
public getModified()
Returns the value of $_Modified
public setModified([$inModified = true])
Sets the value of $_Modified to $inModified
public getDaoObject()
Returns the value of $_DaoObject
public setDaoObject($inDaoObject)
Sets the value of $_DaoObject to $inDaoObject
public getTemplate()
Returns the value of $_Template
public setTemplate($inTemplate)
Set $_Template to $inTemplate