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 | |
---|---|
Presenter |
__construct
(PresenterRequest $request)
|
string |
backlink
()
Link to myself.
|
void |
canonicalize
()
Conditional redirect to canonicalized URI.
|
void |
changeAction
(string $action)
Changes current action. Only alphanumeric characters are allowed.
|
void |
changeLayout
($layout)
|
void |
changeScene
($view)
|
void |
changeView
($view)
|
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.
|
IAjaxDriver|NULL |
|
Application |
|
SesssionNamespace |
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.
|
mixed |
getPayload
()
|
static array |
Returns array of persistent components.
|
int |
getPhase
()
Returns current presenter life cycle phase.
|
Presenter |
getPresenter
([$need =
TRUE ])
Returns self.
|
PresenterRequest |
getRequest
([bool $clone =
TRUE ])
|
void |
getScene
()
|
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 =
IHttpResponse::S303_POST_GET ])
Redirect to another URL and ends presenter execution.
|
void |
|
void |
run
()
|
void |
setLayout
(string|FALSE $layout)
Changes or disables layout.
|
void |
setView
(string $view)
Changes current view. Any name is allowed.
|
void |
terminate
()
Correctly terminates presenter.
|
Protected Method Summary | |
---|---|
protected void |
afterRender
()
Common render method.
|
protected void |
Common prepare method.
|
protected void |
beforeRender
()
Common render method.
|
protected IAjaxDriver |
|
protected static string |
formatActionMethod
(string $action)
Formats action method name.
|
protected static string |
formatPrepareMethod
(string $view)
Formats prepare view method name.
|
protected static string |
formatRenderMethod
(string $view)
Formats render view method name.
|
protected IHttpRequest |
|
protected IHttpResponse |
|
protected string |
Invalid link handler. Descendant can override this method to change default behaviour.
|
protected void |
Permanently saves state information for all subcomponents to $this->globalState.
|
protected void |
shutdown
(Exception $exception)
|
protected void |
startup
()
|
Methods Inherited From Control |
---|
createTemplate(), flashMessage(), getSnippetId(), getTemplate(), invalidateControl(), isControlInvalid(), validateControl() |
Methods Inherited From PresenterComponent |
---|
__construct(), ajaxLink(), attached(), formatSignalMethod(), getParam(), getParamId(), getPersistentParams(), getPresenter(), getUniqueId(), lazyLink(), link(), loadState(), redirect(), saveState(), signalReceived(), tryCall() |
Methods Inherited From ComponentContainer |
---|
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone() |
Methods Inherited From Component |
---|
__construct(), attached(), detached(), getName(), getParent(), getService(), getServiceLocator(), lookup(), lookupPath(), monitor(), setParent(), setServiceLocator(), validateParent(), __clone(), __wakeup() |
Methods Inherited From Object |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
string | ACTION_KEY |
'action' |
line 54 special parameter key |
string | FLASH_KEY |
'_fid' |
line 55 special parameter key |
int | INVALID_LINK_EXCEPTION |
3 |
line 49 bad link handling Presenter::$invalidLinkMode |
int | INVALID_LINK_SILENT |
1 |
line 47 bad link handling Presenter::$invalidLinkMode |
int | INVALID_LINK_WARNING |
2 |
line 48 bad link handling Presenter::$invalidLinkMode |
int | PHASE_PREPARE |
2 |
line 40 life cycle phases Presenter::getPhase() |
int | PHASE_RENDER |
4 |
line 42 life cycle phases Presenter::getPhase() |
int | PHASE_SHUTDOWN |
5 |
line 43 life cycle phases Presenter::getPhase() |
int | PHASE_SIGNAL |
3 |
line 41 life cycle phases Presenter::getPhase() |
int | PHASE_STARTUP |
1 |
line 39 life cycle phases Presenter::getPhase() |
string | SIGNAL_KEY |
'do' |
line 53 special parameter key |
Variable Summary | ||||
---|---|---|---|---|
bool | $absoluteUrls | FALSE |
line 80 use absolute Urls or paths? |
|
bool | $autoCanonicalize | TRUE |
line 77 automatically call canonicalize() |
|
static string | $defaultAction | 'default' |
line 59 |
|
static int | $invalidLinkMode |
|
line 62 |
|
bool | $oldLayoutMode | TRUE |
line 68 (experimental) |
|
array | $onShutdown |
|
line 65 of event handlers; Occurs when the presenter is shutting down; function(Presenter $sender, Exception $exception = NULL) |
Method Details | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 123 __constructpublic Presenter __construct (PresenterRequest $request)
|
||||||||||||||||||||||||
line 292 afterRenderprotected void afterRender () Common render method.
|
||||||||||||||||||||||||
line 757 backlinkpublic string backlink () Link to myself.
|
||||||||||||||||||||||||
line 272 beforePrepareprotected void beforePrepare () Common prepare method.
|
||||||||||||||||||||||||
line 282 beforeRenderprotected void beforeRender () Common render method.
|
||||||||||||||||||||||||
line 804 canonicalizepublic void canonicalize () Conditional redirect to canonicalized URI.
|
||||||||||||||||||||||||
line 399 changeActionpublic void changeAction (string $action) Changes current action. Only alphanumeric characters are allowed.
|
||||||||||||||||||||||||
line 494 changeLayoutpublic void changeLayout ($layout)
|
||||||||||||||||||||||||
line 483 changeScenepublic void changeScene ($view)
|
||||||||||||||||||||||||
line 461 changeViewpublic void changeView ($view)
|
||||||||||||||||||||||||
line 699 createAjaxDriverprotected IAjaxDriver createAjaxDriver ()
|
||||||||||||||||||||||||
line 619 formatActionMethodprotected static string formatActionMethod (string $action) Formats action method name.
|
||||||||||||||||||||||||
line 564 formatLayoutTemplateFilespublic array formatLayoutTemplateFiles (string $presenter, string $layout) Formats layout template file names.
|
||||||||||||||||||||||||
line 631 formatPrepareMethodprotected static string formatPrepareMethod (string $view) Formats prepare view method name.
|
||||||||||||||||||||||||
line 643 formatRenderMethodprotected static string formatRenderMethod (string $view) Formats render view method name.
|
||||||||||||||||||||||||
line 595 formatTemplateFilespublic array formatTemplateFiles (string $presenter, string $view) Formats view template file names.
|
||||||||||||||||||||||||
line 717 forwardpublic void forward (string|PresenterRequest $destination, [array|mixed $args = Forward to another presenter or action.
|
||||||||||||||||||||||||
line 387 getActionpublic string getAction ([$fullyQualified = Returns current action name.
|
||||||||||||||||||||||||
line 681 getAjaxDriverpublic IAjaxDriver|NULL getAjaxDriver ()
|
||||||||||||||||||||||||
line 1363 getApplicationpublic Application getApplication ()
|
||||||||||||||||||||||||
line 1326 getFlashSessionpublic SesssionNamespace getFlashSession () Returns session namespace provided to pass temporary data between redirects.
|
||||||||||||||||||||||||
line 1343 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
||||||||||||||||||||||||
line 1353 getHttpResponseprotected IHttpResponse getHttpResponse ()
|
||||||||||||||||||||||||
line 768 getLastCreatedRequestpublic PresenterRequest getLastCreatedRequest () Returns the last created PresenterRequest.
|
||||||||||||||||||||||||
line 780 getLastCreatedRequestFlagpublic bool getLastCreatedRequestFlag (string $flag) Returns the last created PresenterRequest flag.
|
||||||||||||||||||||||||
line 439 getLayoutpublic string|FALSE getLayout () Returns current layout name.
|
||||||||||||||||||||||||
line 657 getPayloadpublic mixed getPayload ()
|
||||||||||||||||||||||||
line 1145 getPersistentComponentspublic static array getPersistentComponents () Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
|
||||||||||||||||||||||||
line 252 getPhasepublic int getPhase () Returns current presenter life cycle phase.
|
||||||||||||||||||||||||
line 146 getPresenterpublic Presenter getPresenter ([$need = Returns self.
|
||||||||||||||||||||||||
line 135 getRequestpublic PresenterRequest getRequest ([bool $clone =
|
||||||||||||||||||||||||
line 472 getScenepublic void getScene ()
|
||||||||||||||||||||||||
line 343 getSignalpublic array|NULL getSignal () Returns pair signal receiver and name.
|
||||||||||||||||||||||||
line 157 getUniqueIdpublic string getUniqueId () Returns a name that uniquely identifies component.
|
||||||||||||||||||||||||
line 416 getViewpublic string getView () Returns current view.
|
||||||||||||||||||||||||
line 1116 handleInvalidLinkprotected string handleInvalidLink (InvalidLinkException $e) Invalid link handler. Descendant can override this method to change default behaviour.
|
||||||||||||||||||||||||
line 1314 hasFlashSessionpublic bool hasFlashSession () Checks if a flash session namespace exists.
|
||||||||||||||||||||||||
line 668 isAjaxpublic bool isAjax () Is AJAX request?
|
||||||||||||||||||||||||
line 356 isSignalReceiverpublic bool isSignalReceiver (mixed $component, [string $signal = Checks if the signal receiver is the given one.
|
||||||||||||||||||||||||
line 824 lastModifiedpublic int lastModified (int $lastModified, [string $etag = Attempts to cache the sent entity by its last modification date
|
||||||||||||||||||||||||
line 1292 popGlobalParamspublic array popGlobalParams (string $id) Pops parameters for specified component.
|
||||||||||||||||||||||||
line 316 processSignalpublic void processSignal ()
|
||||||||||||||||||||||||
line 740 redirectUripublic void redirectUri (string $uri, [int $code = Redirect to another URL and ends presenter execution.
|
||||||||||||||||||||||||
line 506 renderTemplatepublic void renderTemplate ()
|
||||||||||||||||||||||||
line 172 runpublic void run () Implementation of:
|
||||||||||||||||||||||||
line 1229 saveGlobalStateprotected void saveGlobalState () Permanently saves state information for all subcomponents to $this->globalState.
|
||||||||||||||||||||||||
line 451 setLayoutpublic void setLayout (string|FALSE $layout) Changes or disables layout.
|
||||||||||||||||||||||||
line 428 setViewpublic void setView (string $view) Changes current view. Any name is allowed.
|
||||||||||||||||||||||||
line 302 shutdownprotected void shutdown (Exception $exception)
|
||||||||||||||||||||||||
line 262 startupprotected void startup ()
|
||||||||||||||||||||||||
line 792 terminatepublic void terminate () Correctly terminates presenter.
|