Packages

  • Nette
    • Application
      • Diagnostics
      • Responses
      • Routers
      • UI
    • Caching
      • Storages
    • ComponentModel
    • Config
      • Adapters
      • Extensions
    • Database
      • Diagnostics
      • Drivers
      • Reflection
      • Table
    • DI
      • Diagnostics
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
      • Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
      • Diagnostics
    • Templating
    • Utils
      • PhpGenerator
  • NetteModule
  • none

Classes

Interfaces

Exceptions

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class NPresenter

Presenter component represents a webpage instance. It converts Request to IResponse.

NObject
Extended by NComponent implements IComponent
Extended by NComponentContainer implements IComponentContainer
Extended by NPresenterComponent implements ISignalReceiver, IStatePersistent, ArrayAccess
Extended by NControl implements IRenderable
Extended by NPresenter implements IPresenter
Abstract
Package: Nette\Application\UI
Author: David Grudl
Located at Application/UI/Presenter.php
Methods summary
public
# __construct( NDIContainer $context = NULL )

Overrides

NComponent::__construct()
public NPresenterRequest
# getRequest( )

Returns

NPresenterRequest
public NPresenter
# getPresenter( boolean $need = TRUE )

Returns self.

Returns self.

Parameters

$need
boolean
throw exception if presenter doesn't exist?

Returns

NPresenter

Overrides

NPresenterComponent::getPresenter()
public string
# getUniqueId( )

Returns a name that uniquely identifies component.

Returns a name that uniquely identifies component.

Returns

string

Overrides

NPresenterComponent::getUniqueId()
public IPresenterResponse
# run( NPresenterRequest $request )

Returns

IPresenterResponse

Implementation of

IPresenter::run()
protected
# startup( )
protected
# beforeRender( )

Common render method.

Common render method.

protected
# afterRender( )

Common render method.

Common render method.

protected
# shutdown( IPresenterResponse $response )

Parameters

$response
IPresenterResponse
public
# checkRequirements( $element )

Checks authorization.

Checks authorization.

Overrides

NPresenterComponent::checkRequirements()
public
# processSignal( )

Throws

NBadSignalException
public array|null
# getSignal( )

Returns pair signal receiver and name.

Returns pair signal receiver and name.

Returns

array|null
public boolean
# 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)

Returns

boolean
public string
# getAction( $fullyQualified = FALSE )

Returns current action name.

Returns current action name.

Returns

string
public
# changeAction( string $action )

Changes current action. Only alphanumeric characters are allowed.

Changes current action. Only alphanumeric characters are allowed.

Parameters

$action
string
public string
# getView( )

Returns current view.

Returns current view.

Returns

string
public NPresenter
# setView( string $view )

Changes current view. Any name is allowed.

Changes current view. Any name is allowed.

Parameters

$view
string

Returns

NPresenter
public string|false
# getLayout( )

Returns current layout name.

Returns current layout name.

Returns

string|false
public NPresenter
# setLayout( string|false $layout )

Changes or disables layout.

Changes or disables layout.

Parameters

$layout
string|false

Returns

NPresenter
public
# sendTemplate( )

Throws

NBadRequestException
if no template found
NAbortException
public array
# formatLayoutTemplateFiles( )

Formats layout template file names.

Formats layout template file names.

Returns

array
public array
# formatTemplateFiles( )

Formats view template file names.

Formats view template file names.

Returns

array
protected static string
# formatActionMethod( string $action )

Formats action method name.

Formats action method name.

Parameters

$action
string

Returns

string
protected static string
# formatRenderMethod( string $view )

Formats render view method name.

Formats render view method name.

Parameters

$view
string

Returns

string
public stdClass
# getPayload( )

Returns

stdClass
public boolean
# isAjax( )

Is AJAX request?

Is AJAX request?

Returns

boolean
public
# sendPayload( )

Sends AJAX payload to the output.

Sends AJAX payload to the output.

Throws

NAbortException
public
# sendResponse( IPresenterResponse $response )

Sends response and terminates presenter.

Sends response and terminates presenter.

Throws

NAbortException
public
# terminate( )

Correctly terminates presenter.

Correctly terminates presenter.

Throws

NAbortException
public
# forward( string|Request $destination, array|mixed $args = array() )

Forward to another presenter or action.

Forward to another presenter or action.

Parameters

$destination
string|Request
$args
array|mixed

Throws

NAbortException
public
# redirectUrl( string $url, integer $code = NULL )

Redirect to another URL and ends presenter execution.

Redirect to another URL and ends presenter execution.

Parameters

$url
string
$code
integer
HTTP error code

Throws

NAbortException
public
# redirectUri( $url, $code = NULL )

Deprecated

public
# error( string $message = NULL, integer $code = IHttpResponse::S404_NOT_FOUND )

Throws HTTP error.

Throws HTTP error.

Parameters

$message
string
$code
integer
HTTP error code

Throws

NBadRequestException
public string
# backlink( )

Link to myself.

Link to myself.

Returns

string
public
# canonicalize( )

Conditional redirect to canonicalized URI.

Conditional redirect to canonicalized URI.

Throws

NAbortException
public
# lastModified( string|integer|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.

