Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • Component
  • ComponentReflection
  • Control
  • Form
  • Link
  • MethodReflection
  • Multiplier
  • Presenter

Interfaces

  • IRenderable
  • ISignalReceiver
  • IStatePersistent
  • ITemplate
  • ITemplateFactory

Exceptions

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

Class Presenter

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

Nette\ComponentModel\Component implements Nette\ComponentModel\IComponent uses Nette\SmartObject
Extended by Nette\ComponentModel\Container implements Nette\ComponentModel\IContainer
Extended by Nette\Application\UI\Component 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
Located at Application/UI/Presenter.php
Methods summary
public
# __construct( )

Overrides

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

Returns

Nette\Application\Request|null
Nette\Application\Request|null
public Nette\Application\UI\Presenter
# getPresenter( boolean $throw = true )

Returns self.

Returns self.

Parameters

$throw
exception if presenter doesn't exist?

Returns

Nette\Application\UI\Presenter
Presenter

Overrides

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

Returns a name that uniquely identifies component.

Returns a name that uniquely identifies component.

Returns

string
string

Overrides

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

Returns

Nette\Application\IResponse
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
public
# checkRequirements( $element )

Checks authorization.

Checks authorization.

Overrides

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

Throws

Nette\Application\UI\BadSignalException
BadSignalException
public array|null
# getSignal( )

Returns pair signal receiver and name.

Returns pair signal receiver and name.

Returns

array|null
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
or its id
$signal
name (optional)

Returns

boolean
bool
public string
# getAction( $fullyQualified = false )

Returns current action name.

Returns current action name.

Returns

string
string
public
# changeAction( string $action )

Changes current action. Only alphanumeric characters are allowed.

Changes current action. Only alphanumeric characters are allowed.

Parameters

$action
public string
# getView( )

Returns current view.

Returns current view.

Returns

string
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

Returns

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

Returns current layout name.

Returns current layout name.

Returns

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

Changes or disables layout.

Changes or disables layout.

Parameters

$layout

Returns

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

Throws

Nette\Application\BadRequestException
if no template found
Nette\Application\AbortException
Nette\Application\AbortException
public string|null
# findLayoutTemplateFile( )

Finds layout template file name.

Finds layout template file name.

Returns

string|null
string|null

Internal

public array
# formatLayoutTemplateFiles( )

Formats layout template file names.

Formats layout template file names.

Returns

array
array
public array
# formatTemplateFiles( )

Formats view template file names.

Formats view template file names.

Returns

array
array
public static string
# formatActionMethod( string $action )

Formats action method name.

Formats action method name.

Parameters

$action

Returns

string
string
public static string
# formatRenderMethod( string $view )

Formats render view method name.

Formats render view method name.

Parameters

$view

Returns

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

Returns

Nette\Application\UI\ITemplate
ITemplate

Overrides

Nette\Application\UI\Control::createTemplate()
public stdClass
# getPayload( )

Returns

stdClass
\stdClass
public boolean
# isAjax( )

Is AJAX request?

Is AJAX request?

Returns

boolean
bool
public
# sendPayload( )

Sends AJAX payload to the output.

Sends AJAX payload to the output.

Throws

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

Sends JSON data to the output.

Sends JSON data to the output.

Parameters

$data

Throws

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

Sends response and terminates presenter.

Sends response and terminates presenter.

Throws

Nette\Application\AbortException
Nette\Application\AbortException
public
# terminate( )

Correctly terminates presenter.

Correctly terminates presenter.

Throws

Nette\Application\AbortException
Nette\Application\AbortException
public
# forward( string|Nette\Application\Request $destination, array|mixed $args = [] )

Forward to another presenter or action.

Forward to another presenter or action.

Parameters

$destination
$args

Throws

Nette\Application\AbortException
Nette\Application\AbortException
public
# redirectUrl( string $url, integer $httpCode = null )

Redirect to another URL and ends presenter execution.

Redirect to another URL and ends presenter execution.

Parameters

$url
$httpCode
error code

Throws

Nette\Application\AbortException
Nette\Application\AbortException
public string
# backlink( )

Link to myself.

Link to myself.

Deprecated

Returns

string
string
public Nette\Application\Request|null
# getLastCreatedRequest( )

Returns the last created Request.

Returns the last created Request.

Returns

Nette\Application\Request|null
Nette\Application\Request|null

Internal

public boolean
# getLastCreatedRequestFlag( string $flag )

Returns the last created Request flag.

