Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationLatte
      • ApplicationTracy
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsLatte
      • Framework
      • HttpTracy
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Drivers
      • Reflection
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Diagnostics
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Latte
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • none
  • Tracy

Classes

  • Control
  • Form
  • Multiplier
  • Presenter
  • PresenterComponent

Interfaces

  • IRenderable
  • ISignalReceiver
  • IStatePersistent
  • ITemplate
  • ITemplateFactory

Exceptions

  • BadSignalException
  • InvalidLinkException
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage

Class Presenter

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

Nette\Object
Extended by Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent
Extended by Nette\ComponentModel\Container implements Nette\ComponentModel\IContainer
Extended by Nette\Application\UI\PresenterComponent implements Nette\Application\UI\ISignalReceiver, Nette\Application\UI\IStatePersistent, ArrayAccess
Extended by Nette\Application\UI\Control implements Nette\Application\UI\IRenderable
Extended by Nette\Application\UI\Presenter implements Nette\Application\IPresenter
Abstract
Namespace: Nette\Application\UI
Author: David Grudl
Located at Application/UI/Presenter.php
Methods summary
public
# __construct( )

Overrides

Nette\ComponentModel\Component::__construct()
public Nette\Application\Request
# getRequest( )

Returns

Nette\Application\Request
public Nette\Application\UI\Presenter
# getPresenter( boolean $need = TRUE )

Returns self.

Returns self.

Parameters

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

Returns

Nette\Application\UI\Presenter

Overrides

Nette\Application\UI\PresenterComponent::getPresenter()
public string
# getUniqueId( )

Returns a name that uniquely identifies component.

Returns a name that uniquely identifies component.

Returns

string

Overrides

Nette\Application\UI\PresenterComponent::getUniqueId()
public Nette\Application\IResponse
# run( Nette\Application\Request $request )

Returns

Nette\Application\IResponse

Implementation of

Nette\Application\IPresenter::run()
protected
# startup( )
protected
# beforeRender( )

Common render method.

Common render method.

protected
# afterRender( )

Common render method.

Common render method.

protected
# shutdown( Nette\Application\IResponse $response )

Parameters

$response
Nette\Application\IResponse
public
# checkRequirements( $element )

Checks authorization.

Checks authorization.

Overrides

Nette\Application\UI\PresenterComponent::checkRequirements()
public
# processSignal( )

Throws

Nette\Application\UI\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 Nette\Application\UI\Presenter
# setView( string $view )

Changes current view. Any name is allowed.

Changes current view. Any name is allowed.

Parameters

$view
string

Returns

Nette\Application\UI\Presenter
public string|false
# getLayout( )

Returns current layout name.

Returns current layout name.

Returns

string|false
public Nette\Application\UI\Presenter
# setLayout( string|false $layout )

Changes or disables layout.

Changes or disables layout.

Parameters

$layout
string|false

Returns

Nette\Application\UI\Presenter
public
# sendTemplate( )

Throws

Nette\Application\BadRequestException
if no template found
Nette\Application\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
public static string
# formatActionMethod( string $action )

Formats action method name.

Formats action method name.

Parameters

$action
string

Returns

string
public static string
# formatRenderMethod( string $view )

Formats render view method name.

Formats render view method name.

Parameters

$view
string

Returns

string
protected Nette\Application\UI\ITemplate
# createTemplate( )

Returns

Nette\Application\UI\ITemplate

Overrides

Nette\Application\UI\Control::createTemplate()
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

Nette\Application\AbortException
public
# sendJson( mixed $data )

Sends JSON data to the output.

Sends JSON data to the output.

Parameters

$data
mixed

Throws

Nette\Application\AbortException
public
# sendResponse( Nette\Application\IResponse $response )

Sends response and terminates presenter.

Sends response and terminates presenter.

Throws

Nette\Application\AbortException
public
# terminate( )

Correctly terminates presenter.

Correctly terminates presenter.

Throws

Nette\Application\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

Nette\Application\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

Nette\Application\AbortException
public
# error( string $message = NULL, integer $code = Nette\Http\IResponse::S404_NOT_FOUND )

Throws HTTP error.

Throws HTTP error.

Parameters

$message
string
$code
integer
HTTP error code

Throws

Nette\Application\BadRequestException
public string
# backlink( )

Link to myself.

Link to myself.

Deprecated

Returns

string
public
# canonicalize( )

Conditional redirect to canonicalized URI.

Conditional redirect to canonicalized URI.

Throws

Nette\Application\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.

Parameters

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

Throws

Nette\Application\AbortException
protected string
# handleInvalidLink( Nette\Application\UI\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

Nette\Application\UI\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 array
# getGlobalState( $forClass = NULL )

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

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

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 Nette\Http\SessionSection
# getFlashSession( )

Returns session namespace provided to pass temporary data between redirects.

Returns session namespace provided to pass temporary data between redirects.

Returns

Nette\Http\SessionSection
public
# injectPrimary( Nette\DI\Container $context = NULL, Nette\Application\IPresenterFactory $presenterFactory = NULL, Nette\Application\IRouter $router = NULL, Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse, Nette\Http\Session $session = NULL, Nette\Security\User $user = NULL, Nette\Application\UI\ITemplateFactory $templateFactory = NULL )
public SystemContainer|Nette\DI\Container
# getContext( )

Gets the context.

Gets the context.

Deprecated

Returns

SystemContainer|Nette\DI\Container
final public
# getService( $name )

Deprecated

protected Nette\Http\IRequest
# getHttpRequest( )

Returns

Nette\Http\IRequest
protected Nette\Http\IResponse
# getHttpResponse( )

Returns

Nette\Http\IResponse
public Nette\Http\Session|Nette\Http\SessionSection
# getSession( string $namespace = NULL )

Parameters

$namespace
string

Returns

Nette\Http\Session|Nette\Http\SessionSection
public Nette\Security\User
# getUser( )

Returns

Nette\Security\User
public Nette\Application\UI\ITemplateFactory
# getTemplateFactory( )

Returns

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

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

integer INVALID_LINK_WARNING 2
#

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

integer INVALID_LINK_EXCEPTION 3
#

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

bad link handling Nette\Application\UI\Presenter::$invalidLinkMode

string SIGNAL_KEY 'do'
#
string ACTION_KEY 'action'
#
string FLASH_KEY '_fid'
#
string DEFAULT_ACTION 'default'
#
Constants inherited from Nette\ComponentModel\IComponent
NAME_SEPARATOR
Properties summary
public integer $invalidLinkMode
#
public callable[] $onShutdown
#

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

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 Nette\Application\UI\Control
$snippetMode
Properties inherited from Nette\Application\UI\PresenterComponent
$params
Magic properties summary
public string $view
#
public string $layout
#
public read-only Nette\Application\Request $request
#
public read-only string $action
#
public read-only stdClass $payload
#
public read-only SystemContainer|Nette\DI\Container $context
#
public read-only Nette\Http\Session $session
#
public read-only Nette\Security\User $user
#
Magic properties inherited from Nette\Application\UI\Control
$template
Magic properties inherited from Nette\Application\UI\PresenterComponent
$presenter
Magic properties inherited from Nette\ComponentModel\Container
$components
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Magic properties inherited from Nette\Object
$reflection
Nette 2.2 API documentation generated by ApiGen 2.8.0