Class JControllerLegacy

Description

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

  • since: 12.2

Located in /libraries/legacy/controller/legacy.php (line 22)

JObject
   |
   --JControllerLegacy
Direct descendents
Class Description
 class AdminController Admin Controller
 class BannersController Banners Controller
 class Tracks list controller class.
 class CacheController Cache Controller
 class CategoriesController Categories view class for the Category package.
 class CheckinController Checkin Controller
 class ConfigController Config Component Controller
 class ConfigControllerApplication Controller for global configuration
 class ConfigControllerComponent Note: this view is intended only to be opened in a popup
 class ContactController Contact Component Controller
 class ContentController Content Component Controller
 class ContenthistoryController Contenthistory Controller
 class ContenthistoryControllerPreview Contenthistory list controller class.
 class CpanelController Cpanel Controller
 class FinderController Finder Component Controller.
 class FinderControllerIndexer Indexer controller class for Finder.
 class InstallerController Installer Controller
 class InstallerControllerDatabase Installer Database Controller
 class InstallerControllerDiscover Discover Installation Controller
 class InstallerControllerInstall
 class InstallerControllerLanguages Languages Installer Controller
 class InstallerControllerManage Installer Manage Controller
 class InstallerControllerUpdate Installer Update Controller
 class JoomlaupdateController Joomla! Update Controller
 class JoomlaupdateControllerUpdate The Joomla! update controller for the Update view
 class LanguagesController Languages Controller
 class LanguagesControllerInstalled Languages Controller
 class LoginController Login Controller
 class MediaController Media Manager Component Controller
 class Media File Controller
 class MediaControllerFolder Folder Media Controller
 class MenusController Base controller class for Menu Manager.
 class MenusControllerMenus The Menu List Controller
 class MessagesController Messages master display controller.
 class MessagesControllerConfig Messages Component Message Model
 class ModulesController Modules manager master display controller.
 class NewsfeedsController Newsfeeds Component Controller
 class PluginsController Plugins master display controller.
 class RedirectController Redirect master display controller.
 class SearchController Search Component Controller
 class SearchControllerSearches Methods supporting a list of search terms.
 class TagsController Tags Component Controller
 class TemplatesController Templates manager master display controller.
 class TemplatesControllerTemplate Template style controller class.
 class UsersController Base controller class for Users.
 class UsersControllerMail Users mail controller.
 class WeblinksController Weblinks Component Controller
 class FinderControllerSuggestions Suggestions JSON controller for Finder.
 class MailtoController
 class TagsControllerTags The Tags List Controller
 class WrapperController Content Component Controller
 class JControllerAdmin Base class for a Joomla Administrator Controller
 class JControllerForm Controller tailored to suit most form-based admin operations.
Variable Summary
 string $basePath
 string $default_view
 string $doTask
 string $message
 string $messageType
 array $methods
 string $model_prefix
 array $name
 array $paths
 string $redirect
 string $task
 array $taskMap
Method Summary
 static void addModelPath (mixed $path, [string $prefix = ''])
 static string createFileName (string $type, [array $parts = array()])
 static JControllerLegacy getInstance (string $prefix, [array $config = array()])
 JControllerLegacy __construct ([array $config = array()])
 JControllerLegacy addPath (string $type, mixed $path)
 boolean authorise (string $task)
 boolean checkEditId (string $context, integer $id)
 mixed createModel (string $name, [string $prefix = ''], [array $config = array()])
 mixed createView (string $name, [string $prefix = ''], [string $type = ''], [array $config = array()])
 JControllerLegacy display ([boolean $cachable = false], [array $urlparams = array()])
 mixed execute (string $task)
 object The getModel ([string $name = ''], [string $prefix = ''], [array $config = array()])
 string getName ()
 string getTask ()
 array getTasks ()
 JViewLegacy getView ([string $name = ''], [string $type = ''], [string $prefix = ''], [array $config = array()])
 void holdEditId (string $context, integer $id)
 boolean redirect ()
 JControllerLegacy registerTask (string $task, string $method)
 void releaseEditId (string $context, integer $id)
 string setMessage (string $text, [string $type = 'message'])
 void setPath (string $type, string $path)
 JControllerLegacy setRedirect (string $url, [string $msg = null], [string $type = null])
