API17:JController
From Joomla! Documentation
(Difference between revisions)
(Bulk upload by Doxiki2) |
m (→User contributed notes: bad link repair) |
||
| (2 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
| + | =={{JVer|11.1}} JController== | ||
| + | ===Description=== | ||
| + | {{Description:JController}} | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[</nowiki>[[Description:JController|Edit Descripton]]<nowiki>]</nowiki> | <nowiki>[</nowiki>[[Description:JController|Edit Descripton]]<nowiki>]</nowiki> | ||
</span> | </span> | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
===Methods=== | ===Methods=== | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
|- | |- | ||
| + | !Visibility | ||
!Method name | !Method name | ||
!Description | !Description | ||
|- | |- | ||
| + | |public | ||
|[[JController::__construct/11.1|__construct]] | |[[JController::__construct/11.1|__construct]] | ||
|Constructor. | |Constructor. | ||
|- | |- | ||
| + | |public | ||
|[[JController::addViewPath/11.1|addViewPath]] | |[[JController::addViewPath/11.1|addViewPath]] | ||
|Add one or more view paths to the controller's stack, in LIFO order. | |Add one or more view paths to the controller's stack, in LIFO order. | ||
|- | |- | ||
| + | |public | ||
|[[JController::authorise/11.1|authorise]] | |[[JController::authorise/11.1|authorise]] | ||
|Authorisation check. | |Authorisation check. | ||
|- | |- | ||
| + | |public | ||
|[[JController::authorize/11.1|authorize]] | |[[JController::authorize/11.1|authorize]] | ||
|Authorisation check. | |Authorisation check. | ||
|- | |- | ||
| + | |public | ||
|[[JController::display/11.1|display]] | |[[JController::display/11.1|display]] | ||
|Typical view method for MVC based architecture. | |Typical view method for MVC based architecture. | ||
|- | |- | ||
| + | |public | ||
|[[JController::execute/11.1|execute]] | |[[JController::execute/11.1|execute]] | ||
|Execute a task by triggering a method in the derived class. | |Execute a task by triggering a method in the derived class. | ||
|- | |- | ||
| + | |public | ||
|[[JController::getModel/11.1|getModel]] | |[[JController::getModel/11.1|getModel]] | ||
|Method to get a model object, loading it if required. | |Method to get a model object, loading it if required. | ||
|- | |- | ||
| + | |public | ||
|[[JController::getName/11.1|getName]] | |[[JController::getName/11.1|getName]] | ||
|Method to get the controller name. | |Method to get the controller name. | ||
|- | |- | ||
| + | |public | ||
|[[JController::getTask/11.1|getTask]] | |[[JController::getTask/11.1|getTask]] | ||
|Get the last task that is being performed or was most recently performed. | |Get the last task that is being performed or was most recently performed. | ||
|- | |- | ||
| + | |public | ||
|[[JController::getTasks/11.1|getTasks]] | |[[JController::getTasks/11.1|getTasks]] | ||
|Gets the available tasks in the controller. | |Gets the available tasks in the controller. | ||
|- | |- | ||
| + | |public | ||
|[[JController::getView/11.1|getView]] | |[[JController::getView/11.1|getView]] | ||
|Method to get a reference to the current view and load it if necessary. | |Method to get a reference to the current view and load it if necessary. | ||
|- | |- | ||
| + | |public | ||
|[[JController::redirect/11.1|redirect]] | |[[JController::redirect/11.1|redirect]] | ||
|Redirects the browser or returns false if no redirect is set. | |Redirects the browser or returns false if no redirect is set. | ||
|- | |- | ||
| + | |public | ||
|[[JController::registerDefaultTask/11.1|registerDefaultTask]] | |[[JController::registerDefaultTask/11.1|registerDefaultTask]] | ||
|Register the default task to perform if a mapping is not found. | |Register the default task to perform if a mapping is not found. | ||
|- | |- | ||
| + | |public | ||
|[[JController::registerTask/11.1|registerTask]] | |[[JController::registerTask/11.1|registerTask]] | ||
|Register (map) a task to a method in the class. | |Register (map) a task to a method in the class. | ||
|- | |- | ||
| + | |public | ||
|[[JController::setAccessControl/11.1|setAccessControl]] | |[[JController::setAccessControl/11.1|setAccessControl]] | ||
|Sets the access control levels. | |Sets the access control levels. | ||
|- | |- | ||
| + | |public | ||
|[[JController::setMessage/11.1|setMessage]] | |[[JController::setMessage/11.1|setMessage]] | ||
|Sets the internal message that is passed with a redirect. | |Sets the internal message that is passed with a redirect. | ||
|- | |- | ||
| + | |public | ||
|[[JController::setRedirect/11.1|setRedirect]] | |[[JController::setRedirect/11.1|setRedirect]] | ||
|Set a URL for browser redirection. | |Set a URL for browser redirection. | ||
|- | |- | ||
| + | |public static | ||
|[[JController::addModelPath/11.1|addModelPath]] | |[[JController::addModelPath/11.1|addModelPath]] | ||
|Adds to the stack of model paths in LIFO order. | |Adds to the stack of model paths in LIFO order. | ||
|- | |- | ||
| + | |public static | ||
|[[JController::getInstance/11.1|getInstance]] | |[[JController::getInstance/11.1|getInstance]] | ||
|Method to get a singleton controller instance. | |Method to get a singleton controller instance. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::addPath/11.1|addPath]] | |[[JController::addPath/11.1|addPath]] | ||
|Adds to the search path for templates and resources. | |Adds to the search path for templates and resources. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::checkEditId/11.1|checkEditId]] | |[[JController::checkEditId/11.1|checkEditId]] | ||
|Method to check whether an ID is in the edit list. | |Method to check whether an ID is in the edit list. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::createModel/11.1|createModel]] | |[[JController::createModel/11.1|createModel]] | ||
|Method to load and return a model object. | |Method to load and return a model object. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::createView/11.1|createView]] | |[[JController::createView/11.1|createView]] | ||
|Method to load and return a view object. | |Method to load and return a view object. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::holdEditId/11.1|holdEditId]] | |[[JController::holdEditId/11.1|holdEditId]] | ||
|Method to add a record ID to the edit list. | |Method to add a record ID to the edit list. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::releaseEditId/11.1|releaseEditId]] | |[[JController::releaseEditId/11.1|releaseEditId]] | ||
|Method to check whether an ID is in the edit list. | |Method to check whether an ID is in the edit list. | ||
|- | |- | ||
| + | |protected | ||
|[[JController::setPath/11.1|setPath]] | |[[JController::setPath/11.1|setPath]] | ||
|Sets an entire array of search paths for resources. | |Sets an entire array of search paths for resources. | ||
|- | |- | ||
| + | |protected static | ||
|[[JController::createFileName/11.1|createFileName]] | |[[JController::createFileName/11.1|createFileName]] | ||
|Create the filename for a resource. | |Create the filename for a resource. | ||
|- | |- | ||
|} | |} | ||
| + | * '''Defined in''' libraries/joomla/application/component/controller.php | ||
| + | * '''Extends''' [[JObject/11.1|JObject]] | ||
| + | * '''Extended by''' | ||
| + | ** [[JControllerAdmin/11.1|JControllerAdmin]] | ||
| + | ** [[JControllerForm/11.1|JControllerForm]] | ||
===Importing=== | ===Importing=== | ||
<source lang="php">jimport( 'joomla.application.component.controller' );</source> | <source lang="php">jimport( 'joomla.application.component.controller' );</source> | ||
===See also=== | ===See also=== | ||
| − | * [[JController|Other versions of | + | * {{JVer|11.1}} '''JController source code''' on [[jplatform:application/component/controller.php|BitBucket]] |
| + | * {{JVer|11.1}} Subpackage [[Subpackage Application/11.1|Application]] | ||
| + | * [[JController|Other versions of JController]] | ||
{{SeeAlso:JController}} | {{SeeAlso:JController}} | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[</nowiki>[[SeeAlso:JController|Edit See Also]]<nowiki>]</nowiki> | <nowiki>[</nowiki>[[SeeAlso:JController|Edit See Also]]<nowiki>]</nowiki> | ||
</span> | </span> | ||
| − | === | + | ===User contributed notes=== |
<CodeExamplesForm /> | <CodeExamplesForm /> | ||
<dpl> | <dpl> | ||
| Line 117: | Line 145: | ||
category=ClassExample | category=ClassExample | ||
include=* | include=* | ||
| + | namespace=CodeExample | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
| − | <noinclude>[[Category:Platform]][[Category:Platform 11.1]][[Category:JController]]</noinclude> | + | <noinclude>[[Category:Platform JClasses]][[Category:Platform 11.1]][[Category:JController]]</noinclude> |
Revision as of 13:32, 29 August 2012
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
JController
Description
JController is an abstract class which provides the basic functionality for your own Controller classes which your create for your components. The Controller is part of Joomla's MVC Pattern. Learn how to develop a component using MVC
The Joomla MVC Design Pattern
Model-View-Controller (MVC) is a set of design patterns, that are used to separate the different layers of your application.
- The View displays the data of the model by passing it to a template. The view object can therefore access the data of the model. Joomla implements the basic functionality in the abstract JView class.
- The Model stores the data of the application, and contains the business logic. Joomla implements the basic functionality in the abstract JModel class.
- The Controller handles the user requests and evokes the model and the views to change it's state. Joomla implements the basic functionality in the JController class.
Methods
| Visibility | Method name | Description |
|---|---|---|
| public | __construct | Constructor. |
| public | addViewPath | Add one or more view paths to the controller's stack, in LIFO order. |
| public | authorise | Authorisation check. |
| public | authorize | Authorisation check. |
| public | display | Typical view method for MVC based architecture. |
| public | execute | Execute a task by triggering a method in the derived class. |
| public | getModel | Method to get a model object, loading it if required. |
| public | getName | Method to get the controller name. |
| public | getTask | Get the last task that is being performed or was most recently performed. |
| public | getTasks | Gets the available tasks in the controller. |
| public | getView | Method to get a reference to the current view and load it if necessary. |
| public | redirect | Redirects the browser or returns false if no redirect is set. |
| public | registerDefaultTask | Register the default task to perform if a mapping is not found. |
| public | registerTask | Register (map) a task to a method in the class. |
| public | setAccessControl | Sets the access control levels. |
| public | setMessage | Sets the internal message that is passed with a redirect. |
| public | setRedirect | Set a URL for browser redirection. |
| public static | addModelPath | Adds to the stack of model paths in LIFO order. |
| public static | getInstance | Method to get a singleton controller instance. |
| protected | addPath | Adds to the search path for templates and resources. |
| protected | checkEditId | Method to check whether an ID is in the edit list. |
| protected | createModel | Method to load and return a model object. |
| protected | createView | Method to load and return a view object. |
| protected | holdEditId | Method to add a record ID to the edit list. |
| protected | releaseEditId | Method to check whether an ID is in the edit list. |
| protected | setPath | Sets an entire array of search paths for resources. |
| protected static | createFileName | Create the filename for a resource. |
- Defined in libraries/joomla/application/component/controller.php
- Extends JObject
- Extended by
Importing
jimport( 'joomla.application.component.controller' );
See also
-
JController source code on BitBucket
-
Subpackage Application
- Other versions of JController
SeeAlso:JController [Edit See Also]
User contributed notes
<CodeExamplesForm />
