Presenter
abstract class Presenter extends Control implements IPresenter
Presenter component represents a webpage instance. It converts Request to Response.
Constants
INVALID_LINK_SILENT |
bad link handling Presenter::$invalidLinkMode |
INVALID_LINK_WARNING |
bad link handling Presenter::$invalidLinkMode |
INVALID_LINK_EXCEPTION |
bad link handling Presenter::$invalidLinkMode |
INVALID_LINK_TEXTUAL |
bad link handling Presenter::$invalidLinkMode |
internal PRESENTER_KEY |
|
internal SIGNAL_KEY |
|
internal ACTION_KEY |
|
internal FLASH_KEY |
|
internal DEFAULT_ACTION |
|
Properties
$invalidLinkMode | |||
$onStartup | |||
$onRender | |||
$onShutdown | |||
$autoCanonicalize | automatically call canonicalize() |
||
$absoluteUrls | use absolute Urls or paths? |
||
stdClass read-only | $payload |
Methods
No description
No description
Returns self.
Returns the presenter where this component belongs to.
No description
Returns a name that uniquely identifies component.
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.
Returns current view.
Returns current layout name.
No description
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.
Request/URL factory.
Parse destination in format "[//] [[[module:]presenter:]action | signal! | this] [?query] [#fragment]"
Converts list of arguments to named parameters.
Invalid link handler. Descendant can override this method to change default behaviour.
Stores current request to session.
Restores request from session.
Returns array of persistent components.
Saves state information for all subcomponents to $this->globalState.
Saves state informations for next request.
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
Details
at line 90
__construct()
No description
at line 96
final Request|null
getRequest()
No description
at line 105
final Presenter
getPresenter()
Returns self.
at line 111
final Presenter|null
getPresenterIfExists()
Returns the presenter where this component belongs to.
at line 117
final bool
hasPresenter()
No description
at line 126
string
getUniqueId()
Returns a name that uniquely identifies component.
at line 132
bool
isModuleCurrent(string $module)
No description
at line 230
protected void
startup()
No description
at line 240
protected void
beforeRender()
Common render method.
at line 248
protected void
afterRender()
Common render method.
at line 253
protected void
shutdown(Response $response)
No description
at line 261
void
detectedCsrf()
This method will be called when CSRF is detected.
at line 273
void
processSignal()
No description
at line 297
final array|null
getSignal()
Returns pair signal receiver and name.
at line 306
final bool
isSignalReceiver(Component|string $component, $signal = null)
Checks if the signal receiver is the given one.
at line 335
final string
getAction(bool $fullyQualified = false)
Returns current action name.
at line 346
void
changeAction(string $action)
Changes current action.
at line 355
final string
getView()
Returns current view.
at line 364
Presenter
setView(string $view)
Changes current view. Any name is allowed.
at line 374
final string|bool
getLayout()
Returns current layout name.
at line 383
Presenter
setLayout(string|bool $layout)
Changes or disables layout.
at line 394
void
sendTemplate(Template|null $template = null)
No description
at line 420
string|null
findLayoutTemplateFile()
internal |
Finds layout template file name.
at line 445
array
formatLayoutTemplateFiles()
Formats layout template file names.
at line 471
array
formatTemplateFiles()
Formats view template file names.
at line 486
static string
formatActionMethod(string $action)
Formats action method name.
at line 495
static string
formatRenderMethod(string $view)
Formats render view method name.
at line 501
protected Template
createTemplate(string|null $class = null)
No description
at line 508
string|null
formatTemplateClass()
No description
at line 519
final stdClass
getPayload()
No description
at line 528
bool
isAjax()
Is AJAX request?
at line 543
void
sendPayload()
Sends AJAX payload to the output.
at line 554
void
sendJson(mixed $data)
Sends JSON data to the output.
at line 568
void
sendResponse(Response $response)
Sends response and terminates presenter.
at line 580
void
terminate()
Correctly terminates presenter.
at line 592
void
forward(Request $destination, array|mixed $args = [])
Forward to another presenter or action.
at line 611
void
redirectUrl(string $url, int|null $httpCode = null)
Redirect to another URL and ends presenter execution.
at line 631
final Request|null
getLastCreatedRequest()
internal |
Returns the last created Request.
at line 641
final bool
getLastCreatedRequestFlag(string $flag)
internal |
Returns the last created Request flag.
at line 652
void
canonicalize(string|null $destination = null, mixed ...$args)
Conditional redirect to canonicalized URI.
at line 689
void
lastModified(string|int|DateTimeInterface $lastModified, string|null $etag = null, string|null $expire = null)
Attempts to cache the sent entity by its last modification date.
at line 712
protected string|null
createRequest(Component $component, string $destination, array $args, string $mode)
internal |
Request/URL factory.
at line 905
static array
parseDestination(string $destination)
internal |
Parse destination in format "[//] [[[module:]presenter:]action | signal! | this] [?query] [#fragment]"
at line 929
protected string
requestToUrl(Request $request, bool|null $relative = null)
internal |
Converts Request to URL.
at line 965
static void
argsToParams(string $class, string $method, array $args, array $supplemental = [], array|null $missing = null)
internal |
Converts list of arguments to named parameters.
at line 1033
protected string
handleInvalidLink(InvalidLinkException $e)
Invalid link handler. Descendant can override this method to change default behaviour.
at line 1053
string
storeRequest(string $expiration = '+ 10 minutes')
Stores current request to session.
at line 1069
void
restoreRequest(string $key)
Restores request from session.
at line 1097
static array
getPersistentComponents()
Returns array of persistent components.
This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
at line 1110
protected array
getGlobalState(string|null $forClass = null)
Saves state information for all subcomponents to $this->globalState.
at line 1185
void
saveState(array $params, ComponentReflection|null $reflection = null)
Saves state informations for next request.
at line 1194
protected void
saveGlobalState()
Permanently saves state information for all subcomponents to $this->globalState.
at line 1269
final array
popGlobalParameters(string $id)
internal |
Pops parameters for specified component.
at line 1292
bool
hasFlashSession()
Checks if a flash session namespace exists.
at line 1303
SessionSection
getFlashSession()
Returns session namespace provided to pass temporary data between redirects.
at line 1317
final
injectPrimary(IPresenterFactory|null $presenterFactory, Router|null $router, IRequest $httpRequest, IResponse $httpResponse, Session|null $session = null, User|null $user = null, TemplateFactory|null $templateFactory = null)
No description
at line 1340
final IRequest
getHttpRequest()
No description
at line 1346
final IResponse
getHttpResponse()
No description
at line 1352
final SessionSection
getSession(string|null $namespace = null)
No description
at line 1364
final User
getUser()
No description
at line 1374
final TemplateFactory
getTemplateFactory()
No description