PHP 클래스 FOF30\Controller\DataController

상속: extends Controller
파일 보기 프로젝트 열기: akeeba/fof 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$cacheParams false | array Variables that should be taken in account while working with the cache. You can set them in Controller constructor or inside onBefore* methods
$cacheableTasks array The tasks for which caching should be enabled by default
$defaultsForAdd array An indexed array of default values for the add task. Since the add task resets the model you can't set these values directly to the model. Instead, the defaultsForAdd values will be fed to model's bind() after it's reset and before the session-stored item data is bound to the model object.
$hasForm boolean Do we have a valid XML form?
$taskPrivileges array You can use the notation '@task' which means 'apply the same privileges as "task"'. If you create a reference back to yourself (e.g. 'mytask' => array('@mytask')) it will return TRUE.

공개 메소드들

메소드 설명
__construct ( Container $container, array $config = [] ) Public constructor of the Controller class. You can pass the following variables in the $config array, on top of what you already have in the base Controller class:
add ( ) : void Single record add. The form layout is used to present a blank page.
apply ( ) : void Save the incoming data and then return to the Edit task
archive ( ) : void Archive (set enabled = 2) an item.
browse ( ) : void Implements a default browse task, i.e. read a bunch of records and send them to the browser.
cancel ( ) : void Cancel the edit, check in the record and return to the Browse task
checkin ( ) : void Check in (unlock) items
copy ( ) : void Duplicates selected items
edit ( ) : void Single record edit. The ID set in the request is passed to the model, then the form layout is used to edit the result.
execute ( string $task ) : null | boolean Executes a given controller task. The onBefore and onAfter methods are called automatically if they exist.
forceRemove ( ) : void Deletes the selected item(s). Unlike remove() this method will force delete the record (completely removed from database)
getIDsFromRequest ( DataModel &$model, boolean $loadRecord = true ) : array Gets the list of IDs from the request data
getItemidURLSuffix ( ) : string Gets a URL suffix with the Itemid parameter. If it's not the front-end of the site, or if there is no Itemid set it returns an empty string.
getModel ( string $name = null, array $config = [] ) : DataModel Returns a named Model object. Makes sure that the Model is a database-aware model, throwing an exception otherwise, when $name is null.
getView ( string $name = null, array $config = [] ) : View Returns a named View object
loadhistory ( ) : boolean Method to load a row from version history
orderdown ( ) : void Moves selected items one position down the ordering list
orderup ( ) : void Moves selected items one position up the ordering list
publish ( ) : void Publish (set enabled = 1) an item.
read ( ) : void Single record read. The id set in the request is passed to the model and then the item layout is used to render the result.
remove ( ) : void Delete or trash selected item(s). The model's softDelete flag determines if the items should be trashed (enabled state changed to -2) or deleted (completely removed from database)
save ( ) : void Save the incoming data and then return to the Browse task
savenew ( ) : boolean Save the incoming data and then return to the Add task
saveorder ( ) : void Saves the order of the items
trash ( ) : void Trash (set enabled = -2) an item.
unpublish ( ) : void Unpublish (set enabled = 0) an item.

보호된 메소드들

메소드 설명
applySave ( ) : boolean Common method to handle apply and save tasks
checkACL ( string $area ) : boolean Checks if the current user has enough privileges for the requested ACL area. This overridden method supports asset tracking as well.
deleteOrTrash ( $forceDelete = false )
getACLForApplySave ( ) : boolean | string Gets the applicable ACL privilege for the apply and save tasks. The value returned is: - @add if the record's ID is empty / record doesn't exist - True if the ACL privilege of the edit task (@edit) is allowed - @editown if the owner of the record (field user_id, userid or user) is the same as the logged in user - False if the record is not owned by the logged in user and the user doesn't have the @edit privilege
getCrudTask ( ) : string Determines the CRUD task to use based on the view name and HTTP verb used in the request.
onAfterExecute ( string $task ) : boolean Deal with JSON format: no redirects needed

메소드 상세

__construct() 공개 메소드

taskPrivileges array ACL privileges for each task cacheableTasks array The cache-enabled tasks
public __construct ( Container $container, array $config = [] )
$container FOF30\Container\Container The application container
$config array The configuration array

add() 공개 메소드

Single record add. The form layout is used to present a blank page.
public add ( ) : void
리턴 void

apply() 공개 메소드

Save the incoming data and then return to the Edit task
public apply ( ) : void
리턴 void

applySave() 보호된 메소드

Common method to handle apply and save tasks
protected applySave ( ) : boolean
리턴 boolean True on success

archive() 공개 메소드

Archive (set enabled = 2) an item.
public archive ( ) : void
리턴 void

browse() 공개 메소드

Implements a default browse task, i.e. read a bunch of records and send them to the browser.
public browse ( ) : void
리턴 void

cancel() 공개 메소드

Cancel the edit, check in the record and return to the Browse task
public cancel ( ) : void
리턴 void

checkACL() 보호된 메소드

Checks if the current user has enough privileges for the requested ACL area. This overridden method supports asset tracking as well.
protected checkACL ( string $area ) : boolean
$area string The ACL area, e.g. core.manage
리턴 boolean True if the user has the ACL privilege specified

checkin() 공개 메소드

Check in (unlock) items
public checkin ( ) : void
리턴 void

copy() 공개 메소드

Duplicates selected items
public copy ( ) : void
리턴 void

deleteOrTrash() 보호된 메소드

protected deleteOrTrash ( $forceDelete = false )

edit() 공개 메소드

Single record edit. The ID set in the request is passed to the model, then the form layout is used to edit the result.
public edit ( ) : void
리턴 void

execute() 공개 메소드

If $task == 'default' we will determine the CRUD task to use based on the view name and HTTP verb in the request, overriding the routing.
public execute ( string $task ) : null | boolean
$task string The task to execute, e.g. "browse"
리턴 null | boolean False on execution failure

forceRemove() 공개 메소드

Deletes the selected item(s). Unlike remove() this method will force delete the record (completely removed from database)
public forceRemove ( ) : void
리턴 void

getACLForApplySave() 보호된 메소드

Gets the applicable ACL privilege for the apply and save tasks. The value returned is: - @add if the record's ID is empty / record doesn't exist - True if the ACL privilege of the edit task (@edit) is allowed - @editown if the owner of the record (field user_id, userid or user) is the same as the logged in user - False if the record is not owned by the logged in user and the user doesn't have the @edit privilege
protected getACLForApplySave ( ) : boolean | string
리턴 boolean | string

getCrudTask() 보호된 메소드

Determines the CRUD task to use based on the view name and HTTP verb used in the request.
protected getCrudTask ( ) : string
리턴 string The CRUD task (browse, read, edit, delete)

getIDsFromRequest() 공개 메소드

Gets the list of IDs from the request data
public getIDsFromRequest ( DataModel &$model, boolean $loadRecord = true ) : array
$model FOF30\Model\DataModel The model where the record will be loaded
$loadRecord boolean When true, the record matching the *first* ID found will be loaded into $model
리턴 array

getItemidURLSuffix() 공개 메소드

Gets a URL suffix with the Itemid parameter. If it's not the front-end of the site, or if there is no Itemid set it returns an empty string.
public getItemidURLSuffix ( ) : string
리턴 string The &Itemid=123 URL suffix, or an empty string if Itemid is not applicable

getModel() 공개 메소드

Returns a named Model object. Makes sure that the Model is a database-aware model, throwing an exception otherwise, when $name is null.
public getModel ( string $name = null, array $config = [] ) : DataModel
$name string The Model name. If null we'll use the modelName variable or, if it's empty, the same name as the Controller
$config array Configuration parameters to the Model. If skipped we will use $this->config
리턴 FOF30\Model\DataModel The instance of the Model known to this Controller

getView() 공개 메소드

Returns a named View object
public getView ( string $name = null, array $config = [] ) : View
$name string The Model name. If null we'll use the modelName variable or, if it's empty, the same name as the Controller
$config array Configuration parameters to the Model. If skipped we will use $this->config
리턴 FOF30\View\View The instance of the Model known to this Controller

loadhistory() 공개 메소드

Method to load a row from version history
부터: 2.2
public loadhistory ( ) : boolean
리턴 boolean True if the content history is reverted, false otherwise

onAfterExecute() 보호된 메소드

Deal with JSON format: no redirects needed
protected onAfterExecute ( string $task ) : boolean
$task string The task being executed
리턴 boolean True if everything went well

orderdown() 공개 메소드

Moves selected items one position down the ordering list
public orderdown ( ) : void
리턴 void

orderup() 공개 메소드

Moves selected items one position up the ordering list
public orderup ( ) : void
리턴 void

publish() 공개 메소드

Publish (set enabled = 1) an item.
public publish ( ) : void
리턴 void

read() 공개 메소드

Single record read. The id set in the request is passed to the model and then the item layout is used to render the result.
public read ( ) : void
리턴 void

remove() 공개 메소드

Delete or trash selected item(s). The model's softDelete flag determines if the items should be trashed (enabled state changed to -2) or deleted (completely removed from database)
public remove ( ) : void
리턴 void

save() 공개 메소드

Save the incoming data and then return to the Browse task
public save ( ) : void
리턴 void

savenew() 공개 메소드

Save the incoming data and then return to the Add task
public savenew ( ) : boolean
리턴 boolean

saveorder() 공개 메소드

Saves the order of the items
public saveorder ( ) : void
리턴 void

trash() 공개 메소드

Trash (set enabled = -2) an item.
public trash ( ) : void
리턴 void

unpublish() 공개 메소드

Unpublish (set enabled = 0) an item.
public unpublish ( ) : void
리턴 void

프로퍼티 상세

$cacheParams 보호되어 있는 프로퍼티

Variables that should be taken in account while working with the cache. You can set them in Controller constructor or inside onBefore* methods
protected false|array $cacheParams
리턴 false | array

$cacheableTasks 보호되어 있는 프로퍼티

The tasks for which caching should be enabled by default
protected array $cacheableTasks
리턴 array

$defaultsForAdd 보호되어 있는 프로퍼티

An indexed array of default values for the add task. Since the add task resets the model you can't set these values directly to the model. Instead, the defaultsForAdd values will be fed to model's bind() after it's reset and before the session-stored item data is bound to the model object.
protected array $defaultsForAdd
리턴 array

$hasForm 보호되어 있는 프로퍼티

Do we have a valid XML form?
protected bool $hasForm
리턴 boolean

$taskPrivileges 보호되어 있는 프로퍼티

You can use the notation '@task' which means 'apply the same privileges as "task"'. If you create a reference back to yourself (e.g. 'mytask' => array('@mytask')) it will return TRUE.
protected array $taskPrivileges
리턴 array