Variables
static JControllerLegacy $instance (line 144)

Instance container.

  • since: 12.2
  • access: protected
string $basePath (line 31)

The base path of the controller

  • since: 12.2
  • access: protected
string $default_view (line 39)

The default view for the display method.

  • since: 12.2
  • access: protected

Redefined in descendants as:
string $doTask (line 48)

The mapped task that was performed.

  • since: 12.2
  • access: protected
JInput $input (line 136)

Hold a JInput object for easier access to the input variables.

  • since: 12.2
  • access: protected
string $message (line 57)

Redirect message.

  • since: 12.2
  • access: protected
string $messageType (line 66)

Redirect message type.

  • since: 12.2
  • access: protected
array $methods (line 75)

Array of class methods

  • since: 12.2
  • access: protected
string $model_prefix (line 92)

The prefix of the models

  • since: 12.2
  • access: protected
array $name (line 84)

The name of the controller

  • since: 12.2
  • access: protected
array $paths (line 101)

The set of search directories for resources (views).

  • since: 12.2
  • access: protected
string $redirect (line 110)

URL for redirection.

  • since: 12.2
  • access: protected
string $task (line 119)

Current or most recently performed task.

  • since: 12.2
  • access: protected
array $taskMap (line 128)

Array of class methods to call for a given task.

  • since: 12.2
  • access: protected

Inherited Variables

Inherited from JObject

JObject::$_errors
Methods
static addModelPath (line 154)

Adds to the stack of model paths in LIFO order.

  • access: public
static void addModelPath (mixed $path, [string $prefix = ''])
  • mixed $path: The directory (string), or list of directories (array) to add.
  • string $prefix: A prefix for models
static createFileName (line 170)

Create the filename for a resource.

  • return: The filename.
  • since: 12.2
  • access: protected
static string createFileName (string $type, [array $parts = array()])
  • string $type: The resource type to create the filename for.
  • array $parts: An associative array of filename information. Optional.
static getInstance (line 224)

Method to get a singleton controller instance.

  • throws: Exception if the controller cannot be loaded.
  • since: 12.2
  • access: public
static JControllerLegacy getInstance (string $prefix, [array $config = array()])
  • string $prefix: The prefix for the controller.
  • array $config: An array of optional constructor options.
Constructor __construct (line 319)

Constructor.

  • since: 12.2
  • access: public
JControllerLegacy __construct ([array $config = array()])
  • 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).

Redefinition of:
JObject::__construct()
Class constructor, overridden in descendant classes.

Redefined in descendants as:
addPath (line 448)

Adds to the search path for templates and resources.

  • return: A JControllerLegacy object to support chaining.
  • since: 12.2
  • access: protected
JControllerLegacy addPath (string $type, mixed $path)
  • string $type: The path type (e.g. 'model', 'view').
  • mixed $path: The directory string or stream array to search.
addViewPath (line 478)

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

  • return: This object to support chaining.
  • access: public
JControllerLegacy addViewPath (mixed $path)
  • mixed $path: The directory (string) or list of directories (array) to add.
authorise (line 495)

Authorisation check

  • return: True if authorised
  • deprecated: 13.3 Use JAccess instead.
  • since: 12.2
  • access: public
boolean authorise (string $task)
  • string $task: The ACO Section Value to check access on.
checkEditId (line 512)

Method to check whether an ID is in the edit list.

  • return: True if the ID is in the edit list.
  • since: 12.2
  • access: protected
boolean checkEditId (string $context, integer $id)
  • string $context: The context for the session storage.
  • integer $id: The ID of the record to add to the edit list.
createModel (line 557)

Method to load and return a model object.

  • return: Model object on success; otherwise null failure.
  • since: 12.2
  • access: protected
mixed createModel (string $name, [string $prefix = ''], [array $config = array()])
  • string $name: The name of the model.
  • string $prefix: Optional model prefix.
  • array $config: Configuration array for the model. Optional.
createView (line 587)

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.

  • return: View object on success; null or error result on failure.
  • since: 12.2
  • throws: Exception
  • access: protected
mixed createView (string $name, [string $prefix = ''], [string $type = ''], [array $config = array()])
  • 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.
