JControllerAdmin
Extends \JControllerBase class for a Joomla Administrator Controller
Controller (controllers are where you put all the actual code) Provides basic functionality, such as rendering views (aka displaying templates).
package |
Joomla.Platform |
---|---|
subpackage |
Application |
since |
11.1 |
Methods
__construct
Class constructor, overridden in descendant classes.
__construct(mixed $properties = null)
since |
11.1 |
---|
Arguments
- $properties
mixed
Either and associative array or another object to set the initial properties of the object.
__toString
Magic method to convert the object to a string gracefully.
__toString() : string
since |
11.1 |
---|---|
deprecated |
12.3 Classes should provide their own __toString() implementation. |
Response
string
The classname.
addModelPath
Adds to the stack of model paths in LIFO order.
addModelPath(mixed $path, string $prefix = '') : void
Arguments
- $path
mixed
The directory (string), or list of directories (array) to add.- $prefix
string
A prefix for models
addPath
Adds to the search path for templates and resources.
addPath(string $type, mixed $path) : \JController
since |
11.1 |
---|---|
note |
Replaces _addPath. |
Arguments
- $type
string
The path type (e.g. 'model', 'view').- $path
mixed
The directory string or stream array to search.
Response
\JController
A JController object to support chaining.
addViewPath
Add one or more view paths to the controller's stack, in LIFO order.
addViewPath(mixed $path) : \JController
Arguments
- $path
mixed
The directory (string) or list of directories (array) to add.
Response
\JController
This object to support chaining.
authorise
Authorisation check
authorise(string $task) : boolean
since |
11.1 |
---|---|
deprecated |
12.3 |
Arguments
- $task
string
The ACO Section Value to check access on.
Response
boolean
True if authorised
authorize
Authorisation check
authorize(string $task) : boolean
since |
11.1 |
---|---|
deprecated |
12.1 Use JAuthorise |
Arguments
- $task
string
The ACO Section Value to check access on
Response
boolean
True if authorised
checkEditId
Method to check whether an ID is in the edit list.
checkEditId(string $context, integer $id) : boolean
since |
11.1 |
---|
Arguments
- $context
string
The context for the session storage.- $id
integer
The ID of the record to add to the edit list.
Response
boolean
True if the ID is in the edit list.
checkin
Check in of one or more records.
checkin() : boolean
since |
11.1 |
---|
Response
boolean
True on success
createFileName
Create the filename for a resource.
createFileName(string $type, array $parts = array()) : string
note |
Replaced _createFileName. |
---|---|
since |
11.1 |
Arguments
- $type
string
The resource type to create the filename for.- $parts
array
An associative array of filename information. Optional.
Response
string
The filename.
createModel
Method to load and return a model object.
createModel(string $name, string $prefix = '', array $config = array()) : mixed
since |
11.1 |
---|---|
note |
Replaces _createModel. |
Arguments
- $name
string
The name of the model.- $prefix
string
Optional model prefix.- $config
array
Configuration array for the model. Optional.
Response
mixed
Model object on success; otherwise null failure.
createView
Method to load and return a view object. This method first looks in the current template directory for a match and, failing that, uses a default set path to load the view class file.
createView(string $name, string $prefix = '', string $type = '', array $config = array()) : mixed
Note the "name, prefix, type" order of parameters, which differs from the "name, type, prefix" order used in related public methods.
since |
11.1 |
---|---|
note |
Replaces _createView. |
Arguments
- $name
string
The name of the view.- $prefix
string
Optional prefix for the view class name.- $type
string
The type of view.- $config
array
Configuration array for the view. Optional.
Response
mixed
View object on success; null or error result on failure.
def
Sets a default value if not alreay assigned
def(string $property, mixed $default = null) : mixed
since |
11.1 |
---|
Arguments
- $property
string
The name of the property.- $default
mixed
The default value.
Response
mixed
delete
Removes an item.
delete() : void
since |
11.1 |
---|
display
Typical view method for MVC based architecture
display(boolean $cachable = false, array $urlparams = false) : \JController
This function is provide as a default implementation, in most cases you will need to override it in your own controllers.
since |
11.1 |
---|
Arguments
- $cachable
boolean
If true, the view output will be cached- $urlparams
array
An array of safe url parameters and their variable types, for valid values see {@link JFilterInput::clean()}.
Response
\JController
A JController object to support chaining.
execute
Execute a task by triggering a method in the derived class.
execute(string $task) : mixed
since |
11.1 |
---|
Arguments
- $task
string
The task to perform. If no matching task is found, the '__default' task is executed, if defined.
Response
mixed
The value returned by the called method, false in error case.
get
Returns a property of the object or the default value if the property is not set.
get(string $property, mixed $default = null) : mixed
since |
11.1 |
---|---|
see | \JObject::getProperties() |
Arguments
- $property
string
The name of the property.- $default
mixed
The default value.
Response
mixed
The value of the property.
getError
Get the most recent error message.
getError(integer $i = null, boolean $toString = true) : string
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $i
integer
Option error index.- $toString
boolean
Indicates if JError objects should return their error message.
Response
string
Error message
getErrors
Return all errors, if any.
getErrors() : array
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Response
array
Array of error messages or JErrors.
getInstance
Method to get a singleton controller instance.
getInstance(string $prefix, array $config = array()) : \JController
since |
11.1 |
---|---|
throws |
|
Arguments
- $prefix
string
The prefix for the controller.- $config
array
An array of optional constructor options.
Response
getModel
Method to get a model object, loading it if required.
getModel(string $name = '', string $prefix = '', array $config = array()) : object
since |
11.1 |
---|
Arguments
- $name
string
The model name. Optional.- $prefix
string
The class prefix. Optional.- $config
array
Configuration array for model. Optional.
Response
object
The model.
getName
Method to get the controller name
getName() : string
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
since |
11.1 |
---|
Response
string
The name of the dispatcher
getProperties
Returns an associative array of object properties.
getProperties(boolean $public = true) : array
since |
11.1 |
---|---|
see | \JObject::get() |
Arguments
- $public
boolean
If true, returns only the public properties.
Response
array
getTask
Get the last task that is being performed or was most recently performed.
getTask() : string
since |
11.1 |
---|
Response
string
The task that is being performed or was most recently performed.
getTasks
Gets the available tasks in the controller.
getTasks() : array
since |
11.1 |
---|
Response
array
Array[i] of task names.
getView
Method to get a reference to the current view and load it if necessary.
getView(string $name = '', string $type = '', string $prefix = '', array $config = array()) : object
since |
11.1 |
---|
Arguments
- $name
string
The view name. Optional, defaults to the controller name.- $type
string
The view type. Optional.- $prefix
string
The class prefix. Optional.- $config
array
Configuration array for view. Optional.
Response
object
Reference to the view or an error.
holdEditId
Method to add a record ID to the edit list.
holdEditId(string $context, integer $id) : void
since |
11.1 |
---|
Arguments
- $context
string
The context for the session storage.- $id
integer
The ID of the record to add to the edit list.
publish
Method to publish a list of items
publish() : void
since |
11.1 |
---|
redirect
Redirects the browser or returns false if no redirect is set.
redirect() : boolean
since |
11.1 |
---|
Response
boolean
False if no redirect exists.
registerDefaultTask
Register the default task to perform if a mapping is not found.
registerDefaultTask(string $method) : \JController
since |
11.1 |
---|
Arguments
- $method
string
The name of the method in the derived class to perform if a named task is not found.
Response
\JController
A JController object to support chaining.
registerTask
Register (map) a task to a method in the class.
registerTask(string $task, string $method) : \JController
since |
11.1 |
---|
Arguments
- $task
string
The task.- $method
string
The name of the method in the derived class to perform for this task.
Response
\JController
A JController object to support chaining.
releaseEditId
Method to check whether an ID is in the edit list.
releaseEditId(string $context, integer $id) : void
since |
11.1 |
---|
Arguments
- $context
string
The context for the session storage.- $id
integer
The ID of the record to add to the edit list.
reorder
Changes the order of one or more records.
reorder() : boolean
since |
11.1 |
---|
Response
boolean
True on success
saveorder
Method to save the submitted ordering values for records.
saveorder() : boolean
since |
11.1 |
---|
Response
boolean
True on success
set
Modifies a property of the object, creating it if it does not already exist.
set(string $property, mixed $value = null) : mixed
since |
11.1 |
---|
Arguments
- $property
string
The name of the property.- $value
mixed
The value of the property to set.
Response
mixed
Previous value of the property.
setAccessControl
Sets the access control levels.
setAccessControl(string $section, string $value = null) : void
deprecated |
12.1 Use JAccess |
---|---|
see | \Jaccess |
since |
11.1 |
Arguments
- $section
string
The ACO section (eg, the component).- $value
string
The ACO section value (if using a constant value).
setError
Add an error message.
setError(string $error) : void
since |
11.1 |
---|---|
see | \JError |
deprecated |
12.3 JError has been deprecated |
Arguments
- $error
string
Error message.
setMessage
Sets the internal message that is passed with a redirect
setMessage(string $text, string $type = 'message') : string
since |
11.1 |
---|
Arguments
- $text
string
Message to display on redirect.- $type
string
Message type (since 11.1). Optional, defaults to 'message'.
Response
string
Previous message
setPath
Sets an entire array of search paths for resources.
setPath(string $type, string $path) : void
note |
Replaces _setPath. |
---|---|
since |
11.1 |
Arguments
- $type
string
The type of path to set, typically 'view' or 'model'.- $path
string
The new set of search paths. If null or false, resets to the current directory only.
setProperties
Set the object properties based on a named array/hash.
setProperties(mixed $properties) : boolean
since |
11.1 |
---|---|
see | \JObject::set() |
Arguments
- $properties
mixed
Either an associative array or another object.
Response
boolean
setRedirect
Set a URL for browser redirection.
setRedirect(string $url, string $msg = null, string $type = null) : \JController
since |
11.1 |
---|
Arguments
- $url
string
URL to redirect to.- $msg
string
Message to display on redirect. Optional, defaults to value set internally by controller, if any.- $type
string
Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage.
Response
\JController
This object to support chaining.
toString
Converts the object to a string (the class name).
toString() : string
unregisterTask
Unregister (unmap) a task in the class.
unregisterTask(string $task) : \JController
Properties
option
The URL option for the component.
since |
11.1 |
---|
Type(s)
string
text_prefix
The prefix to use with controller messages.
since |
11.1 |
---|
Type(s)
string
view_list
The URL view list variable.
since |
11.1 |
---|
Type(s)
string
_acoSection
ACO Section for the controller.
since |
11.1 |
---|---|
deprecated |
12.1 |
Type(s)
string
_acoSectionValue
Default ACO Section value for the controller.
since |
11.1 |
---|---|
deprecated |
12.1 |
Type(s)
string
basePath
The base path of the controller
since |
11.1 |
---|---|
note |
Replaces _basePath. |
Type(s)
string
default_view
The default view for the display method.
since |
11.1 |
---|
Type(s)
string
doTask
The mapped task that was performed.
since |
11.1 |
---|---|
note |
Replaces _doTask. |
Type(s)
string
message
Redirect message.
since |
11.1 |
---|---|
note |
Replaces _message. |
Type(s)
string
messageType
Redirect message type.
since |
11.1 |
---|---|
note |
Replaces _messageType. |
Type(s)
string
methods
Array of class methods
since |
11.1 |
---|---|
note |
Replaces _methods. |
Type(s)
array
name
The name of the controller
since |
11.1 |
---|---|
note |
Replaces _name. |
Type(s)
array
model_prefix
The prefix of the models
since |
11.1 |
---|
Type(s)
string
paths
The set of search directories for resources (views).
since |
11.1 |
---|---|
note |
Replaces _path. |
Type(s)
array
redirect
URL for redirection.
since |
11.1 |
---|---|
note |
Replaces _redirect. |
Type(s)
string
task
Current or most recently performed task.
since |
11.1 |
---|---|
note |
Replaces _task. |
Type(s)
string
taskMap
Array of class methods to call for a given task.
since |
11.1 |
---|---|
note |
Replaces _taskMap. |
Type(s)
array
_errors
An array of error messages or Exception objects.