|
| __construct ($config=array(), MVCFactoryInterface $factory=null) |
|
| addViewPath ($path) |
|
| authorise ($task) |
|
| execute ($task) |
|
| getModel ($name='', $prefix='', $config=array()) |
|
| getName () |
|
| getTask () |
|
| getTasks () |
|
| getView ($name='', $type='', $prefix='', $config=array()) |
|
| redirect () |
|
| registerDefaultTask ($method) |
|
| registerTask ($task, $method) |
|
| unregisterTask ($task) |
|
| setMessage ($text, $type='message') |
|
| checkToken ($method='post', $redirect=true) |
|
| setRedirect ($url, $msg=null, $type=null) |
|
|
| addPath ($type, $path) |
|
| checkEditId ($context, $id) |
|
| createModel ($name, $prefix='', $config=array()) |
|
| createView ($name, $prefix='', $type='', $config=array()) |
|
| holdEditId ($context, $id) |
|
| releaseEditId ($context, $id) |
|
| setPath ($type, $path) |
|
Base class for a Joomla Controller
Controller (Controllers are where you put all the actual code.) Provides basic functionality, such as rendering views (aka displaying templates).
- Depuis
- 2.5.5
◆ __construct()
Constructor.
- Paramètres
-
array | $config | An optional associative array of configuration settings. Recognized key values include 'name', 'default_task', 'model_path', and 'view_path' (this list is not meant to be comprehensive). |
MVCFactoryInterface | $factory | The factory. |
- Depuis
- 3.0
Références $config, $r, elseif, JDEBUG, name, et null.
◆ addModelPath()
static addModelPath |
( |
|
$path, |
|
|
|
$prefix = '' |
|
) |
| |
|
static |
Adds to the stack of model paths in LIFO order.
- Paramètres
-
mixed | $path | The directory (string), or list of directories (array) to add. |
string | $prefix | A prefix for models |
- Renvoie
- void
- Depuis
- 3.0
Références $path, et $prefix.
◆ addPath()
Adds to the search path for templates and resources.
- Paramètres
-
string | $type | The path type (e.g. 'model', 'view'). |
mixed | $path | The directory string or stream array to search. |
- Renvoie
- A object to support chaining.
- Depuis
- 3.0
Références $path, et $type.
◆ addViewPath()
Add one or more view paths to the controller's stack, in LIFO order.
- Paramètres
-
mixed | $path | The directory (string) or list of directories (array) to add. |
- Renvoie
- This object to support chaining.
- Depuis
- 3.0
Références $path.
◆ authorise()
Authorisation check
- Paramètres
-
string | $task | The ACO Section Value to check access on. |
- Renvoie
- boolean True if authorised
- Depuis
- 3.0
- Obsolète:
- 3.0 Use instead.
◆ checkEditId()
checkEditId |
( |
|
$context, |
|
|
|
$id |
|
) |
| |
|
protected |
Method to check whether an ID is in the edit list.
- Paramètres
-
string | $context | The context for the session storage. |
integer | $id | The ID of the record to add to the edit list. |
- Renvoie
- boolean True if the ID is in the edit list.
- Depuis
- 3.0
Références $context, $id, et JDEBUG.
◆ checkToken()
checkToken |
( |
|
$method = 'post' , |
|
|
|
$redirect = true |
|
) |
| |
Checks for a form token in the request.
Use in conjunction with ::_('form.token') or ::getFormToken.
- Paramètres
-
string | $method | The request method in which to look for the token key. |
boolean | $redirect | Whether to implicitly redirect user to the referrer page on failure or simply return false. |
- Renvoie
- boolean True if found and valid, otherwise return false or redirect to referrer page.
- Depuis
- 3.7.0
- Voir également
- ::checkToken()
Références $app.
◆ createFileName()
static createFileName |
( |
|
$type, |
|
|
|
$parts = array() |
|
) |
| |
|
static |
Create the filename for a resource.
- Paramètres
-
string | $type | The resource type to create the filename for. |
array | $parts | An associative array of filename information. Optional. |
- Renvoie
- string The filename.
- Depuis
- 3.0
Références $parts, et $type.
Référencé par LegacyFactory\createView().
◆ createModel()
createModel |
( |
|
$name, |
|
|
|
$prefix = '' , |
|
|
|
$config = array() |
|
) |
| |
|
protected |
Method to load and return a model object.
- Paramètres
-
string | $name | The name of the model. |
string | $prefix | Optional model prefix. |
array | $config | Configuration array for the model. Optional. |
- Renvoie
- |boolean Model object on success; otherwise false on failure.
- Depuis
- 3.0
Références $config, $name, $prefix, et null.
◆ createView()
createView |
( |
|
$name, |
|
|
|
$prefix = '' , |
|
|
|
$type = '' , |
|
|
|
$config = array() |
|
) |
| |
|
protected |
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.
Note the "name, prefix, type" order of parameters, which differs from the "name, type, prefix" order used in related public methods.
- Paramètres
-
string | $name | The name of the view. |
string | $prefix | Optional prefix for the view class name. |
string | $type | The type of view. |
array | $config | Configuration array for the view. Optional. |
- Renvoie
- |null View object on success; null or error result on failure.
- Depuis
- 3.0
- Exceptions
-
Références $config, $name, $prefix, et $type.
◆ execute()
Execute a task by triggering a method in the derived class.
- Paramètres
-
string | $task | The task to perform. If no matching task is found, the '__default' task is executed, if defined. |
- Renvoie
- mixed The value returned by the called method.
- Depuis
- 3.0
- Exceptions
-
Références $doTask, $task, elseif, et task.
◆ getInstance()
static getInstance |
( |
|
$prefix, |
|
|
|
$config = array() |
|
) |
| |
|
static |
Method to get a singleton controller instance.
- Paramètres
-
string | $prefix | The prefix for the controller. |
array | $config | An array of optional constructor options. |
- Renvoie
- Depuis
- 3.0
- Exceptions
-
Références $basePath, $class, $config, $file, $filter, $format, $input, $path, $prefix, $task, $type, et elseif.
◆ getModel()
getModel |
( |
|
$name = '' , |
|
|
|
$prefix = '' , |
|
|
|
$config = array() |
|
) |
| |
Method to get a model object, loading it if required.
- Paramètres
-
string | $name | The model name. Optional. |
string | $prefix | The class prefix. Optional. |
array | $config | Configuration array for model. Optional. |
- Renvoie
- |boolean Model object on success; otherwise false on failure.
- Depuis
- 3.0
Références $config, $item, $menu, $name, $params, $prefix, et task.
◆ getName()
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
- Renvoie
- string The name of the dispatcher
- Depuis
- 3.0
- Exceptions
-
Références $name, $r, name, et null.
◆ getTask()
Get the last task that is being performed or was most recently performed.
- Renvoie
- string The task that is being performed or was most recently performed.
- Depuis
- 3.0
Références $task.
◆ getTasks()
Gets the available tasks in the controller.
- Renvoie
- array Array[i] of task names.
- Depuis
- 3.0
◆ getView()
getView |
( |
|
$name = '' , |
|
|
|
$type = '' , |
|
|
|
$prefix = '' , |
|
|
|
$config = array() |
|
) |
| |
Method to get a reference to the current view and load it if necessary.
- Paramètres
-
string | $name | The view name. Optional, defaults to the controller name. |
string | $type | The view type. Optional. |
string | $prefix | The class prefix. Optional. |
array | $config | Configuration array for view. Optional. |
- Renvoie
- Reference to the view or an error.
- Depuis
- 3.0
- Exceptions
-
Références $config, $name, $prefix, $type, et $view.
◆ holdEditId()
holdEditId |
( |
|
$context, |
|
|
|
$id |
|
) |
| |
|
protected |
Method to add a record ID to the edit list.
- Paramètres
-
string | $context | The context for the session storage. |
integer | $id | The ID of the record to add to the edit list. |
- Renvoie
- void
- Depuis
- 3.0
Références $app, $context, $id, et JDEBUG.
◆ redirect()
Redirects the browser or returns false if no redirect is set.
- Renvoie
- boolean False if no redirect exists.
- Depuis
- 3.0
Références $app.
◆ registerDefaultTask()
registerDefaultTask |
( |
|
$method | ) |
|
Register the default task to perform if a mapping is not found.
- Paramètres
-
string | $method | The name of the method in the derived class to perform if a named task is not found. |
- Renvoie
- A object to support chaining.
- Depuis
- 3.0
◆ registerTask()
registerTask |
( |
|
$task, |
|
|
|
$method |
|
) |
| |
Register (map) a task to a method in the class.
- Paramètres
-
string | $task | The task. |
string | $method | The name of the method in the derived class to perform for this task. |
- Renvoie
- A object to support chaining.
- Depuis
- 3.0
Références $task.
◆ releaseEditId()
releaseEditId |
( |
|
$context, |
|
|
|
$id |
|
) |
| |
|
protected |
Method to check whether an ID is in the edit list.
- Paramètres
-
string | $context | The context for the session storage. |
integer | $id | The ID of the record to add to the edit list. |
- Renvoie
- void
- Depuis
- 3.0
Références $app, $context, $id, et JDEBUG.
◆ setMessage()
setMessage |
( |
|
$text, |
|
|
|
$type = 'message' |
|
) |
| |
Sets the internal message that is passed with a redirect
- Paramètres
-
string | $text | Message to display on redirect. |
string | $type | Message type. Optional, defaults to 'message'. |
- Renvoie
- string Previous message
- Depuis
- 3.0
Références $message, $text, et $type.
◆ setPath()
Sets an entire array of search paths for resources.
- Paramètres
-
string | $type | The type of path to set, typically 'view' or 'model'. |
string | $path | The new set of search paths. If null or false, resets to the current directory only. |
- Renvoie
- void
- Depuis
- 3.0
Références $path, et $type.
◆ setRedirect()
setRedirect |
( |
|
$url, |
|
|
|
$msg = null , |
|
|
|
$type = null |
|
) |
| |
Set a URL for browser redirection.
- Paramètres
-
string | $url | URL to redirect to. |
string | $msg | Message to display on redirect. Optional, defaults to value set internally by controller, if any. |
string | $type | Message type. Optional, defaults to 'message' or the type set by a previous call to setMessage. |
- Renvoie
- This object to support chaining.
- Depuis
- 3.0
Références $type, $url, et null.
◆ unregisterTask()
Unregister (unmap) a task in the class.
- Paramètres
-
- Renvoie
- This object to support chaining.
- Depuis
- 3.0
Références $task.
◆ $basePath
◆ $default_view
◆ $doTask
◆ $factory
◆ $input
◆ $instance
◆ $message
◆ $messageType
◆ $methods
◆ $model_prefix
◆ $name
◆ $paths
◆ $redirect
◆ $task
◆ $taskMap
◆ $views
La documentation de cette classe a été générée à partir du fichier suivant :