Presenter
abstract class Presenter extends Control implements IPresenter
Presenter component represents a webpage instance. It converts Request to Response.
Constants
| InvalidLinkSilent |
bad link handling Presenter::$invalidLinkMode |
| InvalidLinkWarning |
bad link handling Presenter::$invalidLinkMode |
| InvalidLinkException |
bad link handling Presenter::$invalidLinkMode |
| InvalidLinkTextual |
bad link handling Presenter::$invalidLinkMode |
| internal PresenterKey |
|
| internal SignalKey |
|
| internal ActionKey |
|
| internal FlashKey |
|
| internal DefaultAction |
|
| deprecated INVALID_LINK_SILENT |
|
| deprecated INVALID_LINK_WARNING |
|
| deprecated INVALID_LINK_EXCEPTION |
|
| deprecated INVALID_LINK_TEXTUAL |
|
| deprecated PRESENTER_KEY |
|
| deprecated SIGNAL_KEY |
|
| deprecated ACTION_KEY |
|
| deprecated FLASH_KEY |
|
| deprecated DEFAULT_ACTION |
|
Properties
| $invalidLinkMode | |||
| $onStartup | |||
| $onRender | |||
| $onShutdown | |||
| $autoCanonicalize | automatically call canonicalize() |
||
| $absoluteUrls | use absolute Urls or paths? |
||
| list<string> deprecated | $allowedMethods | ||
| string | $view | ||
| string|bool | $layout | ||
| Request read-only | $request | ||
| string read-only | $action | ||
| stdClass read-only | $payload | ||
| Session read-only | $session | ||
| User read-only | $user |
Methods
No description
No description
No description
Returns a name that uniquely identifies component.
Checks whether the current presenter belongs to the given module.
Checks whether the current request was forwarded from another presenter or action.
Called before action method. Override to run initialization common to all actions.
Called before the view is rendered. Override to set up common template variables.
Called after the view is rendered. Override for post-render processing.
This method will be called when CSRF is detected.
No description
Returns pair signal receiver and name.
Checks if the signal receiver is the given one.
Returns current action name.
Changes current action.
Switch from current action or render method to another.
Returns current view.
Returns current layout name.
No description
Finds template file name.
Finds layout template file name.
Formats layout template file names.
Formats view template file names.
Formats action method name.
Formats render view method name.
No description
No description
No description
Is AJAX request?
Sends AJAX payload to the output.
Sends JSON data to the output.
Correctly terminates presenter.
Forward to another presenter or action.
Redirect to another URL and ends presenter execution.
Returns the last created Request.
Returns the last created Request flag.
Conditional redirect to canonicalized URI.
Attempts to cache the sent entity by its last modification date.
No description
Invalid link handler. Descendant can override this method to change default behaviour.
Stores current request to session.
Restores request from session.
Descendant can override this method to return the names of custom persistent components.
Saves state information for all subcomponents to $this->globalState.
Permanently saves state information for all subcomponents to $this->globalState.
Pops parameters for specified component.
Checks if a flash session namespace exists.
Returns session namespace provided to pass temporary data between redirects.
No description
No description
No description
No description
No description
No description
No description
Details
at line 126
__construct()
No description
at line 131
final Request|null
getRequest()
No description
at line 140
final Presenter|null
getPresenter(bool $throw = true)
No description
at line 147
final Presenter|null
getPresenterIfExists()
deprecated
deprecated
No description
at line 154
final bool
hasPresenter()
deprecated
deprecated
No description
at line 163
string
getUniqueId()
Returns a name that uniquely identifies component.
at line 172
bool
isModuleCurrent(string $module)
Checks whether the current presenter belongs to the given module.
at line 182
bool
isForwarded()
Checks whether the current request was forwarded from another presenter or action.
at line 298
protected void
startup()
Called before action method. Override to run initialization common to all actions.
at line 308
protected void
beforeRender()
Called before the view is rendered. Override to set up common template variables.
at line 316
protected void
afterRender()
Called after the view is rendered. Override for post-render processing.
at line 324
protected void
shutdown(Response $response)
Called after the response is ready. Override for cleanup after request handling.
at line 332
void
detectedCsrf()
This method will be called when CSRF is detected.
at line 343
protected void
checkHttpMethod()
deprecated
deprecated
No description
at line 360
void
processSignal()
No description
at line 385
final array|null
getSignal()
Returns pair signal receiver and name.
at line 394
final bool
isSignalReceiver(Component|string $component, string|bool|null $signal = null)
Checks if the signal receiver is the given one.
at line 426
final string
getAction(bool $fullyQualified = false)
Returns current action name.
at line 437
void
changeAction(string $action)
Changes current action.
at line 447
never
switch(string $action)
Switch from current action or render method to another.
at line 456
final string
getView()
Returns current view.
at line 465
Presenter
setView(string $view)
Changes current view. Any name is allowed.
at line 476
final string|bool
getLayout()
Returns current layout name.
at line 485
Presenter
setLayout(string|bool $layout)
Changes or disables layout.
at line 496
void
sendTemplate(Template|null $template = null)
No description
at line 512
string
findTemplateFile()
Finds template file name.
at line 530
string|null
findLayoutTemplateFile()
| internal |
Finds layout template file name.
at line 556
array
formatLayoutTemplateFiles()
Formats layout template file names.
at line 593
array
formatTemplateFiles()
Formats view template file names.
at line 616
static string
formatActionMethod(string $action)
Formats action method name.
at line 625
static string
formatRenderMethod(string $view)
Formats render view method name.
at line 636
protected Template
createTemplate(string|null $class = null)
No description
at line 644
string|null
formatTemplateClass()
No description
at line 655
final stdClass
getPayload()
No description
at line 664
bool
isAjax()
Is AJAX request?
at line 679
void
sendPayload()
Sends AJAX payload to the output.
at line 690
void
sendJson(mixed $data)
Sends JSON data to the output.
at line 704
void
sendResponse(Response $response)
Sends response and terminates presenter.
at line 716
void
terminate()
Correctly terminates presenter.
at line 728
void
forward(Request $destination, array|mixed $args = [])
Forward to another presenter or action.
at line 747
void
redirectUrl(string $url, int|null $httpCode = null)
Redirect to another URL and ends presenter execution.
at line 767
final Request|null
getLastCreatedRequest()
| internal |
Returns the last created Request.
at line 777
final bool
getLastCreatedRequestFlag(string $flag)
| internal |
Returns the last created Request flag.
at line 788
void
canonicalize(string|null $destination = null, mixed ...$args)
Conditional redirect to canonicalized URI.
at line 825
void
lastModified(string|int|DateTimeInterface|null $lastModified, string|null $etag = null, string|null $expire = null)
Attempts to cache the sent entity by its last modification date.
at line 846
protected string|null
createRequest(Component $component, string $destination, array $args, string $mode)
deprecated
deprecated
No description
at line 856
static array
parseDestination(string $destination)
deprecated
deprecated
No description
at line 863
protected string
requestToUrl(Request $request, bool|null $relative = null)
deprecated
deprecated
No description
at line 873
protected string
handleInvalidLink(InvalidLinkException $e)
Invalid link handler. Descendant can override this method to change default behaviour.
at line 893
string
storeRequest(string $expiration = '+ 10 minutes')
Stores current request to session.
at line 909
void
restoreRequest(string $key)
Restores request from session.
at line 939
static array
getPersistentComponents()
Descendant can override this method to return the names of custom persistent components.
at line 950
array
getGlobalState(string|null $forClass = null)
Saves state information for all subcomponents to $this->globalState.
at line 1025
protected void
saveGlobalState()
Permanently saves state information for all subcomponents to $this->globalState.
at line 1103
final array
popGlobalParameters(string $id)
| internal |
Pops parameters for specified component.
at line 1126
bool
hasFlashSession()
Checks if a flash session namespace exists.
at line 1137
SessionSection
getFlashSession()
Returns session namespace provided to pass temporary data between redirects.
at line 1151
final void
injectPrimary(IRequest $httpRequest, IResponse $httpResponse, IPresenterFactory|null $presenterFactory = null, Router|null $router = null, Session|null $session = null, User|null $user = null, TemplateFactory|null $templateFactory = null)
No description
at line 1177
final IRequest
getHttpRequest()
No description
at line 1183
final IResponse
getHttpResponse()
No description
at line 1192
final SessionSection
getSession(string|null $namespace = null)
No description
at line 1204
final User
getUser()
No description
at line 1210
final TemplateFactory
getTemplateFactory()
No description
at line 1216
final protected LinkGenerator
getLinkGenerator()
No description