Returns the last created Request flag.

Parameters

$flag

Returns

boolean
bool

Internal

public
# canonicalize( string $destination = null, array $args = [] )

Conditional redirect to canonicalized URI.

Conditional redirect to canonicalized URI.

Parameters

$destination
$args

Throws

Nette\Application\AbortException
Nette\Application\AbortException
public
# lastModified( string|integer|DateTimeInterface $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
modified time
$etag
entity tag validator
$expire
expiration time

Throws

Nette\Application\AbortException
Nette\Application\AbortException
protected string|null
# createRequest( Nette\Application\UI\Component $component, string $destination, array $args, string $mode )

Request/URL factory.

Request/URL factory.

Parameters

$component
base
$destination
in format "[//] [[[module:]presenter:]action | signal! | this] [#fragment]"
$args
of arguments
$mode
forward|redirect|link

Returns

string|null
URL

Throws

Nette\Application\UI\InvalidLinkException
InvalidLinkException

Internal

protected string
# requestToUrl( Nette\Application\Request $request, $relative = null )

Converts Request to URL.

Converts Request to URL.

Returns

string
string

Internal

public static
# argsToParams( string $class, string $method, array & $args, array $supplemental = [], ReflectionParameter[] & $missing = [] )

Converts list of arguments to named parameters.

Converts list of arguments to named parameters.

Parameters

$class
name
$method
name
$args
arguments
$supplemental
arguments
$missing
arguments

Throws

Nette\Application\UI\InvalidLinkException
InvalidLinkException

Internal

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
string

Throws

Nette\Application\UI\InvalidLinkException
InvalidLinkException
public string
# storeRequest( mixed $expiration = '+ 10 minutes' )

Stores current request to session.

Stores current request to session.

Parameters

$expiration
expiration time

Returns

string
key
public
# restoreRequest( string $key )

Restores request from session.

Restores request from session.

Parameters

$key
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
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
array
public
# saveState( array & $params, Nette\Application\UI\ComponentReflection $reflection = null )

Saves state informations for next request.

Saves state informations for next request.

Overrides

Nette\Application\UI\Component::saveState()
protected
# saveGlobalState( )

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

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

public array
# popGlobalParameters( string $id )

Pops parameters for specified component.

Pops parameters for specified component.

Parameters

$id
id

Returns

array
array

Internal

public boolean
# hasFlashSession( )

Checks if a flash session namespace exists.

Checks if a flash session namespace exists.

Returns

boolean
bool
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
Nette\Http\SessionSection
public
# injectPrimary( Nette\DI\Container $context, Nette\Application\IPresenterFactory $presenterFactory, Nette\Application\IRouter $router, 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 Nette\DI\Container
# getContext( )

Gets the context.

Gets the context.

Deprecated

Returns

Nette\DI\Container
Nette\DI\Container
public Nette\Http\IRequest
# getHttpRequest( )

Returns

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

Returns

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

Parameters

$namespace

Returns

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

Returns

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

Returns

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

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

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

#0b0000
integer INVALID_LINK_WARNING

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

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

#0b0001
integer INVALID_LINK_EXCEPTION

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

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

#0b0010
integer INVALID_LINK_TEXTUAL

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

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

#0b0100
string SIGNAL_KEY

Internal

special parameter key
#'do'
string ACTION_KEY

Internal

special parameter key
#'action'
string FLASH_KEY

Internal

special parameter key
#'_fid'
string DEFAULT_ACTION

Internal

special parameter key
#'default'
Constants inherited from Nette\ComponentModel\IComponent
NAME_SEPARATOR
Properties summary
public integer $invalidLinkMode
#
public callable[] $onStartup

function (Presenter $sender); Occurs when the presenter is starting

function (Presenter $sender); Occurs when the presenter is starting

#
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

automatically call canonicalize()

automatically call canonicalize()

#true
public boolean $absoluteUrls

use absolute Urls or paths?

use absolute Urls or paths?

#false
Properties inherited from Nette\Application\UI\Control
$snippetMode
Properties inherited from Nette\Application\UI\Component
$onAnchor, $params
Magic properties summary
public string $view
public string|boolean $layout
public read-only Nette\Application\Request $request
public read-only string $action
public read-only stdClass $payload
public read-only 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\Component
$linkCurrent, $presenter
Magic properties inherited from Nette\ComponentModel\Container
$components
Magic properties inherited from Nette\ComponentModel\Component
$name, $parent
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0