PHP Class Jarves\PageStack

Show file Open project: jarves/jarves Class Usage Examples

Protected Properties

Property Type Description
$adminPrefix string
$domain Jarves\Model\Domain | null
$node Jarves\Model\Node | null
$pageResponse PageResponse

Public Methods

Method Description
__construct ( string $adminPrefix, Symfony\Component\HttpFoundation\RequestStack $requestStack, Cacher $cacher, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage )
getAdminPrefix ( ) : string
getCachedPageToUrl ( integer $domainId ) : array Returns a array map nodeId -> url
getCachedUrlToPage ( integer $domainId ) : array Returns a array map url -> nodeId
getCurrentDomain ( ) : Domain
getCurrentPage ( ) : Node | null
getCurrentUrl ( boolean $full = false ) : string
getCurrentUrlAffix ( ) : string Returns the affix relative to current page.
getDomain ( integer $domainId = null ) : Domain Returns Domain object. This tries to cache the domain, so its a faster access method than using DomainQuery classes.
getDomainOfPage ( integer $id ) : integer | null Returns the domain of the given $id page.
getNodeUrl ( Node | integer | string $nodeOrId, boolean $fullUrl = false, boolean $suppressStartNodeCheck = false ) : string
getPage ( Node | string | integer $node ) : Node | null Returns a super fast cached Page object.
getPageResponse ( ) : PageResponse | null
getRequest ( ) : null | Request Returns always the master request.
getRequestStack ( ) : Symfony\Component\HttpFoundation\RequestStack
getRouteUrl ( Node | integer $nodeOrId, boolean $suppressStartNodeCheck = false ) : string
getSession ( ) : null | Symfony\Component\HttpFoundation\Session\SessionInterface Returns the current session. if available.
getToken ( ) : null | Symfony\Component\Security\Core\Authentication\Token\TokenInterface
getUser ( ) : Symfony\Component\Security\Core\User\UserInterface | null Returns the current logged in User if available. Null if not or another token than Jarves' is active.
isAdmin ( ) : boolean When a route is loading within /jarves
isLoggedIn ( ) : boolean Returns true when a non AnonymousToken is set (which primarily means a real User is logged in)
reset ( )
setCurrentDomain ( Domain $domain )
setCurrentPage ( Node $node )
setPageResponse ( PageResponse $pageResponse )
updatePage2DomainCache ( )

Method Details

__construct() public method

public __construct ( string $adminPrefix, Symfony\Component\HttpFoundation\RequestStack $requestStack, Cacher $cacher, Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface $tokenStorage )
$adminPrefix string
$requestStack Symfony\Component\HttpFoundation\RequestStack
$cacher Jarves\Cache\Cacher
$tokenStorage Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface

getAdminPrefix() public method

public getAdminPrefix ( ) : string
return string

getCachedPageToUrl() public method

Returns a array map nodeId -> url
public getCachedPageToUrl ( integer $domainId ) : array
$domainId integer
return array

getCachedUrlToPage() public method

Returns a array map url -> nodeId
public getCachedUrlToPage ( integer $domainId ) : array
$domainId integer
return array

getCurrentDomain() public method

public getCurrentDomain ( ) : Domain
return Jarves\Model\Domain

getCurrentPage() public method

public getCurrentPage ( ) : Node | null
return Jarves\Model\Node | null

getCurrentUrl() public method

public getCurrentUrl ( boolean $full = false ) : string
$full boolean
return string

getCurrentUrlAffix() public method

If the current page is : /documentation/field, but the actual loaded route is: /documentation/field/field-name, then '/field-name' is returned. This can be the case, when a plugin added own routes and returned a result for '/field-name'.
public getCurrentUrlAffix ( ) : string
return string

getDomain() public method

Returns Domain object. This tries to cache the domain, so its a faster access method than using DomainQuery classes.
public getDomain ( integer $domainId = null ) : Domain
$domainId integer If not defined, it returns the current domain.
return Jarves\Model\Domain

getDomainOfPage() public method

Returns the domain of the given $id page.
public getDomainOfPage ( integer $id ) : integer | null
$id integer
return integer | null

getNodeUrl() public method

public getNodeUrl ( Node | integer | string $nodeOrId, boolean $fullUrl = false, boolean $suppressStartNodeCheck = false ) : string
$nodeOrId Jarves\Model\Node | integer | string
$fullUrl boolean with http://
$suppressStartNodeCheck boolean
return string

getPage() public method

Returns a super fast cached Page object.
public getPage ( Node | string | integer $node ) : Node | null
$node Jarves\Model\Node | string | integer Node model, url or node id
return Jarves\Model\Node | null

getPageResponse() public method

public getPageResponse ( ) : PageResponse | null
return PageResponse | null

getRequest() public method

Returns always the master request.
public getRequest ( ) : null | Request
return null | Symfony\Component\HttpFoundation\Request

getRequestStack() public method

public getRequestStack ( ) : Symfony\Component\HttpFoundation\RequestStack
return Symfony\Component\HttpFoundation\RequestStack

getRouteUrl() public method

public getRouteUrl ( Node | integer $nodeOrId, boolean $suppressStartNodeCheck = false ) : string
$nodeOrId Jarves\Model\Node | integer
$suppressStartNodeCheck boolean
return string

getSession() public method

Returns the current session. if available.
public getSession ( ) : null | Symfony\Component\HttpFoundation\Session\SessionInterface
return null | Symfony\Component\HttpFoundation\Session\SessionInterface

getToken() public method

public getToken ( ) : null | Symfony\Component\Security\Core\Authentication\Token\TokenInterface
return null | Symfony\Component\Security\Core\Authentication\Token\TokenInterface

getUser() public method

Returns the current logged in User if available. Null if not or another token than Jarves' is active.
public getUser ( ) : Symfony\Component\Security\Core\User\UserInterface | null
return Symfony\Component\Security\Core\User\UserInterface | null

isAdmin() public method

When a route is loading within /jarves
public isAdmin ( ) : boolean
return boolean

isLoggedIn() public method

Returns true when a non AnonymousToken is set (which primarily means a real User is logged in)
public isLoggedIn ( ) : boolean
return boolean

reset() public method

public reset ( )

setCurrentDomain() public method

public setCurrentDomain ( Domain $domain )
$domain Jarves\Model\Domain

setCurrentPage() public method

public setCurrentPage ( Node $node )
$node Jarves\Model\Node

setPageResponse() public method

public setPageResponse ( PageResponse $pageResponse )
$pageResponse PageResponse

updatePage2DomainCache() public method

Property Details

$adminPrefix protected property

protected string $adminPrefix
return string

$domain protected property

protected Domain,Jarves\Model|null $domain
return Jarves\Model\Domain | null

$node protected property

protected Node,Jarves\Model|null $node
return Jarves\Model\Node | null

$pageResponse protected property

protected PageResponse,jarves $pageResponse
return PageResponse