display (line 633)

Typical view method for MVC based architecture

This function is provide as a default implementation, in most cases you will need to override it in your own controllers.

  • return: A JControllerLegacy object to support chaining.
  • since: 12.2
  • access: public
JControllerLegacy display ([boolean $cachable = false], [array $urlparams = array()])
  • boolean $cachable: If true, the view output will be cached
  • array $urlparams: An array of safe url parameters and their variable types, for valid values see JFilterInput::clean().

Redefined in descendants as:
execute (line 701)

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

  • return: The value returned by the called method, false in error case.
  • since: 12.2
  • throws: Exception
  • access: public
mixed execute (string $task)
  • string $task: The task to perform. If no matching task is found, the '__default' task is executed, if defined.
getModel (line 736)

Method to get a model object, loading it if required.

  • return: model.
  • since: 12.2
  • access: public
object The getModel ([string $name = ''], [string $prefix = ''], [array $config = array()])
  • string $name: The model name. Optional.
  • string $prefix: The class prefix. Optional.
  • array $config: Configuration array for model. Optional.

Redefined in descendants as:
getName (line 782)

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

  • return: The name of the dispatcher
  • since: 12.2
  • throws: Exception
  • access: public
string getName ()
getTask (line 804)

Get the last task that is being performed or was most recently performed.

  • return: The task that is being performed or was most recently performed.
  • since: 12.2
  • access: public
string getTask ()
getTasks (line 816)

Gets the available tasks in the controller.

  • return: Array[i] of task names.
  • since: 12.2
  • access: public
array getTasks ()
getView (line 834)

Method to get a reference to the current view and load it if necessary.

  • return: Reference to the view or an error.
  • since: 12.2
  • throws: Exception
  • access: public
JViewLegacy getView ([string $name = ''], [string $type = ''], [string $prefix = ''], [array $config = array()])
  • 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.
holdEditId (line 878)

Method to add a record ID to the edit list.

  • since: 12.2
  • access: protected
void holdEditId (string $context, integer $id)
  • string $context: The context for the session storage.
  • integer $id: The ID of the record to add to the edit list.
redirect (line 913)

Redirects the browser or returns false if no redirect is set.

  • return: False if no redirect exists.
  • since: 12.2
  • access: public
boolean redirect ()
registerDefaultTask (line 938)

Register the default task to perform if a mapping is not found.

  • return: A JControllerLegacy object to support chaining.
  • since: 12.2
  • access: public
JControllerLegacy registerDefaultTask (string $method)
  • string $method: The name of the method in the derived class to perform if a named task is not found.
registerTask (line 955)

Register (map) a task to a method in the class.

  • return: A JControllerLegacy object to support chaining.
  • since: 12.2
  • access: public
JControllerLegacy registerTask (string $task, string $method)
  • string $task: The task.
  • string $method: The name of the method in the derived class to perform for this task.
releaseEditId (line 991)

Method to check whether an ID is in the edit list.

  • since: 12.2
  • access: protected
void releaseEditId (string $context, integer $id)
  • string $context: The context for the session storage.
  • integer $id: The ID of the record to add to the edit list.
setMessage (line 1030)

Sets the internal message that is passed with a redirect

  • return: Previous message
  • since: 12.2
  • access: public
string setMessage (string $text, [string $type = 'message'])
  • string $text: Message to display on redirect.
  • string $type: Message type. Optional, defaults to 'message'.
setPath (line 1050)

Sets an entire array of search paths for resources.

  • since: 12.2
  • access: protected
void setPath (string $type, string $path)
  • 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.
setRedirect (line 1070)

Set a URL for browser redirection.

  • return: This object to support chaining.
  • since: 12.2
  • access: public
JControllerLegacy setRedirect (string $url, [string $msg = null], [string $type = null])
  • 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.
unregisterTask (line 974)

Unregister (unmap) a task in the class.

  • return: This object to support chaining.
  • since: 12.2
  • access: public
JControllerLegacy unregisterTask (string $task)
  • string $task: The task.

Inherited Methods

Inherited From JObject

 JObject::__construct()
 JObject::def()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::__toString()

Documentation generated on Tue, 19 Nov 2013 15:06:47 +0100 by phpDocumentor 1.4.3