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 Presenter

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

Object
Extended by Component implements IComponent
Extended by ComponentContainer implements IComponentContainer
Extended by PresenterComponent implements ISignalReceiver, IStatePersistent, ArrayAccess
Extended by Control implements IRenderable
Extended by Presenter implements IPresenter
Abstract
Package: Nette\Application\UI
Author: David Grudl
Located at Application/UI/Presenter.php
Methods summary
public
# __construct( DIContainer $context = NULL )

Overrides

Component::__construct()
public PresenterRequest
# getRequest( )

Returns

PresenterRequest
public Presenter
# getPresenter( boolean $need = TRUE )

Returns self.

Returns self.

Parameters

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

Returns

Presenter

Overrides

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

Returns a name that uniquely identifies component.

Returns a name that uniquely identifies component.

Returns

string

Overrides

PresenterComponent::getUniqueId()
public IPresenterResponse
# run( PresenterRequest $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

PresenterComponent::checkRequirements()
public
# processSignal( )

Throws

BadSignalException
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 Presenter
# setView( string $view )

Changes current view. Any name is allowed.

Changes current view. Any name is allowed.

Parameters

$view
string

Returns

Presenter
public string|false
# getLayout( )

Returns current layout name.

Returns current layout name.

Returns

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

Changes or disables layout.

Changes or disables layout.

Parameters

$layout
string|false

Returns

Presenter
public
# sendTemplate( )

Throws

BadRequestException
if no template found
AbortException
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

AbortException
public
# sendResponse( IPresenterResponse $response )

Sends response and terminates presenter.

Sends response and terminates presenter.

Throws

AbortException
public
# terminate( )

Correctly terminates presenter.

Correctly terminates presenter.

Throws

AbortException
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

AbortException
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

AbortException
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

BadRequestException
public string
# backlink( )

Link to myself.

Link to myself.

Returns

string
public
# canonicalize( )

Conditional redirect to canonicalized URI.

Conditional redirect to canonicalized URI.

Throws

AbortException
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

AbortException
protected string
# handleInvalidLink( InvalidLinkException $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

InvalidLinkException
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 SessionSection
# getFlashSession( )

Returns session namespace provided to pass temporary data between redirects.

Returns session namespace provided to pass temporary data between redirects.

Returns

SessionSection
public
# injectPrimary( DIContainer $context )
public SystemContainer|DIContainer
# getContext( )

Gets the context.

Gets the context.

Returns

SystemContainer|DIContainer
public
# getService( $name )

Deprecated

protected HttpRequest
# getHttpRequest( )

Returns

HttpRequest
protected HttpResponse
# getHttpResponse( )

Returns

HttpResponse
protected HttpContext
# getHttpContext( )

Returns

HttpContext
public Application
# getApplication( )

Returns

Application
public Session|SessionSection
# getSession( string $namespace = NULL )

Parameters

$namespace
string

Returns

Session|SessionSection
public User
# getUser( )

Returns

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

bad link handling Presenter::$invalidLinkMode

bad link handling Presenter::$invalidLinkMode

integer INVALID_LINK_WARNING 2
#

bad link handling Presenter::$invalidLinkMode

bad link handling Presenter::$invalidLinkMode

integer INVALID_LINK_EXCEPTION 3
#

bad link handling Presenter::$invalidLinkMode

bad link handling Presenter::$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 Control
$snippetMode
Properties inherited from PresenterComponent
$params
Magic properties summary
public string $view
#
public string $layout
#
public read-only PresenterRequest $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 PresenterRequest $lastCreatedRequest
#
public read-only SessionSection $flashSession
#
public read-only SystemContainer|DIContainer $context
#
public read-only Application $application
#
public read-only Session $session
#
public read-only User $user
#
Magic properties inherited from Control
$snippetId, $template
Magic properties inherited from PresenterComponent
$presenter, $uniqueId
Magic properties inherited from ComponentContainer
$components
Magic properties inherited from Component
$name, $parent
Magic properties inherited from Object
$reflection
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0