Support Joomla!

Joomla! 1.5 Documentation

Packages

Package: Joomla-Framework

Developer Network License

The Joomla! Developer Network content is © copyright 2006 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution- NonCommercial- ShareAlike 2.5

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 $_doTask
Variable string $_error
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 ([ $cachable = false])
Method mixed|false execute (string $task)
Method string getError ()
Method object The &getModel (string $name, [string $prefix = ''])
Method string getTask ()
Method array getTasks ()
Method object Reference &getView ([string $name = ''], [string $type = ''], [string $prefix = ''])
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 setError (string $message)
Method void 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 115)

ACO Section for the controller.

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

Default ACO Section value for the controller.

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

The mapped task that was performed.

  • access: protected
string $_error (line 131)

An error message.

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

Redirect message.

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

Redirect message type.

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

Array of class methods

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

The name of the controller

  • access: protected
array $_path = array(
'model' => array(),'view'=>array())
(line 80)

The set of search directories for resources (views or models).

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

URL for redirection.

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

Current or most recent task to be performed.

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

Array of class methods to call for a given task.

  • access: protected
Methods
Constructor __construct (line 142)

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

Adds to the stack of controller 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 453)

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

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

Typical view method for MVC based architecture

void display ([ $cachable = false])
  • $cachable
execute (line 225)

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.
getError (line 497)

Get the error message.

  • return: The error message.
  • since: 1.5
string getError ()
getModel (line 341)

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

  • return: model.
  • since: 1.5
  • access: public
object The &getModel (string $name, [string $prefix = ''])
  • string $name: The model name.
  • string $prefix: The class prefix. Optional.
getTask (line 398)

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

Gets the available tasks in the controller.

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

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 = ''])
  • string $name: The view name. Optional, defaults to the controller name.
  • string $type: The view type. Optional.
  • string $prefix: The class prefix. Optional.
redirect (line 323)

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

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

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

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).
setError (line 507)

Set the error message.

  • return: The new error message.
  • since: 1.5
string setError (string $message)
  • string $message: The error message.
setMessage (line 517)

Sets the internal message that is passed with a redirect

void setMessage (string $text)
  • string $text: The message
setRedirect (line 533)

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

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

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::getPublicProperties()
 JObject::set()
 JObject::toString()

Documentation generated on Mon, 05 Mar 2007 20:55:43 +0000 by phpDocumentor 1.3.1