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 |
|
INVALID_LINK_SILENT |
|
INVALID_LINK_WARNING |
|
INVALID_LINK_EXCEPTION |
|
INVALID_LINK_TEXTUAL |
|
PRESENTER_KEY |
|
SIGNAL_KEY |
|
ACTION_KEY |
|
FLASH_KEY |
|
DEFAULT_ACTION |
|
Properties
$invalidLinkMode | |||
$onStartup | |||
$onRender | |||
$onShutdown | |||
$autoCanonicalize | automatically call canonicalize() |
||
$absoluteUrls | use absolute Urls or paths? |
||
$allowedMethods | |||
stdClass read-only | $payload |
Methods
No description
Returns self.
Returns the presenter where this component belongs to.
Returns a name that uniquely identifies component.
No description
No description
No description
Common render method.
Common render method.
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 117
final Request|null
getRequest()
No description
at line 126
final Presenter|null
getPresenter()
Returns self.
at line 132
final Presenter|null
getPresenterIfExists()
Returns the presenter where this component belongs to.
at line 139
final bool
hasPresenter()
deprecated
deprecated
No description
at line 148
string
getUniqueId()
Returns a name that uniquely identifies component.
at line 154
bool
isModuleCurrent(string $module)
No description
at line 161
bool
isForwarded()
No description
at line 276
protected void
startup()
No description
at line 286
protected void
beforeRender()
Common render method.
at line 294
protected void
afterRender()
Common render method.
at line 299
protected void
shutdown(Response $response)
No description
at line 307
void
detectedCsrf()
This method will be called when CSRF is detected.
at line 318
protected void
checkHttpMethod()
deprecated
deprecated
No description
at line 335
void
processSignal()
No description
at line 359
final array|null
getSignal()
Returns pair signal receiver and name.
at line 368
final bool
isSignalReceiver(Component|string $component, string|bool|null $signal = null)
Checks if the signal receiver is the given one.
at line 400
final string
getAction(bool $fullyQualified = false)
Returns current action name.
at line 411
void
changeAction(string $action)
Changes current action.
at line 421
never
switch(string $action)
Switch from current action or render method to another.
at line 430
final string
getView()
Returns current view.
at line 439
Presenter
setView(string $view)
Changes current view. Any name is allowed.
at line 450
final string|bool
getLayout()
Returns current layout name.
at line 459
Presenter
setLayout(string|bool $layout)
Changes or disables layout.
at line 469
never
sendTemplate(Template|null $template = null)
No description
at line 482
string
findTemplateFile()
Finds template file name.
at line 500
string|null
findLayoutTemplateFile()
internal |
Finds layout template file name.
at line 526
array
formatLayoutTemplateFiles()
Formats layout template file names.
at line 563
array
formatTemplateFiles()
Formats view template file names.
at line 586
static string
formatActionMethod(string $action)
Formats action method name.
at line 595
static string
formatRenderMethod(string $view)
Formats render view method name.
at line 601
protected Template
createTemplate(string|null $class = null)
No description
at line 608
string|null
formatTemplateClass()
No description
at line 619
final stdClass
getPayload()
No description
at line 628
bool
isAjax()
Is AJAX request?
at line 642
never
sendPayload()
Sends AJAX payload to the output.
at line 652
never
sendJson(mixed $data)
Sends JSON data to the output.
at line 665
never
sendResponse(Response $response)
Sends response and terminates presenter.
at line 676
never
terminate()
Correctly terminates presenter.
at line 687
never
forward(Request $destination, array|mixed $args = [])
Forward to another presenter or action.
at line 705
never
redirectUrl(string $url, int|null $httpCode = null)
Redirect to another URL and ends presenter execution.
at line 725
final Request|null
getLastCreatedRequest()
internal |
Returns the last created Request.
at line 735
final bool
getLastCreatedRequestFlag(string $flag)
internal |
Returns the last created Request flag.
at line 746
void
canonicalize(string|null $destination = null, mixed ...$args)
Conditional redirect to canonicalized URI.
at line 783
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 801
protected string|null
createRequest(Component $component, string $destination, array $args, string $mode)
internal |
No description
at line 809
static array
parseDestination(string $destination)
internal |
No description
at line 817
protected string
requestToUrl(Request $request, bool|null $relative = null)
internal |
No description
at line 828
protected string
processInvalidLink(InvalidLinkException $e)
Invalid link handler. Descendant can override this method to change default behaviour.
at line 848
string
storeRequest(string $expiration = '+ 10 minutes')
Stores current request to session.
at line 864
void
restoreRequest(string $key)
Restores request from session.
at line 893
static array
getPersistentComponents()
Descendant can override this method to return the names of custom persistent components.
at line 902
array
getGlobalState(string|null $forClass = null)
Saves state information for all subcomponents to $this->globalState.
at line 976
protected void
saveGlobalState()
Permanently saves state information for all subcomponents to $this->globalState.
at line 1052
final array
popGlobalParameters(string $id)
internal |
Pops parameters for specified component.
at line 1075
bool
hasFlashSession()
Checks if a flash session namespace exists.
at line 1086
SessionSection
getFlashSession()
Returns session namespace provided to pass temporary data between redirects.
at line 1100
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 1126
final IRequest
getHttpRequest()
No description
at line 1132
final IResponse
getHttpResponse()
No description
at line 1138
final SessionSection
getSession(string|null $namespace = null)
No description
at line 1150
final User
getUser()
No description
at line 1156
final TemplateFactory
getTemplateFactory()
No description
at line 1162
final protected LinkGenerator
getLinkGenerator()
No description