Class NPresenter
NPresenter object represents a webpage instance. It executes all the logic for the request.
NObject | --NComponent | --NComponentContainer | --NPresenterComponent | --NControl | --NPresenter
Implements interfaces:
Public Method Summary | |
---|---|
string |
backlink
()
NLink 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 |
|
NApplication |
|
NSessionNamespace |
Returns session namespace provided to pass temporary data between redirects.
|
NPresenterRequest |
Returns the last created NPresenterRequest.
|
bool |
getLastCreatedRequestFlag
(string $flag)
Returns the last created NPresenterRequest 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.
|
NPresenter |
getPresenter
([$need =
TRUE ])
Returns self.
|
NPresenterRequest |
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
(NPresenterRequest $request)
|
void |
sendTemplate
()
|
NPresenter |
setLayout
(string|FALSE $layout)
Changes or disables layout.
|
NPresenter |
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 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 NControl |
---|
createTemplate(), flashMessage(), getSnippetId(), getTemplate(), getWidget(), invalidateControl(), isControlInvalid(), templatePrepareFilters(), validateControl() |
Methods Inherited From NComponentContainer |
---|
addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent(), __clone() |
Methods Inherited From NComponent |
---|
__construct(), attached(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), setParent(), unmonitor(), validateParent(), __clone(), __wakeup() |
Methods Inherited From NObject |
---|
extensionMethod(), getClass(), getReflection(), __call(), __callStatic(), __get(), __isset(), __set(), __unset() |
Constant Summary | |||
---|---|---|---|
string | ACTION_KEY |
'action' |
line 61 special parameter key |
string | FLASH_KEY |
'_fid' |
line 62 special parameter key |
int | INVALID_LINK_EXCEPTION |
3 |
line 56 bad link handling NPresenter::$invalidLinkMode |
int | INVALID_LINK_SILENT |
1 |
line 54 bad link handling NPresenter::$invalidLinkMode |
int | INVALID_LINK_WARNING |
2 |
line 55 bad link handling NPresenter::$invalidLinkMode |
int | PHASE_RENDER |
4 |
line 49 life cycle phases NPresenter::getPhase() |
int | PHASE_SHUTDOWN |
5 |
line 50 life cycle phases NPresenter::getPhase() |
int | PHASE_SIGNAL |
3 |
line 48 life cycle phases NPresenter::getPhase() |
int | PHASE_STARTUP |
1 |
line 47 life cycle phases NPresenter::getPhase() |
string | SIGNAL_KEY |
'do' |
line 60 special parameter key |
Variable Summary | ||||
---|---|---|---|---|
bool | $absoluteUrls | FALSE |
line 90 use absolute Urls or paths? |
|
bool | $autoCanonicalize | TRUE |
line 87 automatically call canonicalize() |
|
static string | $defaultAction | 'default' |
line 66 |
|
static int | $invalidLinkMode |
|
line 69 |
|
bool | $oldLayoutMode | TRUE |
line 75 (experimental) |
|
array | $onShutdown |
|
line 72 of function(NPresenter $sender, IPresenterResponse $response = NULL); Occurs when the presenter is shutting down |
Method Details | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
line 290 afterRenderprotected void afterRender () Common render method.
|
||||||||||||||||||||||||
line 703 backlinkpublic string backlink () NLink to myself.
|
||||||||||||||||||||||||
line 280 beforeRenderprotected void beforeRender () Common render method.
|
||||||||||||||||||||||||
line 752 canonicalizepublic void canonicalize () Conditional redirect to canonicalized URI.
|
||||||||||||||||||||||||
line 397 changeActionpublic void changeAction (string $action) Changes current action. Only alphanumeric characters are allowed.
|
||||||||||||||||||||||||
line 572 formatActionMethodprotected static string formatActionMethod (string $action) Formats action method name.
|
||||||||||||||||||||||||
line 517 formatLayoutTemplateFilespublic array formatLayoutTemplateFiles (string $presenter, string $layout) Formats layout template file names.
|
||||||||||||||||||||||||
line 584 formatRenderMethodprotected static string formatRenderMethod (string $view) Formats render view method name.
|
||||||||||||||||||||||||
line 548 formatTemplateFilespublic array formatTemplateFiles (string $presenter, string $view) Formats view template file names.
|
||||||||||||||||||||||||
line 662 forwardpublic void forward (string|NPresenterRequest $destination, [array|mixed $args = Forward to another presenter or action.
|
||||||||||||||||||||||||
line 385 getActionpublic string getAction ([$fullyQualified = Returns current action name.
|
||||||||||||||||||||||||
line 644 getAjaxDriverpublic void getAjaxDriver ()
|
||||||||||||||||||||||||
line 1318 getApplicationpublic NApplication getApplication ()
|
||||||||||||||||||||||||
line 1281 getFlashSessionpublic NSessionNamespace getFlashSession () Returns session namespace provided to pass temporary data between redirects.
|
||||||||||||||||||||||||
line 1298 getHttpRequestprotected IHttpRequest getHttpRequest ()
|
||||||||||||||||||||||||
line 1308 getHttpResponseprotected IHttpResponse getHttpResponse ()
|
||||||||||||||||||||||||
line 714 getLastCreatedRequestpublic NPresenterRequest getLastCreatedRequest () Returns the last created NPresenterRequest.
|
||||||||||||||||||||||||
line 726 getLastCreatedRequestFlagpublic bool getLastCreatedRequestFlag (string $flag) Returns the last created NPresenterRequest flag.
|
||||||||||||||||||||||||
line 438 getLayoutpublic string|FALSE getLayout () Returns current layout name.
|
||||||||||||||||||||||||
line 608 getPayloadpublic stdClass getPayload ()
|
||||||||||||||||||||||||
line 1095 getPersistentComponentspublic static array getPersistentComponents () Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).
|
||||||||||||||||||||||||
line 259 getPhasepublic int getPhase () Returns current presenter life cycle phase.
|
||||||||||||||||||||||||
line 147 getPresenterpublic NPresenter getPresenter ([$need = Returns self.
|
||||||||||||||||||||||||
line 136 getRequestpublic NPresenterRequest getRequest ()
|
||||||||||||||||||||||||
line 341 getSignalpublic array|NULL getSignal () Returns pair signal receiver and name.
|
||||||||||||||||||||||||
line 158 getUniqueIdpublic string getUniqueId () Returns a name that uniquely identifies component.
|
||||||||||||||||||||||||
line 414 getViewpublic string getView () Returns current view.
|
||||||||||||||||||||||||
line 1066 handleInvalidLinkprotected string handleInvalidLink (NInvalidLinkException $e) Invalid link handler. Descendant can override this method to change default behaviour.
|
||||||||||||||||||||||||
line 1269 hasFlashSessionpublic bool hasFlashSession () Checks if a flash session namespace exists.
|
||||||||||||||||||||||||
line 619 isAjaxpublic bool isAjax () Is AJAX request?
|
||||||||||||||||||||||||
line 354 isSignalReceiverpublic bool isSignalReceiver (mixed $component, [string $signal = Checks if the signal receiver is the given one.
|
||||||||||||||||||||||||
line 772 lastModifiedpublic int lastModified (int $lastModified, [string $etag = Attempts to cache the sent entity by its last modification date
|
||||||||||||||||||||||||
line 1247 popGlobalParamspublic array popGlobalParams (string $id) Pops parameters for specified component.
|
||||||||||||||||||||||||
line 314 processSignalpublic void processSignal ()
|
||||||||||||||||||||||||
line 685 redirectUripublic void redirectUri (string $uri, [int $code = Redirect to another URL and ends presenter execution.
|
||||||||||||||||||||||||
line 594 renderTemplateprotected void renderTemplate ()
|
||||||||||||||||||||||||
line 173 runpublic IPresenterResponse run (NPresenterRequest $request) Implementation of:
|
||||||||||||||||||||||||
line 1179 saveGlobalStateprotected void saveGlobalState () Permanently saves state information for all subcomponents to $this->globalState.
|
||||||||||||||||||||||||
line 634 sendPayloadprotected void sendPayload () Sends AJAX payload to the output.
|
||||||||||||||||||||||||
line 463 sendTemplatepublic void sendTemplate ()
|
||||||||||||||||||||||||
line 450 setLayoutpublic NPresenter setLayout (string|FALSE $layout) Changes or disables layout.
|
||||||||||||||||||||||||
line 426 setViewpublic NPresenter setView (string $view) Changes current view. Any name is allowed.
|
||||||||||||||||||||||||
line 300 shutdownprotected void shutdown (IPresenterResponse $response)
|
||||||||||||||||||||||||
line 269 startupprotected void startup ()
|
||||||||||||||||||||||||
line 739 terminatepublic void terminate ([IPresenterResponse $response = Correctly terminates presenter.
|