Deprecated

Parameters

$lastModified
string|integer|DateTime
last modified time
$etag
string
strong entity tag validator
$expire
mixed
optional expiration time

Throws

NAbortException
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.

Returns

string

Throws

NInvalidLinkException
public string
# storeRequest( mixed $expiration = '+ 10 minutes' )

Stores current request to session.

Stores current request to session.

Parameters

$expiration
mixed
optional expiration time

Returns

string
key
public
# restoreRequest( string $key )

Restores request from session.

Restores request from session.

Parameters

$key
string
key
public static array
# getPersistentComponents( )

Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).

Returns array of persistent components. This default implementation detects components by class-level annotation @persistent(cmp1, cmp2).

Returns

array
protected
# saveGlobalState( )

Permanently saves state information for all subcomponents to $this->globalState.

Permanently saves state information for all subcomponents to $this->globalState.

public boolean
# hasFlashSession( )

Checks if a flash session namespace exists.

Checks if a flash session namespace exists.

Returns

boolean
public NSessionSection
# getFlashSession( )

Returns session namespace provided to pass temporary data between redirects.

Returns session namespace provided to pass temporary data between redirects.

Returns

NSessionSection
public
# injectPrimary( NDIContainer $context )
public SystemContainer|NDIContainer
# getContext( )

Gets the context.

Gets the context.

Returns

SystemContainer|NDIContainer
public
# getService( $name )

Deprecated

protected NHttpRequest
# getHttpRequest( )

Returns

NHttpRequest
protected NHttpResponse
# getHttpResponse( )

Returns

NHttpResponse
protected NHttpContext
# getHttpContext( )

Returns

NHttpContext
public NApplication
# getApplication( )

Returns

NApplication
public NSession|NSessionSection
# getSession( string $namespace = NULL )

Parameters

$namespace
string

Returns

NSession|NSessionSection
public NUser
# getUser( )

Returns

NUser
Methods inherited from NControl
createTemplate(), flashMessage(), getSnippetId(), getTemplate(), getWidget(), invalidateControl(), isControlInvalid(), templatePrepareFilters(), validateControl()
Methods inherited from NPresenterComponent
attached(), formatSignalMethod(), getParam(), getParamId(), getParameter(), getParameterId(), getPersistentParams(), getReflection(), isLinkCurrent(), lazyLink(), link(), loadState(), offsetExists(), offsetGet(), offsetSet(), offsetUnset(), redirect(), saveState(), signalReceived(), tryCall(), validateParent()
Methods inherited from NComponentContainer
__clone(), addComponent(), createComponent(), getComponent(), getComponents(), removeComponent(), validateChildComponent()
Methods inherited from NComponent
__sleep(), __wakeup(), detached(), getName(), getParent(), lookup(), lookupPath(), monitor(), unmonitor()
Methods inherited from NObject
__call(), __callStatic(), __get(), __isset(), __set(), __unset(), extensionMethod()
Methods inherited from IComponent
setParent()
Constants summary
integer INVALID_LINK_SILENT 1
#

bad link handling NPresenter::$invalidLinkMode

bad link handling NPresenter::$invalidLinkMode

integer INVALID_LINK_WARNING 2
#

bad link handling NPresenter::$invalidLinkMode

bad link handling NPresenter::$invalidLinkMode

integer INVALID_LINK_EXCEPTION 3
#

bad link handling NPresenter::$invalidLinkMode

bad link handling NPresenter::$invalidLinkMode

string SIGNAL_KEY 'do'
#
string ACTION_KEY 'action'
#
string FLASH_KEY '_fid'
#
string DEFAULT_ACTION 'default'
#
Constants inherited from IComponent
NAME_SEPARATOR
Properties summary
public integer $invalidLinkMode
#
public array $onShutdown
#

of function(Presenter $sender, IResponse $response = NULL); Occurs when the presenter is shutting down

of function(Presenter $sender, IResponse $response = NULL); Occurs when the presenter is shutting down

public boolean $autoCanonicalize TRUE
#

automatically call canonicalize()

automatically call canonicalize()

public boolean $absoluteUrls FALSE
#

use absolute Urls or paths?

use absolute Urls or paths?

Properties inherited from NControl
$snippetMode
Properties inherited from NPresenterComponent
$params
Magic properties summary
public string $view
#
public string $layout
#
public read-only NPresenterRequest $request
#
public read-only array|null $signal
#
public read-only string $action
#
public read-only stdClass $payload
#
public read-only boolean $ajax
#
public read-only NPresenterRequest $lastCreatedRequest
#
public read-only NSessionSection $flashSession
#
public read-only SystemContainer|NDIContainer $context
#
public read-only NApplication $application
#
public read-only NSession $session
#
public read-only NUser $user
#
Magic properties inherited from NControl
$snippetId, $template
Magic properties inherited from NPresenterComponent
$presenter, $uniqueId
Magic properties inherited from NComponentContainer
$components
Magic properties inherited from NComponent
$name, $parent
Magic properties inherited from NObject
$reflection
Nette Framework 2.0.18 (for PHP 5.2, prefixed) API documentation generated by ApiGen 2.8.0