UberBots Website Documentation
PHP Function Index - modHistory.php
The include file modHistory.php declares functions that are used in logging and restoring past states of modules and pages. Most functions declared here shouldn't be used in most applications of the OmniPage system.
Functions:
setVariables
setVariables - updates module variables in the moduleProps table
Description
boolean setVariables( int $pageId , int $instanceId , array $varaibles )
Updates module properties for pageId, instanceId to variables, using module history capabilities.
Parameters
- pageId
This integer is the page id of the page containing the module that is going to be updated. This can be found as:
$properties['pageid']. - instanceId
This integer is the instance id of the module being edited. This can be found as:
$properties['instanceId']. - variables
The function expects an array in this arguement. The function will insert a new value into the moduleProps table using the index of the array as the property name, and the key as the property value.
Return Values
This function will either return a true on successful completion or an error message if there was an error.
Notes
This function should be used whenever data is updated in the moduleProps table. Modules will call this function from their edit function to make the changes in the database. This function is good to use because it also utilizes module historty to archive the edit to be reviewed or restored at a later point.
Examples
$pId = $properties['pageId']; $iId = $properties['instanceId']; setVariables(mysql_real_escape_string($pId),mysql_real_escape_string($iId),$properties);This is part of the code in the edit function of a module. Page ID and Instance ID are set to variables (not really necessary), and are passed into the function as the first two arguements. The function will update all module properties for this module to those as defined in the properties array.
- pageId
getEditHistory
getEditHistory - returns table of all edits on a moduleDescription
string getEditHistory( int $pageId , int $instanceId )
Finds and returns all edits made to module instanceId on pageId
Parameters
- pageId
This integer is the ID of the page containing the module. This can be found as:
$properties['pageId'] - instanceId
This integer is the instance ID of the module. It can be found as:
$properties['instanceId']
Return Values
This function will return a HTML formatted string containing a table of edits made to the indicated module.
Notes
This function should only be used in low level source files. There shouldn't be a reason to use this file outside of its normal applications (in module history viewing and the control panel).
- pageId
getEditInfo
getEditInfo - returns the contents of an edit made to a module.Description
string getEditInfo( int $pageId, int $instanceId, int $editId )Returns the the module properties of a certain edit state (editId).
Parameters
- pageId
This is the ID for the page containing the module. This can be found as:
$properties['pageId']. - instanceId
This is the module's instance ID. It can be found as:
$properties['instanceId'] - editId
This is the edit ID, a numerical identifier for the edit being fetched.
Reuturn Values
This function returns a HTML formatted string containing a table of module properties at a givem edit point.
Notes
This function should only be used in low level source files. There shouldn't be a reason to use this file outside of its normal applications (in module history viewing and the control panel).
- pageId
restoreEdit
restoreEdit - restores a module to an edit stateDescription
string restoreEdit( int $pageId, int $instanceId, int $editId )
Restores module with instanceId on pageId to an edit state, as defined by editId.
Parameters
- pageId
This is the ID for the page containing the module. This can be found as:
$properties['pageId']. - instanceId
This is the module's instance ID. It can be found as:
$properties['instanceId'] - editId
This is the edit ID, a numerical identifier for the edit being fetched.
Return Values
This function will return a string that contains "Sucessfully restored module" on sucessful execution of the function. Otherwise, it will return the error.
Notes
This function should only be used in low level source files. There shouldn't be a reason to use this file outside of its normal applications (in module history viewing and the control panel).
- pageId
restorePage
restorePage - restores a deleted pageDescription
string restorePage( int $pageId )
If a page has been deleted, this function will update the database so that page is no longer deleted. The page to 'undelete' is identified by pageId.
Parameters
- pageId
This is the numerical identifier of the page to be 'undeleted'. If can found in a module as
$properties['pageId'].
Return Values
This function will return a string containing the text "Sucessfully restored page with ID pageId" on sucesful completion. Otherwise, it will output an error.
Notes
This function should only be used in low level source files. There shouldn't be a reason to use this file outside of its normal applications (in module history viewing and the control panel).
- pageId
pageHistory
pageHistory - returns a list of modules that have been on the page specified.Description
string pageHistory( int $pageId )
The function will output a list of all modules on a page with ID: pageId.
Parameters
- pageId
This is the numerical identifier of the page whose modules to show. If can found in a module as
$properties['pageId'].
Return Values
This function will return an HTML formatted string containing a list of modules that have been on the page specified with the ability to show their previous states. Additionally, if the page has been deleted, there will also be a button to restore the page.
Notes
This function should only be used in low level source files. There shouldn't be a reason to use this file outside of its normal applications (in module history viewing and the control panel).
- pageId