public static
FOFController
&
|
#
getAnInstance( string $option = null, string $view = null, array $config = array() )
Gets a static (Singleton) instance of a controller class. It loads the
relevant controller file from the component's directory or, if it doesn't exist,
creates a new controller object out of thin air.
Gets a static (Singleton) instance of a controller class. It loads the
relevant controller file from the component's directory or, if it doesn't exist,
creates a new controller object out of thin air.
Parameters
- $option
string - $option Component name, e.g. com_foobar
- $view
string - $view The view name, also used for the controller name
- $config
array - $config Configuration parameters
Returns
|
public static
FOFController
&
|
#
getTmpInstance( string $option = null, string $view = null, array $config = array() )
Gets a temporary instance of a controller object. A temporary instance is not
a Singleton and can be disposed off after use.
Gets a temporary instance of a controller object. A temporary instance is not
a Singleton and can be disposed off after use.
Parameters
- $option
string - $option The component name, e.g. com_foobar
- $view
string - $view The view name, e.g. cpanel
- $config
array - $config Configuration parameters
Returns
|
public
|
#
__construct( array $config = array() )
Public constructor of the Controller class
Public constructor of the Controller class
Parameters
- $config
array - $config Optional configuration parameters
Overrides
|
public static
|
#
addModelPath( mixed $path, string $prefix = '' )
Adds to the stack of model paths in LIFO order.
Adds to the stack of model paths in LIFO order.
Parameters
- $path
mixed - $path The directory (string) , or list of directories (array) to add.
- $prefix
string - $prefix A prefix for models
|
protected
FOFController
|
#
addPath( string $type, mixed $path )
Adds to the search path for templates and resources.
Adds to the search path for templates and resources.
Parameters
- $type
string - $type The path type (e.g. 'model', 'view').
- $path
mixed - $path The directory string or stream array to search.
Returns
|
public
FOFController
|
#
addViewPath( mixed $path )
Add one or more view paths to the controller's stack, in LIFO order.
Add one or more view paths to the controller's stack, in LIFO order.
Parameters
- $path
mixed - $path The directory (string) or list of directories (array) to add.
Returns
|
public
boolean
|
#
authorise( string $task )
Authorisation check
Deprecated
2.0 Use JAccess instead.
Parameters
- $task
string - $task The ACO Section Value to check access on.
Returns
boolean - True if authorised
|
protected static
string
|
#
createFileName( string $type, array $parts = array() )
Create the filename for a resource.
Create the filename for a resource.
Parameters
- $type
string - $type The resource type to create the filename for.
- $parts
array - $parts An associative array of filename information. Optional.
Returns
string - The filename.
|
public
null|boolean
|
#
execute( string $task )
Executes a given controller task. The onBefore<task> and
onAfter<task> methods are called automatically if they exist.
Executes a given controller task. The onBefore<task> and
onAfter<task> methods are called automatically if they exist.
Parameters
- $task
string - $task The task to execute, e.g. "browse"
Returns
null|boolean - False on execution failure
Throws
Exception
- Exception thrown if the onBefore<task> returns false
|
public
boolean
|
#
display( boolean $cachable = false, boolean $urlparams = false, string $tpl = null )
Default task. Assigns a model to the view and asks the view to render
itself.
Default task. Assigns a model to the view and asks the view to render
itself.
YOU MUST NOT USETHIS TASK DIRECTLY IN A URL. It is supposed to be used ONLY
inside your code. In the URL, use task=browse instead.
Parameters
- $cachable
boolean - $cachable Is this view cacheable?
- $urlparams
boolean - $urlparams Add your safe URL parameters (see further down in the code)
- $tpl
string - $tpl The name of the template file to parse
Returns
boolean
|
public
boolean
|
#
browse( )
Implements a default browse task, i.e. read a bunch of records and send them
to the browser.
Implements a default browse task, i.e. read a bunch of records and send them
to the browser.
Returns
boolean
|
public
boolean
|
#
read( )
Single record read. The id set in the request is passed to the model and then
the item layout is used to render the result.
Single record read. The id set in the request is passed to the model and then
the item layout is used to render the result.
Returns
boolean
|
public
false|
|
#
add( )
Single record add. The form layout is used to present a blank page.
Single record add. The form layout is used to present a blank page.
Returns
false|
|
public
boolean
|
#
edit( )
Single record edit. The ID set in the request is passed to the model, then
the form layout is used to edit the result.
Single record edit. The ID set in the request is passed to the model, then
the form layout is used to edit the result.
Returns
boolean
|
public
boolean
|
#
apply( )
Save the incoming data and then return to the Edit task
Save the incoming data and then return to the Edit task
Returns
boolean
|
public
boolean
|
#
copy( )
Duplicates selected items
Duplicates selected items
Returns
boolean
|
public
boolean
|
#
save( )
Save the incoming data and then return to the Browse task
Save the incoming data and then return to the Browse task
Returns
boolean
|
public
boolean
|
#
savenew( )
Save the incoming data and then return to the Add task
Save the incoming data and then return to the Add task
Returns
boolean
|
public
boolean
|
#
cancel( )
Cancel the edit, check in the record and return to the Browse task
Cancel the edit, check in the record and return to the Browse task
Returns
boolean
|
public
boolean
|
#
loadhistory( )
Method to load a row from version history
Method to load a row from version history
Returns
boolean - True if the content history is reverted, false otherwise
Since
2.2
|
public
boolean
|
#
accesspublic( )
Sets the access to public. Joomla! 1.5 compatibility.
Sets the access to public. Joomla! 1.5 compatibility.
Deprecated
since 2.0
Returns
boolean
|
public
boolean
|
#
accessregistered( )
Sets the access to registered. Joomla! 1.5 compatibility.
Sets the access to registered. Joomla! 1.5 compatibility.
Deprecated
since 2.0
Returns
boolean
|
public
boolean
|
#
accessspecial( )
Sets the access to special. Joomla! 1.5 compatibility.
Sets the access to special. Joomla! 1.5 compatibility.
Deprecated
since 2.0
Returns
boolean
|
public
boolean
|
#
publish( )
Publish (set enabled = 1) an item.
Publish (set enabled = 1) an item.
Returns
boolean
|
public
boolean
|
#
unpublish( )
Unpublish (set enabled = 0) an item.
Unpublish (set enabled = 0) an item.
Returns
boolean
|
public
boolean
|
#
archive( )
Archive (set enabled = 2) an item.
Archive (set enabled = 2) an item.
Returns
boolean
|
public
boolean
|
#
trash( )
Trash (set enabled = -2) an item.
Trash (set enabled = -2) an item.
Returns
boolean
|
public
boolean
|
#
saveorder( )
Saves the order of the items
Saves the order of the items
Returns
boolean
|
public
boolean
|
#
orderdown( )
Moves selected items one position down the ordering list
Moves selected items one position down the ordering list
Returns
boolean
|
public
boolean
|
#
orderup( )
Moves selected items one position up the ordering list
Moves selected items one position up the ordering list
Returns
boolean
|
public
boolean
|
#
remove( )
Delete selected item(s)
Returns
boolean
|
public
boolean
|
#
redirect( )
Redirects the browser or returns false if no redirect is set.
Redirects the browser or returns false if no redirect is set.
Returns
boolean - False if no redirect exists.
|
public
boolean
|
#
hasRedirect( )
Returns true if there is a redirect set in the controller
Returns true if there is a redirect set in the controller
Returns
boolean
|
public
FOFController
|
#
registerDefaultTask( string $method )
Register the default task to perform if a mapping is not found.
Register the default task to perform if a mapping is not found.
Parameters
- $method
string - $method The name of the method in the derived class to perform if a named task
is not found.
Returns
|
public
FOFController
|
#
registerTask( string $task, string $method )
Register (map) a task to a method in the class.
Register (map) a task to a method in the class.
Parameters
- $task
string - $task The task.
- $method
string - $method The name of the method in the derived class to perform for this task.
Returns
|
public
FOFController
|
#
unregisterTask( string $task )
Unregister (unmap) a task in the class.
Unregister (unmap) a task in the class.
Parameters
- $task
string - $task The task.
Returns
|
public
string
|
#
setMessage( string $text, string $type = 'message' )
Sets the internal message that is passed with a redirect
Sets the internal message that is passed with a redirect
Parameters
- $text
string - $text Message to display on redirect.
- $type
string - $type Message type. Optional, defaults to 'message'.
Returns
string - Previous message
|
protected
|
#
setPath( string $type, string $path )
Sets an entire array of search paths for resources.
Sets an entire array of search paths for resources.
Parameters
- $type
string - $type The type of path to set, typically 'view' or 'model'.
- $path
string - $path The new set of search paths. If null or false, resets to the current
directory only.
|
public
FOFController
|
#
setRedirect( string $url, string $msg = null, string $type = null )
Registers a redirection with an optional message. The redirection is carried
out when you use the redirect method.
Registers a redirection with an optional message. The redirection is carried
out when you use the redirect method.
Parameters
- $url
string - $url The URL to redirect to
- $msg
string - $msg The message to be pushed to the application
- $type
string - $type The message type to be pushed to the application, e.g. 'error'
Returns
|
protected
boolean
|
#
setstate( integer $state = 0 )
Sets the published state (the enabled field) of the selected item(s)
Sets the published state (the enabled field) of the selected item(s)
Parameters
- $state
integer - $state The desired state. 0 is unpublished, 1 is published.
Returns
boolean
|
protected
boolean
|
#
setaccess( integer $level = 0 )
Sets the access level of the selected item(s).
Sets the access level of the selected item(s).
Parameters
- $level
integer - $level The desired viewing access level ID
Returns
boolean
|
final public
FOFModel
|
#
getThisModel( array $config = array() )
Returns the default model associated with the current view
Returns the default model associated with the current view
Parameters
- $config
array - $config Configuration variables for the model
Returns
FOFModel
- The global instance of the model (singleton)
|
public
object
|
#
getModel( string $name = '', string $prefix = '', array $config = array() )
Method to get a model object, loading it if required.
Method to get a model object, loading it if required.
Parameters
- $name
string - $name The model name. Optional.
- $prefix
string - $prefix The class prefix. Optional.
- $config
array - $config Configuration array for model. Optional.
Returns
object - The model.
|
final public
FOFView
|
#
getThisView( array $config = array() )
Returns current view object
Returns current view object
Parameters
- $config
array - $config Configuration variables for the model
Returns
FOFView
- The global instance of the view object (singleton)
|
public
string
|
#
getName( )
Method to get the controller name
Method to get the controller name
The dispatcher name is set by default parsed using the classname, or it can
be set by passing a $config['name'] in the class constructor
Returns
string - The name of the dispatcher
Throws
|
public
string
|
#
getTask( )
Get the last task that is being performed or was most recently performed.
Get the last task that is being performed or was most recently performed.
Returns
string - The task that is being performed or was most recently performed.
|
public
array
|
#
getTasks( )
Gets the available tasks in the controller.
Gets the available tasks in the controller.
Returns
array - Array[i] of task names.
|
public
FOFView
|
#
getView( string $name = '', string $type = '', string $prefix = '', array $config = array() )
Method to get a reference to the current view and load it if necessary.
Method to get a reference to the current view and load it if necessary.
Parameters
- $name
string - $name The view name. Optional, defaults to the controller name.
- $type
string - $type The view type. Optional.
- $prefix
string - $prefix The class prefix. Optional.
- $config
array - $config Configuration array for view. Optional.
Returns
FOFView
- Reference to the view or an error.
Throws
|
protected
FOFModel
|
#
createModel( string $name, string $prefix = '', array $config = array() )
Creates a new model object
Creates a new model object
Parameters
- $name
string - $name The name of the model class, e.g. Items
- $prefix
string - $prefix The prefix of the model class, e.g. FoobarModel
- $config
array - $config The configuration parameters for the model class
Returns
|
protected
mixed
&
|
#
_createModel( string $name, string $prefix = '', array $config = array() )
Method to load and return a model object.
Method to load and return a model object.
Parameters
- $name
string - $name The name of the model.
- $prefix
string - $prefix Optional model prefix.
- $config
array - $config Configuration array for the model. Optional.
Returns
mixed - Model object on success; otherwise null
|
protected
FOFView
|
#
createView( string $name, string $prefix = '', string $type = '', array $config = array() )
Creates a View object instance and returns it
Creates a View object instance and returns it
Parameters
- $name
string - $name The name of the view, e.g. Items
- $prefix
string - $prefix The prefix of the view, e.g. FoobarView
- $type
string - $type The type of the view, usually one of Html, Raw, Json or Csv
- $config
array - $config The configuration variables to use for creating the view
Returns
|
protected
FOFView
&
|
#
_createView( string $name, string $prefix = '', string $type = '', array $config = array() )
Deprecated function to create a View object instance
Deprecated function to create a View object instance
Deprecated
since version 2.0
Parameters
- $name
string - $name The name of the view, e.g. 'Items'
- $prefix
string - $prefix The prefix of the view, e.g. 'FoobarView'
- $type
string - $type The view type, e.g. 'html'
- $config
array - $config The configuration array for the view
Returns
See
|
public
|
#
setThisViewName( string $viewName )
Set the name of the view to be used by this Controller
Set the name of the view to be used by this Controller
Parameters
- $viewName
string - $viewName The name of the view
|
public
|
#
setThisModelName( string $modelName )
Set the name of the model to be used by this Controller
Set the name of the model to be used by this Controller
Parameters
- $modelName
string - $modelName The name of the model
|
protected
boolean
|
#
checkACL( string $area )
Checks if the current user has enough privileges for the requested ACL
area.
Checks if the current user has enough privileges for the requested ACL
area.
Parameters
- $area
string - $area The ACL area, e.g. core.manage.
Returns
boolean - True if the user has the ACL privilege specified
|
protected
boolean
|
#
onBeforeGenericTask( string $task )
A catch-all method for all tasks without a corresponding onBefore method.
Applies the ACL preferences defined in fof.xml.
A catch-all method for all tasks without a corresponding onBefore method.
Applies the ACL preferences defined in fof.xml.
Parameters
- $task
string - $task The task being executed
Returns
boolean - True to allow execution of the task
|
protected
boolean
|
#
onBeforeApplySave( array & $data )
Execute something before applySave is called. Return false to prevent
applySave from executing.
Execute something before applySave is called. Return false to prevent
applySave from executing.
Parameters
- $data
array - &$data The data upon which applySave will act
Returns
boolean - True to allow applySave to run
|
protected
boolean
|
#
onAfterApplySave( )
Execute something after applySave has run.
Execute something after applySave has run.
Returns
boolean - True to allow normal return, false to cause a 403 error
|
protected
boolean
|
#
onBeforeAccesspublic( )
ACL check before changing the access level; override to customise
ACL check before changing the access level; override to customise
Returns
boolean - True to allow accesspublic() to run
|
protected
boolean
|
#
onBeforeAccessregistered( )
ACL check before changing the access level; override to customise
ACL check before changing the access level; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeAccessspecial( )
ACL check before changing the access level; override to customise
ACL check before changing the access level; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeAdd( )
ACL check before adding a new record; override to customise
ACL check before adding a new record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeApply( )
ACL check before saving a new/modified record; override to customise
ACL check before saving a new/modified record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeBrowse( )
ACL check before allowing someone to browse
ACL check before allowing someone to browse
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeCancel( )
ACL check before cancelling an edit
ACL check before cancelling an edit
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeEdit( )
ACL check before editing a record; override to customise
ACL check before editing a record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeOrderdown( )
ACL check before changing the ordering of a record; override to customise
ACL check before changing the ordering of a record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeOrderup( )
ACL check before changing the ordering of a record; override to customise
ACL check before changing the ordering of a record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforePublish( )
ACL check before changing the publish status of a record; override to
customise
ACL check before changing the publish status of a record; override to
customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeRemove( )
ACL check before removing a record; override to customise
ACL check before removing a record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeSave( )
ACL check before saving a new/modified record; override to customise
ACL check before saving a new/modified record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeSavenew( )
ACL check before saving a new/modified record; override to customise
ACL check before saving a new/modified record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeSaveorder( )
ACL check before changing the ordering of a record; override to customise
ACL check before changing the ordering of a record; override to customise
Returns
boolean - True to allow the method to run
|
protected
boolean
|
#
onBeforeUnpublish( )
ACL check before changing the publish status of a record; override to
customise
ACL check before changing the publish status of a record; override to
customise
Returns
boolean - True to allow the method to run
|
public
string
|
#
getItemidURLSuffix( )
Gets a URL suffix with the Itemid parameter. If it's not the front-end of the
site, or if there is no Itemid set it returns an empty string.
Gets a URL suffix with the Itemid parameter. If it's not the front-end of the
site, or if there is no Itemid set it returns an empty string.
Returns
string - The &Itemid=123 URL suffix, or an empty string if Itemid is not applicable
|
protected
boolean
|
#
_csrfProtection( )
Applies CSRF protection by means of a standard Joomla! token (nonce) check.
Raises a 403 Access Forbidden error through the platform if the check fails.
Applies CSRF protection by means of a standard Joomla! token (nonce) check.
Raises a 403 Access Forbidden error through the platform if the check fails.
TODO Move this check inside the platform
Returns
boolean - True if the CSRF check is successful
Throws
|
protected
integer
|
$autoRouting
|
#
Bit mask to enable Routing on redirects. 0 = never 1 = frontend only 2 =
backend only 3 = always
Bit mask to enable Routing on redirects. 0 = never 1 = frontend only 2 =
backend only 3 = always
|
protected
string
|
$bareComponent
|
#
The current component's name without the com_ prefix
The current component's name without the com_ prefix
|
protected
string
|
$basePath
|
#
The base path of the controller
The base path of the controller
|
protected
array
|
$cacheableTasks
|
#
The tasks for which caching should be enabled by default
The tasks for which caching should be enabled by default
|
protected
string
|
$component
|
#
The current component's name; you can override it in the configuration
The current component's name; you can override it in the configuration
|
protected
array
|
$config
|
#
A cached copy of the class configuration parameter passed during
initialisation
A cached copy of the class configuration parameter passed during
initialisation
|
protected
FOFConfigProvider
|
$configProvider
|
#
An instance of FOFConfigProvider to provision configuration overrides
An instance of FOFConfigProvider to provision configuration overrides
|
protected
integer
|
$csrfProtection
|
#
Set to true to enable CSRF protection on selected tasks. The possible values
are: 0 Disabled; no token checks are performed 1 Enabled; token checks are
always performed 2 Only on HTML requests and backend; token checks are always
performed in the back-end and in the front-end only when format is 'html' 3 Only
on back-end; token checks are performer only in the back-end
Set to true to enable CSRF protection on selected tasks. The possible values
are: 0 Disabled; no token checks are performed 1 Enabled; token checks are
always performed 2 Only on HTML requests and backend; token checks are always
performed in the back-end and in the front-end only when format is 'html' 3 Only
on back-end; token checks are performer only in the back-end
|
protected
string
|
$default_view
|
#
The default view for the display method.
The default view for the display method.
|
protected
string
|
$doTask
|
#
The mapped task that was performed.
The mapped task that was performed.
|
protected
FOFInput
|
$input
|
#
The input object for this MVC triad; you can override it in the
configuration
The input object for this MVC triad; you can override it in the
configuration
|
protected
string
|
$message
|
|
protected
string
|
$messageType
|
|
protected
string
|
$layout
|
#
The current layout; you can override it in the configuration
The current layout; you can override it in the configuration
|
protected
array
|
$methods
|
|
protected
string
|
$model_prefix
|
|
protected
string
|
$modelName
|
#
Overrides the name of the view's default model
Overrides the name of the view's default model
|
protected
array
|
$paths
|
#
The set of search directories for resources (views).
The set of search directories for resources (views).
|
protected
string
|
$redirect
|
|
protected
string
|
$task
|
#
Current or most recently performed task.
Current or most recently performed task.
|
protected
array
|
$taskMap
|
#
Array of class methods to call for a given task.
Array of class methods to call for a given task.
|
protected
array
|
$name
|
#
The name of the controller
The name of the controller
|
protected
string
|
$view
|
#
The current view name; you can override it in the configuration
The current view name; you can override it in the configuration
|
protected
string
|
$viewName
|
#
Overrides the name of the view's default view
Overrides the name of the view's default view
|
protected
array
|
$viewsCache
|
#
A cache for the view item objects created in this controller
A cache for the view item objects created in this controller
|
protected
boolean
|
$hasForm
|
#
Does this tried have a FOFForm which will be used to render it?
Does this tried have a FOFForm which will be used to render it?
|