Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe BaseController
+ Graphe d'héritage de BaseController:

Fonctions membres publiques

 __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)
 

Fonctions membres publiques statiques

static addModelPath ($path, $prefix='')
 
static createFileName ($type, $parts=array())
 
static getInstance ($prefix, $config=array())
 

Fonctions membres protégées

 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)
 

Attributs protégés

 $basePath
 
 $default_view
 
 $doTask
 
 $message
 
 $messageType
 
 $methods
 
 $name
 
 $model_prefix
 
 $paths
 
 $redirect
 
 $task
 
 $taskMap
 
 $input
 
 $factory
 

Attributs protégés statiques

static $instance
 
static $views
 

Description détaillée

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

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $config = array(),
MVCFactoryInterface  $factory = null 
)

Constructor.

Paramètres
array$configAn 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$factoryThe factory.
Depuis
3.0

Références $config, $r, elseif, JDEBUG, name, et null.

Documentation des fonctions membres

◆ addModelPath()

static addModelPath (   $path,
  $prefix = '' 
)
static

Adds to the stack of model paths in LIFO order.

Paramètres
mixed$pathThe directory (string), or list of directories (array) to add.
string$prefixA prefix for models
Renvoie
void
Depuis
3.0

Références $path, et $prefix.

◆ addPath()

addPath (   $type,
  $path 
)
protected

Adds to the search path for templates and resources.

Paramètres
string$typeThe path type (e.g. 'model', 'view').
mixed$pathThe directory string or stream array to search.
Renvoie
A object to support chaining.
Depuis
3.0

Références $path, et $type.

◆ addViewPath()

addViewPath (   $path)

Add one or more view paths to the controller's stack, in LIFO order.

Paramètres
mixed$pathThe directory (string) or list of directories (array) to add.
Renvoie
This object to support chaining.
Depuis
3.0

Références $path.

◆ authorise()

authorise (   $task)

Authorisation check

Paramètres
string$taskThe 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$contextThe context for the session storage.
integer$idThe 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$methodThe request method in which to look for the token key.
boolean$redirectWhether 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$typeThe resource type to create the filename for.
array$partsAn 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$nameThe name of the model.
string$prefixOptional model prefix.
array$configConfiguration 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$nameThe name of the view.
string$prefixOptional prefix for the view class name.
string$typeThe type of view.
array$configConfiguration 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 (   $task)

Execute a task by triggering a method in the derived class.

Paramètres
string$taskThe 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$prefixThe prefix for the controller.
array$configAn 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$nameThe model name. Optional.
string$prefixThe class prefix. Optional.
array$configConfiguration 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()

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()

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()

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$nameThe view name. Optional, defaults to the controller name.
string$typeThe view type. Optional.
string$prefixThe class prefix. Optional.
array$configConfiguration 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$contextThe context for the session storage.
integer$idThe ID of the record to add to the edit list.
Renvoie
void
Depuis
3.0

Références $app, $context, $id, et JDEBUG.

◆ redirect()

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$methodThe 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$taskThe task.
string$methodThe 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$contextThe context for the session storage.
integer$idThe 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$textMessage to display on redirect.
string$typeMessage type. Optional, defaults to 'message'.
Renvoie
string Previous message
Depuis
3.0

Références $message, $text, et $type.

◆ setPath()

setPath (   $type,
  $path 
)
protected

Sets an entire array of search paths for resources.

Paramètres
string$typeThe type of path to set, typically 'view' or 'model'.
string$pathThe 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$urlURL to redirect to.
string$msgMessage to display on redirect. Optional, defaults to value set internally by controller, if any.
string$typeMessage 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()

unregisterTask (   $task)

Unregister (unmap) a task in the class.

Paramètres
string$taskThe task.
Renvoie
This object to support chaining.
Depuis
3.0

Références $task.

Documentation des champs

◆ $basePath

$basePath
protected

◆ $default_view

$default_view
protected

◆ $doTask

$doTask
protected

◆ $factory

$factory
protected

◆ $input

$input
protected

◆ $instance

$instance
staticprotected

◆ $message

$message
protected

◆ $messageType

$messageType
protected

◆ $methods

$methods
protected

◆ $model_prefix

$model_prefix
protected

◆ $name

$name
protected

◆ $paths

$paths
protected

◆ $redirect

$redirect
protected

◆ $task

$task
protected

◆ $taskMap

$taskMap
protected

◆ $views

$views
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :