PreviewHandler
extends Handler
in package
Administration Handler adding support for record preview
Tags
Table of Contents
Properties
- $action : string|null
- $body : string|null
- $draw : array<string, int>
- $header : string
- $id : string|int|null
- $messages : array<string, string>
- $titles : array<string, string>
- $classForm : string
- $classTable : string
- $comment : array<string, string>
- $controller : Control
- $db : SQL
- $errors : array<string|int, string>
- $fileApi : FileApi
- $filters : Filters|null
- $infos : array<string|int, string>
- $log : Logger|null
- $nav : AdminNavigation
- $primary : Form
- $redirectUrl : string|null
- $sections : Sections
- $sync : Synchronize|null
- $user : UserSession
Methods
- __construct() : mixed
- action() : void
- Do demander action on controller
- actionCopy() : bool
- actionDefault() : bool
- actionDelete() : bool
- actionEdit() : bool
- ID checkout is latter for CacheUpload
- actionExport() : bool
- actionMultiple() : void
- Actions over multiple Records
- actionNew() : bool
- actionPreview() : void
- actionReset() : bool
- actionSync() : bool
- Publish new version
- actionView() : bool
- compile() : void
- Print module content
- getController() : Control
- Retuns controller
- getCss() : array<string, mixed>
- Get css for module
- getData() : array<string, mixed>|null
- Get specific data for ajax requests
- getErrors() : array<string|int, string>
- Return errors in forms
- getInfos() : array<string|int, string>
- Returns list of information type messages
- getPageHeader() : string
- Default header for administration
- getRedirectUrl() : string|null
- getScripts() : array<string, mixed>
- Get javascript from Controller
- getTitle() : string
- Page title
- handle() : void
- Perform given action in controller note: $this->id must be checked in Nette, it is not checked in action
- handleMultiple() : void
- Perform given action on multiple records
- handlePreview() : void
- Optionally update record data and preview the page
- handleTableMod() : void
- Perform given action from table
- initOutside() : mixed
- Start Control for outside usage (testing)
- injectSections() : void
- DI Sections
- renderAlert() : void
- Show alert dialog
- renderForm() : void
- Print form
- renderTable() : void
- setComment() : void
- Set comment
- appendPreviewBtn() : void
- Adds preview button to controller
- createFilters() : Filters
- createFrom() : FormControl
- createTable() : TableControl
- enableRecord() : void
- Allow access to current record and its parents
- fixDbQuirks() : void
- Fixes data to overcome some restriction on temporary tables
- formDelete() : bool
- Delete selected record
- formMultiCopy() : bool
- formMultiSave() : bool
- formReset() : bool
- Reset form values
- formSave() : bool
- Save POST data
- formSavePreview() : bool
- Insert/Update data into temporary table
- formSync() : bool
- getActionBack() : array<string, string>
- getFormActions() : array<string, array<string, string>>
- getMessage() : string
- Return readable text of error message
- getTableActions() : array<string, mixed>
- Adds preview button to table
- haveAccess() : bool
- Verify that the module has access to the row
- haveRights() : bool
- Check if active user has rights to the selected action
- init() : string|void
- Loads form for administration
- initStart() : bool
- log() : void
- Log action
- parseUrl() : void
- Parse parameters from split url
- prepare() : string|void
- Test if module can be run
- redirect() : void
- renderFormController() : void
- Print form controller
- showPreview() : void
- Show record preview
Properties
$action
public
string|null
$action
$body
public
string|null
$body
= null
$draw
public
array<string, int>
$draw
= ['body' => 1, 'head' => 1, 'alert' => 1, 'menu' => 1]
$header
public
string
$header
= ''
$id
public
string|int|null
$id
Url params - current record(s)
$messages
public
array<string, string>
$messages
= ['Record created' => 'Záznam vytvořen', 'Changes saved' => 'Změny uloženy', 'Non-existent record' => 'Neexistující záznam', 'No record selected' => 'Nebyl vybrán žádný záznam', 'Invalid action' => 'Nepovolená akce', 'Unknown action' => 'Neznámá akce', 'No rights to section' => 'K této sekci nemáte přístup', 'No access to record' => 'K tomuto záznamu nemáte přístup', 'No rights to action' => 'K této akci nemáte dostatečná práva']
$titles
public
array<string, string>
$titles
= ['TABLE' => 'Seznam', 'NEW' => 'Nový záznam', 'VIEW' => 'Detail záznamu', 'EDIT' => 'Editace záznamu', 'EDIT_MULTI' => 'Vícenásobná editace', 'COPY' => 'Klonování záznamu', 'COPY_MULTI' => 'Vícenásobné klonování', 'ERROR' => 'Chyba']
$classForm
protected
string
$classForm
= \Form\Controls\FormControl::class
$classTable
protected
string
$classTable
= \Form\Controls\TableControl::class
$comment
protected
array<string, string>
$comment
= []
$controller
protected
Control
$controller
$db
protected
SQL
$db
$errors
protected
array<string|int, string>
$errors
= []
$fileApi
protected
FileApi
$fileApi
$filters
protected
Filters|null
$filters
= null
$infos
protected
array<string|int, string>
$infos
= []
$log
protected
Logger|null
$log
$nav
protected
AdminNavigation
$nav
$primary
protected
Form
$primary
= null
$redirectUrl
protected
string|null
$redirectUrl
= null
$sections
protected
Sections
$sections
$sync
protected
Synchronize|null
$sync
= null
$user
protected
UserSession
$user
Methods
__construct()
public
__construct(SQL $db, AdminNavigation $nav, UserSession $user[, FileApi|null $fileApi = null ][, Logger|null $log = null ]) : mixed
Parameters
- $db : SQL
- $nav : AdminNavigation
- $user : UserSession
- $fileApi : FileApi|null = null
- $log : Logger|null = null
action()
Do demander action on controller
public
action() : void
actionCopy()
public
actionCopy() : bool
Tags
Return values
boolactionDefault()
public
actionDefault() : bool
Tags
Return values
boolactionDelete()
public
actionDelete() : bool
Tags
Return values
boolactionEdit()
ID checkout is latter for CacheUpload
public
actionEdit() : bool
Return values
boolactionExport()
public
actionExport() : bool
Tags
Return values
boolactionMultiple()
Actions over multiple Records
public
actionMultiple() : void
Tags
actionNew()
public
actionNew() : bool
Return values
boolactionPreview()
public
actionPreview() : void
actionReset()
public
actionReset() : bool
Tags
Return values
boolactionSync()
Publish new version
public
actionSync() : bool
Tags
Return values
boolactionView()
public
actionView() : bool
Tags
Return values
boolcompile()
Print module content
public
abstract compile() : void
getController()
Retuns controller
public
getController() : Control
Return values
ControlgetCss()
Get css for module
public
getCss() : array<string, mixed>
Return values
array<string, mixed>getData()
Get specific data for ajax requests
public
getData() : array<string, mixed>|null
Return values
array<string, mixed>|nullgetErrors()
Return errors in forms
public
getErrors() : array<string|int, string>
Return values
array<string|int, string>getInfos()
Returns list of information type messages
public
getInfos() : array<string|int, string>
Return values
array<string|int, string>getPageHeader()
Default header for administration
public
getPageHeader(string $name[, array<string|int, array<string, string>>|null $actions = null ][, string $extra = '' ]) : string
Parameters
- $name : string
- $actions : array<string|int, array<string, string>>|null = null
- $extra : string = ''
Return values
stringgetRedirectUrl()
public
getRedirectUrl() : string|null
Return values
string|nullgetScripts()
Get javascript from Controller
public
getScripts() : array<string, mixed>
Return values
array<string, mixed>getTitle()
Page title
public
getTitle([string $space = ' - ' ]) : string
Parameters
- $space : string = ' - '
Return values
stringhandle()
Perform given action in controller note: $this->id must be checked in Nette, it is not checked in action
public
handle() : void
handleMultiple()
Perform given action on multiple records
public
handleMultiple() : void
Tags
handlePreview()
Optionally update record data and preview the page
public
handlePreview() : void
handleTableMod()
Perform given action from table
public
handleTableMod() : void
Tags
initOutside()
Start Control for outside usage (testing)
public
initOutside([bool $formMode = true ]) : mixed
Parameters
- $formMode : bool = true
-
Start in edit mode
injectSections()
DI Sections
public
injectSections(Sections $sections) : void
Parameters
- $sections : Sections
renderAlert()
Show alert dialog
public
renderAlert(array<string|int, string|int>|string|int $ids, string $text, array<string, array<string, mixed>|string> $buttons) : void
Parameters
- $ids : array<string|int, string|int>|string|int
- $text : string
- $buttons : array<string, array<string, mixed>|string>
renderForm()
Print form
public
renderForm([string|null $title = null ][, array<string|int, string>|array<string|int, int>|string|int $ids = '' ][, array<string, mixed>|bool $back = true ]) : void
Parameters
- $title : string|null = null
- $ids : array<string|int, string>|array<string|int, int>|string|int = ''
- $back : array<string, mixed>|bool = true
renderTable()
public
renderTable() : void
setComment()
Set comment
public
setComment(string $comment[, string $place = 'TABLE' ]) : void
Parameters
- $comment : string
- $place : string = 'TABLE'
appendPreviewBtn()
Adds preview button to controller
protected
appendPreviewBtn() : void
createFilters()
protected
createFilters(bool $cookies) : Filters
Parameters
- $cookies : bool
Return values
FilterscreateFrom()
protected
createFrom() : FormControl
Tags
Return values
FormControlcreateTable()
protected
createTable([bool $cookies = true ]) : TableControl
Parameters
- $cookies : bool = true
Tags
Return values
TableControlenableRecord()
Allow access to current record and its parents
protected
enableRecord(int $id[, bool $createTemp = true ]) : void
Parameters
- $id : int
- $createTemp : bool = true
fixDbQuirks()
Fixes data to overcome some restriction on temporary tables
protected
fixDbQuirks(Form $form) : void
Parameters
- $form : Form
formDelete()
Delete selected record
protected
formDelete(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolformMultiCopy()
protected
formMultiCopy(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolformMultiSave()
protected
formMultiSave(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolformReset()
Reset form values
protected
formReset(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolformSave()
Save POST data
protected
formSave() : bool
Return values
boolformSavePreview()
Insert/Update data into temporary table
protected
formSavePreview() : bool
Return values
boolformSync()
protected
formSync(string|int $id) : bool
Parameters
- $id : string|int
Return values
boolgetActionBack()
protected
getActionBack(string $url) : array<string, string>
Parameters
- $url : string
Return values
array<string, string>getFormActions()
protected
getFormActions([array<string, mixed>|bool $back = true ]) : array<string, array<string, string>>
Parameters
- $back : array<string, mixed>|bool = true
Return values
array<string, array<string, string>>getMessage()
Return readable text of error message
protected
getMessage(string $message[, string|null $insert = null ]) : string
Parameters
- $message : string
- $insert : string|null = null
Return values
stringgetTableActions()
Adds preview button to table
protected
getTableActions() : array<string, mixed>
Return values
array<string, mixed>haveAccess()
Verify that the module has access to the row
protected
haveAccess(array<string|int, string>|array<string|int, int>|string|int $ids[, bool $exception = false ]) : bool
Parameters
- $ids : array<string|int, string>|array<string|int, int>|string|int
-
ID of primary row, can be array
- $exception : bool = false
-
throw exception
Tags
Return values
bool —can access
haveRights()
Check if active user has rights to the selected action
protected
haveRights(string $action[, bool $exception = false ]) : bool
Parameters
- $action : string
- $exception : bool = false
Tags
Return values
boolinit()
Loads form for administration
protected
init(Control $control) : string|void
Parameters
- $control : Control
Return values
string|voidinitStart()
protected
initStart(Control $controller) : bool
Parameters
- $controller : Control
Return values
boollog()
Log action
protected
log(string|null $action[, string|null $add = null ][, string|null $detail = null ]) : void
Parameters
- $action : string|null
- $add : string|null = null
- $detail : string|null = null
parseUrl()
Parse parameters from split url
protected
parseUrl(array<string|int, string> $param) : void
Parameters
- $param : array<string|int, string>
prepare()
Test if module can be run
protected
prepare() : string|void
Return values
string|voidredirect()
protected
redirect([string|bool $action = false ][, array<string, mixed> $params = null ]) : void
Parameters
- $action : string|bool = false
- $params : array<string, mixed> = null
renderFormController()
Print form controller
protected
renderFormController(array<string|int, string>|array<string|int, int>|string|int $ids) : void
Parameters
- $ids : array<string|int, string>|array<string|int, int>|string|int
showPreview()
Show record preview
protected
showPreview(int $id) : void
Parameters
- $id : int