Документация по Joomla 1.7

Joomla.Platform\JControllerForm
libraries/joomla/application/component/controllerform.php at line 22

Class JControllerForm

JObject
└─JController
└─JControllerForm
All Known Subclasses:
Joomla.Administrator\AdminControllerProfile Joomla.Administrator\BannersControllerBanner Joomla.Administrator\BannersControllerClient Joomla.Administrator\CategoriesControllerCategory Joomla.Administrator\ContactControllerContact Joomla.Site\ContactControllerContact Joomla.Administrator\ContentControllerArticle Joomla.Site\ContentControllerArticle Joomla.Administrator\LanguagesControllerLanguage Joomla.Administrator\MenusControllerItem Joomla.Administrator\MenusControllerMenu Joomla.Administrator\MessagesControllerMessage Joomla.Administrator\ModulesControllerModule Joomla.Administrator\NewsfeedsControllerNewsfeed Joomla.Administrator\PluginsControllerPlugin Joomla.Administrator\RedirectControllerLink Joomla.Administrator\TemplatesControllerStyle Joomla.Administrator\UsersControllerGroup Joomla.Administrator\UsersControllerLevel Joomla.Administrator\UsersControllerUser Joomla.Administrator\WeblinksControllerWeblink Joomla.Site\WeblinksControllerWeblink

public class JControllerForm
extends JController

Controller tailored to suit most form-based admin operations.

Subpackage:
Application
Since:
11.1
Todo:
Add ability to set redirect manually to better cope with frontend usage.

Field Summary
protected string

$context

The context for storing internal data, e.g.

protected string

$option

The URL option for the component.

protected string

$text_prefix

The prefix to use with controller messages.

protected string

$view_item

The URL view item variable.

protected string

$view_list

The URL view list variable.

Fields inherited from Joomla.Platform\JController
_acoSection, _acoSectionValue, basePath, default_view, doTask, message, messageType, methods, model_prefix, name, paths, redirect, task, taskMap
Fields inherited from Joomla.Platform\JObject
_errors
Constructor Summary
JControllerForm

__construct(array config, mixed properties)

Constructor.

Method Summary
mixed

add()

Method to add a new record.

protected boolean

allowAdd(array data)

Method to check if you can add a new record.

protected boolean

allowEdit(array data, string key)

Method to check if you can add a new record.

protected boolean

allowSave(array data, string key)

Method to check if you can save a new or existing record.

boolean

batch(object model)

Method to run batch operations.

boolean

cancel(string key)

Method to cancel an edit.

boolean

edit(string key, string urlVar)

Method to edit an existing record.

object

getModel(string name, string prefix, array config)

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

protected string

getRedirectToItemAppend(integer recordId, string urlVar)

Gets the URL arguments to append to an item redirect.

protected string

getRedirectToListAppend()

Gets the URL arguments to append to a list redirect.

protected void

postSaveHook(JModel model, array validData)

Function that allows child controller access to model data after the data has been saved.

boolean

save(string key, string urlVar)

Method to save a record.

Methods inherited from Joomla.Platform\JController
__construct, addModelPath, addPath, addViewPath, authorise, authorize, checkEditId, createFileName, createModel, createView, display, execute, getInstance, getModel, getName, getTask, getTasks, getView, holdEditId, redirect, registerDefaultTask, registerTask, releaseEditId, setAccessControl, setMessage, setPath, setRedirect, unregisterTask
Methods inherited from Joomla.Platform\JObject
__construct, __toString, def, get, getError, getErrors, getProperties, set, setError, setProperties, toString

Field Detail

libraries/joomla/application/component/controllerform.php at line 30

context

protected string $context = false

The context for storing internal data, e.g. record.

Since:
11.1

libraries/joomla/application/component/controllerform.php at line 38

option

protected string $option

The URL option for the component.

Since:
11.1

libraries/joomla/application/component/controllerform.php at line 62

text_prefix

protected string $text_prefix

The prefix to use with controller messages.

Since:
11.1

libraries/joomla/application/component/controllerform.php at line 46

view_item

protected string $view_item

The URL view item variable.

Since:
11.1

libraries/joomla/application/component/controllerform.php at line 54

view_list

protected string $view_list

The URL view list variable.

Since:
11.1

Constructor Detail

libraries/joomla/application/component/controllerform.php at line 74

__construct

public JControllerForm __construct(array config, mixed properties)

Constructor.

Parameters:
config - An optional associative array of configuration settings.
Returns:
A JControllerForm object
See Also:
JController
Since:
11.1

Method Detail

libraries/joomla/application/component/controllerform.php at line 140

add

public mixed add()

Method to add a new record.

Returns:
True if the record can be added, a JError object if not.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 175

allowAdd

protected boolean allowAdd(array data)

Method to check if you can add a new record.

Extended classes can override this if necessary.

Parameters:
data - An array of input data.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 193

allowEdit

protected boolean allowEdit(array data, string key)

Method to check if you can add a new record.

Extended classes can override this if necessary.

Parameters:
data - An array of input data.
key - The name of the key for the primary key; default is id.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 209

allowSave

protected boolean allowSave(array data, string key)

Method to check if you can save a new or existing record.

Extended classes can override this if necessary.

Parameters:
data - An array of input data.
key - The name of the key for the primary key.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 229

batch

public boolean batch(object model)

Method to run batch operations.

Parameters:
model - The model of the component being processed.
Returns:
True if successful, false otherwise and internal error is set.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 256

cancel

public boolean cancel(string key)

Method to cancel an edit.

Parameters:
key - The name of the primary key of the URL variable.
Returns:
True if access level checks pass, false otherwise.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 315

edit

public boolean edit(string key, string urlVar)

Method to edit an existing record.

Parameters:
key - The name of the primary key of the URL variable.
urlVar - The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
Returns:
True if access level check and checkout passes, false otherwise.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 377

getModel

public object getModel(string name, string prefix, array config)

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

Parameters:
name - The model name. Optional.
prefix - The class prefix. Optional.
config - Configuration array for model. Optional.
Returns:
The model.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 395

getRedirectToItemAppend

protected string getRedirectToItemAppend(integer recordId, string urlVar)

Gets the URL arguments to append to an item redirect.

Parameters:
recordId - The primary key id for the item.
urlVar - The name of the URL variable for the id.
Returns:
The arguments to append to the redirect URL.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 424

getRedirectToListAppend

protected string getRedirectToListAppend()

Gets the URL arguments to append to a list redirect.

Returns:
The arguments to append to the redirect URL.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 447

postSaveHook

protected void postSaveHook(JModel model, array validData)

Function that allows child controller access to model data after the data has been saved.

Parameters:
model - The data model object.
validData - The validated data.
Since:
11.1

libraries/joomla/application/component/controllerform.php at line 460

save

public boolean save(string key, string urlVar)

Method to save a record.

Parameters:
key - The name of the primary key of the URL variable.
urlVar - The name of the URL variable if different from the primary key (sometimes required to avoid router collisions).
Returns:
True if successful, false otherwise.
Since:
11.1

Документация по Joomla 1.7