Class Presenter (namespace Nette\Application)
Presenter object represents a webpage instance. It executes all the logic for the request.
Object | --Component | --ComponentContainer | --PresenterComponent | --Control | --Presenter
Implements interfaces:
Public Method Summary | |
---|---|
string |
backlink
()
Link to myself.
|
void |
canonicalize
()
Conditional redirect to canonicalized URI.
|
void |
changeAction
(string $action)
Changes current action. Only alphanumeric characters are allowed.
|
array |
formatLayoutTemplateFiles
(string $presenter, string $layout)
Formats layout template file names.
|
array |
formatTemplateFiles
(string $presenter, string $view)
Formats view template file names.
|
void |
Forward to another presenter or action.
|
string |
getAction
([$fullyQualified =
FALSE ])
Returns current action name.
|
void |
|
Application |
|
SessionNamespace |
Returns session namespace provided to pass temporary data between redirects.
|
PresenterRequest |
Returns the last created PresenterRequest.
|
bool |
getLastCreatedRequestFlag
(string $flag)
Returns the last created PresenterRequest flag.
|
string|FALSE |
getLayout
()
Returns current layout name.
|
stdClass |
getPayload
()
|
static array |
Returns array of persistent components.
|
int |
getPhase
()
Returns current presenter life cycle phase.
|
Presenter |
getPresenter
([$need =
TRUE ])
Returns self.
|
PresenterRequest |
getRequest
()
|
array|NULL |
getSignal
()
Returns pair signal receiver and name.
|
string |
getUniqueId
()
Returns a name that uniquely identifies component.
|
string |
getView
()
Returns current view.
|
bool |
Checks if a flash session namespace exists.
|
bool |
isAjax
()
Is AJAX request?
|
bool |
isSignalReceiver
(mixed $component, [string $signal =
NULL ])
Checks if the signal receiver is the given one.
|
int |
Attempts to cache the sent entity by its last modification date
|
array |
popGlobalParams
(string $id)
Pops parameters for specified component.
|
void |
|
void |
redirectUri
(string $uri, [int $code =
NULL ])
Redirect to another URL and ends presenter execution.
|
IPresenterResponse |
run
(PresenterRequest $request)
|
void |
sendTemplate
()
|
Presenter |
setLayout
(string|FALSE $layout)
Changes or disables layout.
|
Presenter |
setView
(string $view)
Changes current view. Any name is allowed.
|
void |
Correctly terminates presenter.
|
Protected Method Summary | |
---|---|
protected void |
afterRender
()
Common render method.
|
protected void |
beforeRender
()
Common render method.
|
protected static string |
formatActionMethod
(string $action)
Formats action method name.
|
protected static string |
formatRenderMethod
(string $view)
Formats render view method name.
|
protected IHttpRequest |
|
protected IHttpResponse |
|
protected Session |
getSession
([$namespace =
NULL ])
|
protected User |
getUser
()
|
protected string |
Invalid link handler. Descendant can override this method to change default behaviour.
|
protected void |
|
protected void |
Permanently saves state information for all subcomponents to $this->globalState.
|
protected void |
sendPayload
()
Sends AJAX payload to the output.
|
protected void |
shutdown
(IPresenterResponse $response)
|
protected void |
startup
()
|
Methods Inherited From Control |
---|
createTemplate(), flashMessage(), getSnippetId(), getTemplate(), getWidget(), invalidateControl(), isControlInvalid(), templatePrepareFilters(), validateControl() |
Methods Inherited From ComponentContainer |
---|
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone() |
Methods Inherited From Component |
---|
__construct(), attached(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent(), __clone(), __wakeup() |
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
int | INVALID_LINK_EXCEPTION |
3 |
line 56 bad link handling Presenter::$invalidLinkMode |
int | INVALID_LINK_SILENT |
1 |
line 54 bad link handling Presenter::$invalidLinkMode |
int | INVALID_LINK_WARNING |
2 |
line 55 bad link handling Presenter::$invalidLinkMode |
int | PHASE_RENDER |
4 |
line 49 life cycle phases Presenter::getPhase() |
int | PHASE_SHUTDOWN |
5 |
line 50 life cycle phases Presenter::getPhase() |
int | PHASE_SIGNAL |
3 |
line 48 life cycle phases Presenter::getPhase() |
int | PHASE_STARTUP |
1 |
line 47 life cycle phases Presenter::getPhase() |
Variable Summary | ||||
---|---|---|---|---|
bool | $absoluteUrls | FALSE |
line 93 use absolute Urls or paths? |
|
bool | $autoCanonicalize | TRUE |
line 90 automatically call canonicalize() |
|
static string | $defaultAction | 'default' |
line 66 |
|
static int | $invalidLinkMode |
|
line 69 |
|
bool | $oldLayoutMode | TRUE |
line 75 (experimental) |
|
bool | $oldModuleMode | TRUE |
line 78 (experimental) |
|
array | $onShutdown |
|
line 72 of function(Presenter $sender, IPresenterResponse $response = NULL); Occurs when the presenter is shutting down |
Method Details | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 299 afterRenderprotected void afterRender () Common render method.
|
||||||||||||||||||||||||
line 738 backlinkpublic string backlink () Link to myself.
|
||||||||||||||||||||||||
line 289 beforeRenderprotected void beforeRender () Common render method.
|
||||||||||||||||||||||||
line 787 canonicalizepublic void canonicalize () Conditional redirect to canonicalized URI.
|
||||||||||||||||||||||||
line 406 changeActionpublic void changeAction (string $action) Changes current action. Only alphanumeric characters are allowed.
|
||||||||||||||||||||||||
line 607 formatActionMethodprotected static string formatActionMethod (string $action) Formats action method name.
|
||||||||||||||||||||||||
line 527 formatLayoutTemplateFilespublic array formatLayoutTemplateFiles (string $presenter, string $layout) Formats layout template file names.
|
||||||||||||||||||||||||
line 619 formatRenderMethodprotected static string formatRenderMethod (string $view) Formats render view method name.
|
||||||||||||||||||||||||
line 571 formatTemplateFilespublic array formatTemplateFiles (string $presenter, string $view) Formats view template file names.
|
||||||||||||||||||||||||
line 697 forwardpublic void forward (string|PresenterRequest $destination, [array|mixed $args = Forward to another presenter or action.
|
||||||||||||||||||||||||
line 394 getActionpublic string getAction ([$fullyQualified = Returns current action name.
|
||||||||||||||||||||||||
line 679 getAjaxDriverpublic void getAjaxDriver ()
|
||||||||||||||||||||||||
line 1353 getApplicationpublic Application getApplication ()
|
||||||||||||||||||||||||
line 1316 getFlashSessionpublic SessionNamespace getFlashSession () Returns session namespace provided to pass temporary data between redirects.
|
||||||||||||||||||||||||
line 1333 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
||||||||||||||||||||||||
line 1343 getHttpResponseprotected IHttpResponse getHttpResponse ()
|
||||||||||||||||||||||||
line 749 getLastCreatedRequestpublic PresenterRequest getLastCreatedRequest () Returns the last created PresenterRequest.
|
||||||||||||||||||||||||
line 761 getLastCreatedRequestFlagpublic bool getLastCreatedRequestFlag (string $flag) Returns the last created PresenterRequest flag.
|
||||||||||||||||||||||||
line 447 getLayoutpublic string|FALSE getLayout () Returns current layout name.
|
||||||||||||||||||||||||
line 643 getPayloadpublic stdClass getPayload ()
|
||||||||||||||||||||||||
line 1130 getPersistentComponentspublic static array getPersistentComponents () Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
|
||||||||||||||||||||||||
line 268 getPhasepublic int getPhase () Returns current presenter life cycle phase.
|
||||||||||||||||||||||||
line 150 getPresenterpublic Presenter getPresenter ([$need = Returns self.
|
||||||||||||||||||||||||
line 139 getRequestpublic PresenterRequest getRequest ()
|
||||||||||||||||||||||||
line 1363 getSessionprotected Session getSession ([$namespace =
|
||||||||||||||||||||||||
line 350 getSignalpublic array|NULL getSignal () Returns pair signal receiver and name.
|
||||||||||||||||||||||||
line 161 getUniqueIdpublic string getUniqueId () Returns a name that uniquely identifies component.
|
||||||||||||||||||||||||
line 1373 getUserprotected User getUser ()
|
||||||||||||||||||||||||
line 423 getViewpublic string getView () Returns current view.
|
||||||||||||||||||||||||
line 1101 handleInvalidLinkprotected string handleInvalidLink (InvalidLinkException $e) Invalid link handler. Descendant can override this method to change default behaviour.
|
||||||||||||||||||||||||
line 1304 hasFlashSessionpublic bool hasFlashSession () Checks if a flash session namespace exists.
|
||||||||||||||||||||||||
line 654 isAjaxpublic bool isAjax () Is AJAX request?
|
||||||||||||||||||||||||
line 363 isSignalReceiverpublic bool isSignalReceiver (mixed $component, [string $signal = Checks if the signal receiver is the given one.
|
||||||||||||||||||||||||
line 807 lastModifiedpublic int lastModified (int $lastModified, [string $etag = Attempts to cache the sent entity by its last modification date
|
||||||||||||||||||||||||
line 1282 popGlobalParamspublic array popGlobalParams (string $id) Pops parameters for specified component.
|
||||||||||||||||||||||||
line 323 processSignalpublic void processSignal ()
|
||||||||||||||||||||||||
line 720 redirectUripublic void redirectUri (string $uri, [int $code = Redirect to another URL and ends presenter execution.
|
||||||||||||||||||||||||
line 629 renderTemplateprotected void renderTemplate ()
|
||||||||||||||||||||||||
line 176 runpublic IPresenterResponse run (PresenterRequest $request) Implementation of:
|
||||||||||||||||||||||||
line 1214 saveGlobalStateprotected void saveGlobalState () Permanently saves state information for all subcomponents to $this->globalState.
|
||||||||||||||||||||||||
line 669 sendPayloadprotected void sendPayload () Sends AJAX payload to the output.
|
||||||||||||||||||||||||
line 472 sendTemplatepublic void sendTemplate ()
|
||||||||||||||||||||||||
line 459 setLayoutpublic Presenter setLayout (string|FALSE $layout) Changes or disables layout.
|
||||||||||||||||||||||||
line 435 setViewpublic Presenter setView (string $view) Changes current view. Any name is allowed.
|
||||||||||||||||||||||||
line 309 shutdownprotected void shutdown (IPresenterResponse $response)
|
||||||||||||||||||||||||
line 278 startupprotected void startup ()
|
||||||||||||||||||||||||
line 774 terminatepublic void terminate ([IPresenterResponse $response = Correctly terminates presenter.
|