Class NPresenter
NPresenter object represents a webpage instance. It executes all the logic for the request.
- NObject
-
NComponent implements IComponent
-
NComponentContainer implements IComponentContainer
-
NPresenterComponent implements ISignalReceiver, IStatePersistent, ArrayAccess
-
NControl implements IPartiallyRenderable, IRenderable
-
NPresenter implements IPresenter
final public
NPresenterRequest
|
#
getRequest(
)
|
final public
NPresenter
|
#
getPresenter(
$need = true
)
Returns self. Returns self. |
final public
string
|
#
getUniqueId(
)
Returns a name that uniquely identifies component. Returns a name that uniquely identifies component. |
public
IPresenterResponse
|
#
run(
NPresenterRequest
$request
)
|
protected
void
|
#
startup(
)
|
protected
void
|
#
beforeRender(
)
Common render method. Common render method. |
protected
void
|
#
afterRender(
)
Common render method. Common render method. |
protected
void
|
#
shutdown(
IPresenterResponse
$response
)
Parameters$response IPresenterResponse optional catched exception |
public
void
|
#
processSignal(
)
Throws |
final public
array|NULL
|
#
getSignal(
)
Returns pair signal receiver and name. Returns pair signal receiver and name. |
final public
bool
|
#
isSignalReceiver(
mixed
$component,
string
$signal = NULL
)
Checks if the signal receiver is the given one. Checks if the signal receiver is the given one. Parameters$component mixed component or its id$signal string signal name (optional) |
final public
string
|
#
getAction(
$fullyQualified = false
)
Returns current action name. Returns current action name. |
public
void
|
#
changeAction(
string
$action
)
Changes current action. Only alphanumeric characters are allowed. Changes current action. Only alphanumeric characters are allowed. Parameters$action string |
final public
string
|
#
getView(
)
Returns current view. Returns current view. |
public
NPresenter
|
#
setView(
string
$view
)
Changes current view. Any name is allowed. Changes current view. Any name is allowed. Parameters$view stringReturnsNPresenter provides a fluent interface
|
final public
string|FALSE
|
#
getLayout(
)
Returns current layout name. Returns current layout name. |
public
NPresenter
|
#
setLayout(
string|FALSE
$layout
)
Changes or disables layout. Changes or disables layout. Parameters$layout string|FALSEReturnsNPresenter provides a fluent interface
|
public
void
|
#
sendTemplate(
)
Throws |
public
array
|
#
formatLayoutTemplateFiles(
string
$presenter,
string
$layout
)
Formats layout template file names. Formats layout template file names. Parameters$presenter string$layout string |
public
array
|
#
formatTemplateFiles(
string
$presenter,
string
$view
)
Formats view template file names. Formats view template file names. Parameters$presenter string$view string |
protected static
string
|
#
formatActionMethod(
string
$action
)
Formats action method name. Formats action method name. Parameters$action string |
protected static
string
|
#
formatRenderMethod(
string
$view
)
Formats render view method name. Formats render view method name. Parameters$view string |
final public
stdClass
|
#
getPayload(
)
|
public
bool
|
#
isAjax(
)
Is AJAX request? Is AJAX request? |
public
void
|
#
sendPayload(
)
Sends AJAX payload to the output. |
public
void
|
#
sendResponse(
IPresenterResponse
$response
)
Sends response and terminates presenter. Sends response and terminates presenter. Parameters$response IPresenterResponseThrows |
public
void
|
#
terminate(
)
Correctly terminates presenter. |
public
void
|
#
forward(
string|NPresenterRequest
$destination,
array|mixed
$args = array (
)
)
Forward to another presenter or action. Forward to another presenter or action. Parameters$destination string|NPresenterRequest$args array|mixedThrows |
public
void
|
#
redirectUri(
string
$uri,
int
$code = NULL
)
Redirect to another URL and ends presenter execution. Redirect to another URL and ends presenter execution. Parameters$uri string$code int HTTP error codeThrows |
public
string
|
#
backlink(
)
NLink to myself. NLink to myself. |
public
NPresenterRequest
|
#
getLastCreatedRequest(
)
Returns the last created NPresenterRequest. Returns the last created NPresenterRequest. |
public
bool
|
#
getLastCreatedRequestFlag(
string
$flag
)
Returns the last created NPresenterRequest flag. Returns the last created NPresenterRequest flag. Parameters$flag string |
public
void
|
#
canonicalize(
)
Conditional redirect to canonicalized URI. |
public
void
|
#
lastModified(
string|int|DateTime
$lastModified,
string
$etag = NULL,
mixed
$expire = NULL
)
Attempts to cache the sent entity by its last modification date. Attempts to cache the sent entity by its last modification date. Parameters$lastModified string|int|DateTime last modified time$etag string strong entity tag validator$expire mixed optional expiration timeThrows |
protected
string
|
#
handleInvalidLink(
NInvalidLinkException
$e
)
Invalid link handler. Descendant can override this method to change default behaviour. Invalid link handler. Descendant can override this method to change default behaviour. Parameters$e NInvalidLinkExceptionThrows |
public static
array
|
#
getPersistentComponents(
)
Returns array of persistent components. Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2). |
protected
void
|
#
saveGlobalState(
)
Permanently saves state information for all subcomponents to $this->globalState. Permanently saves state information for all subcomponents to $this->globalState. |
final public
array
|
#
popGlobalParams(
string
$id
)
Pops parameters for specified component. Pops parameters for specified component. Parameters$id string component id |
public
bool
|
#
hasFlashSession(
)
Checks if a flash session namespace exists. Checks if a flash session namespace exists. |
public
NSessionNamespace
|
#
getFlashSession(
)
Returns session namespace provided to pass temporary data between redirects. Returns session namespace provided to pass temporary data between redirects. |
protected
NHttpRequest
|
#
getHttpRequest(
)
|
protected
NHttpResponse
|
#
getHttpResponse(
)
|
protected
NHttpContext
|
#
getHttpContext(
)
|
public
NApplication
|
#
getApplication(
)
|
public
NSession
|
#
getSession(
$namespace = NULL
)
|
public
NUser
|
#
getUser(
)
|
Methods Inherited From NControl
getTemplate(), createTemplate(), templatePrepareFilters(), getWidget(), flashMessage(), invalidateControl(), validateControl(), isControlInvalid(), getSnippetId()
Methods Inherited From NPresenterComponent
__construct(), getPresenter(), getUniqueId(), attached(), tryCall(), getReflection(), loadState(), saveState(), getParam(), getParamId(), getPersistentParams(), signalReceived(), formatSignalMethod(), link(), lazyLink(), redirect(), offsetSet(), offsetGet(), offsetExists(), offsetUnset()
Methods Inherited From NComponentContainer
addComponent(), removeComponent(), getComponent(), createComponent(), getComponents(), validateChildComponent(), __clone()
Methods Inherited From NComponent
__construct(), lookup(), lookupPath(), monitor(), unmonitor(), attached(), detached(), getName(), getParent(), setParent(), validateParent(), __clone(), __wakeup()
Methods Inherited From NObject
getReflection(), __call(), __callStatic(), extensionMethod(), __get(), __set(), __isset(), __unset()
INVALID_LINK_SILENT |
1 # |
INVALID_LINK_WARNING |
2 # |
INVALID_LINK_EXCEPTION |
3 # |
SIGNAL_KEY |
'do' # |
ACTION_KEY |
'action' # |
FLASH_KEY |
'_fid' # |
Constants Inherited From NComponent
NAME_SEPARATOR
static
string
|
$defaultAction | 'default' |
# |
static
int
|
$invalidLinkMode | NULL |
# |
array
|
$onShutdown | NULL |
of function(NPresenter $sender, IPresenterResponse $response = NULL); Occurs when the presenter is shutting down # |
bool
|
$autoCanonicalize | true |
automatically call canonicalize() # |
bool
|
$absoluteUrls | false |
use absolute Urls or paths? # |
Properties Inherited From NPresenterComponent
$params