Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5. Some parts of this website may be subject to other licenses.

Abstract Class JController

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

Located in /joomla/application/component/controller.php (line 32)

Class JObject   (Subpackage Base)

Abstract class JController   (Subpackage Application)
Variable Summary
Variable string $_acoSection
Variable string $_basePath
Variable string $_doTask
Variable string $_message
Variable string $_messageType
Variable array $_methods
Variable array $_name
Variable array $_path
Variable string $_redirect
Variable string $_task
Variable array $_taskMap
Method Summary
Static method static void addModelPath (string|array $path)
Static method static void addViewPath (string|array $path)
Constructor JController __construct ([array $config = array()])
Method boolean authorize (string $task)
Method void display ([string $cachable = false])
Method mixed|false execute (string $task)
Method object The &getModel ([string $name = ''], [string $prefix = ''], [array $config = array()])
Method string getName ()
Method string getTask ()
Method array getTasks ()
Method object Reference &getView ([string $name = ''], [string $type = ''], [string $prefix = ''], [array $config = array()])
Method boolean redirect ()
Method void registerDefaultTask (string $method)
Method void registerTask (string $task, string $method)
Method void setAccessControl (string $section, [string $value = null])
Method string setMessage (string $text)
Method void setRedirect (string $url, [string $msg = null], [string $type = 'message'])
Method void _addPath (string $type, string|array $path)
Method void _setPath (string $type, string|array $path)
Variables
string $_acoSection = null (line 122)

ACO Section for the controller.

  • access: protected
string $_acoSectionValue = null (line 130)

Default ACO Section value for the controller.

  • access: protected
string $_basePath = null (line 40)

The base path of the controller

  • access: protected
string $_doTask = null (line 80)

The mapped task that was performed.

  • access: protected
string $_message = null (line 106)

Redirect message.

  • access: protected
string $_messageType = null (line 114)

Redirect message type.

  • access: protected
array $_methods = null (line 56)

Array of class methods

  • access: protected
array $_name = null (line 48)

The name of the controller

  • access: protected
array $_path = array(
'view' => array())
(line 88)

The set of search directories for resources (views).

  • access: protected
string $_redirect = null (line 98)

URL for redirection.

  • access: protected
string $_task = null (line 72)

Current or most recent task to be performed.

  • access: protected
array $_taskMap = null (line 64)

Array of class methods to call for a given task.

  • access: protected

Inherited Variables

Inherited from JObject

Variable JObject::$_errors
Methods
Constructor __construct (line 141)

Constructor.

  • since: 1.5
  • access: protected
JController __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.
addModelPath (line 382)

Adds to the stack of model paths in LIFO order.

void addModelPath (string|array $path)
  • string|array $path: The directory (string), or list of directories (array) to add.
addViewPath (line 489)

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

void addViewPath (string|array $path)
  • string|array $path: The directory (string), or list of directories (array) to add.
authorize (line 257)

Authorization check

  • return: True if authorized
  • since: 1.5
  • access: public
boolean authorize (string $task)
  • string $task: The ACO Section Value to check access on
display (line 288)

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.

  • since: 1.5
  • access: public
void display ([string $cachable = false])
  • string $cachable: If true, the view output will be cached
execute (line 220)

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

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

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

  • return: model.
  • since: 1.5
  • 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.
getName (line 421)

Method to get the controller name

The dispatcher name 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: 1.5
  • access: public
string getName ()
getTask (line 406)

Get the last task that is or was to be performed.

  • return: The task that was or is being performed.
  • since: 1.5
  • access: public
string getTask ()
getTasks (line 394)

Gets the available tasks in the controller.

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

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

  • return: to the view or an error.
  • since: 1.5
  • access: public
object Reference &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.
redirect (line 324)

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

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

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

  • since: 1.5
  • access: public
void 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 504)

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

  • since: 1.5
  • access: public
void 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.
setAccessControl (line 570)

Sets the access control levels.

  • since: 1.5
  • access: public
void setAccessControl (string $section, [string $value = null])
  • string $section: The ACO section (eg, the component).
  • string $value: The ACO section value (if using a constant value).
setMessage (line 533)

Sets the internal message that is passed with a redirect

  • return: Previous message
  • since: 1.5
  • access: public
string setMessage (string $text)
  • string $text: The message
setRedirect (line 551)

Set a URL for browser redirection.

  • since: 1.5
  • access: public
void setRedirect (string $url, [string $msg = null], [string $type = 'message'])
  • 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'.
_addPath (line 677)

Adds to the search path for templates and resources.

  • access: protected
void _addPath (string $type, string|array $path)
  • string $type: The path type (e.g. 'model', 'view'.
  • string|array $path: The directory or stream to search.
_setPath (line 660)

Sets an entire array of search paths for resources.

  • access: protected
void _setPath (string $type, string|array $path)
  • string $type: The type of path to set, typically 'view' or 'model'.
  • string|array $path: The new set of search paths. If null or false, resets to the current directory only.

Inherited Methods

Inherited From JObject

 JObject::JObject()
 JObject::__construct()
 JObject::get()
 JObject::getError()
 JObject::getErrors()
 JObject::getProperties()
 JObject::getPublicProperties()
 JObject::set()
 JObject::setError()
 JObject::setProperties()
 JObject::toString()

Documentation generated on Tue, 29 Jan 2008 18:45:13 +0000 by phpDocumentor 1.3.1