Presenter
abstract class Presenter extends Control implements IPresenter
Presenter component represents a webpage instance. It converts Request to IResponse.
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
int | $invalidLinkMode | ||
$onStartup | |||
$onRender | |||
$onShutdown | |||
bool | $autoCanonicalize | ||
bool | $absoluteUrls | ||
string | $view | ||
string|bool | $layout | ||
Request read-only | $request | ||
string read-only | $action | ||
stdClass read-only | $payload | ||
Container read-only | $context | ||
Session read-only | $session | ||
User read-only | $user |
Methods
No description
No description
Returns self.
Returns the presenter where this component belongs to.
Returns a name that uniquely identifies component.
No description
No description
Common render method.
Common render method.
Checks authorization.
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
Is AJAX request?
Sends AJAX payload to the output.
Sends JSON data to the output.
Correctly terminates presenter.
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 139
__construct()
No description
at line 145
final Request|null
getRequest()
No description
at line 154
final Presenter|null
getPresenter()
Returns self.
at line 160
final Presenter|null
getPresenterIfExists()
Returns the presenter where this component belongs to.
at line 167
final bool
hasPresenter()
deprecated
deprecated
No description
at line 176
string
getUniqueId()
Returns a name that uniquely identifies component.
at line 182
bool
isModuleCurrent(string $module)
No description
at line 283
protected void
startup()
No description
at line 293
protected void
beforeRender()
Common render method.
at line 302
protected void
afterRender()
Common render method.
at line 310
protected void
shutdown(IResponse $response)
No description
at line 318
void
checkRequirements($element)
Checks authorization.
at line 334
void
detectedCsrf()
This method will be called when CSRF is detected.
at line 346
void
processSignal()
No description
at line 370
final array|null
getSignal()
Returns pair signal receiver and name.
at line 380
final bool
isSignalReceiver(Component|string $component, $signal = null)
Checks if the signal receiver is the given one.
at line 408
final string
getAction(bool $fullyQualified = false)
Returns current action name.
at line 419
void
changeAction(string $action)
Changes current action.
at line 428
final string
getView()
Returns current view.
at line 438
Presenter
setView(string $view)
Changes current view. Any name is allowed.
at line 449
final string|bool
getLayout()
Returns current layout name.
at line 460
Presenter
setLayout(string|bool $layout)
Changes or disables layout.
at line 471
void
sendTemplate()
No description
at line 497
string|null
findLayoutTemplateFile()
internal |
Finds layout template file name.
at line 520
array
formatLayoutTemplateFiles()
Formats layout template file names.
at line 544
array
formatTemplateFiles()
Formats view template file names.
at line 559
static string
formatActionMethod(string $action)
Formats action method name.
at line 568
static string
formatRenderMethod(string $view)
Formats render view method name.
at line 574
protected ITemplate
createTemplate()
No description
at line 583
final stdClass
getPayload()
No description
at line 592
bool
isAjax()
Is AJAX request?
at line 605
void
sendPayload()
Sends AJAX payload to the output.
at line 616
void
sendJson(mixed $data)
Sends JSON data to the output.
at line 629
void
sendResponse(IResponse $response)
Sends response and terminates presenter.
at line 640
void
terminate()
Correctly terminates presenter.
at line 652
void
forward(string|Request $destination, array|mixed $args = [])
Forward to another presenter or action.
at line 670
void
redirectUrl(string $url, int $httpCode = null)
Redirect to another URL and ends presenter execution.
at line 689
final Request|null
getLastCreatedRequest()
internal |
Returns the last created Request.
at line 699
final bool
getLastCreatedRequestFlag(string $flag)
internal |
Returns the last created Request flag.
at line 709
void
canonicalize(string $destination = null, array $args = [])
Conditional redirect to canonicalized URI.
at line 743
void
lastModified(string|int|DateTimeInterface $lastModified, string $etag = null, string $expire = null)
Attempts to cache the sent entity by its last modification date.
at line 763
final protected string|null
createRequest(Component $component, string $destination, array $args, string $mode)
internal |
Request/URL factory.
at line 932
static array
parseDestination(string $destination)
internal |
Parse destination in format "[//] [[[module:]presenter:]action | signal! | this] [?query] [#fragment]"
at line 954
protected string
requestToUrl(Request $request, bool $relative = null)
internal |
Converts Request to URL.
at line 989
static void
argsToParams(string $class, string $method, array $args, array $supplemental = [], array $missing = null)
internal |
Converts list of arguments to named parameters.
at line 1056
protected string
handleInvalidLink(InvalidLinkException $e)
Invalid link handler. Descendant can override this method to change default behaviour.
at line 1076
string
storeRequest(string $expiration = '+ 10 minutes')
Stores current request to session.
at line 1092
void
restoreRequest(string $key)
Restores request from session.
at line 1119
static array
getPersistentComponents()
Returns array of persistent components.
This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
at line 1134
protected array
getGlobalState(string $forClass = null)
Saves state information for all subcomponents to $this->globalState.
at line 1205
void
saveState(array $params, ComponentReflection $reflection = null)
Saves state informations for next request.
at line 1214
protected void
saveGlobalState()
Permanently saves state information for all subcomponents to $this->globalState.
at line 1286
final array
popGlobalParameters(string $id)
internal |
Pops parameters for specified component.
at line 1309
bool
hasFlashSession()
Checks if a flash session namespace exists.
at line 1320
SessionSection
getFlashSession()
Returns session namespace provided to pass temporary data between redirects.
at line 1333
final
injectPrimary(Container|null $context, IPresenterFactory|null $presenterFactory, Router|null $router, IRequest $httpRequest, IResponse $httpResponse, Session|null $session = null, User|null $user = null, ITemplateFactory|null $templateFactory = null)
No description
at line 1362
final Container
getContext()
deprecated
deprecated
Gets the context.
at line 1371
final IRequest
getHttpRequest()
No description
at line 1377
final IResponse
getHttpResponse()
No description
at line 1386
final Session|SessionSection
getSession(string $namespace = null)
No description
at line 1397
final User
getUser()
No description
at line 1406
final ITemplateFactory
getTemplateFactory()
No description