phpPeanuts  2.2.0
phpPeanuts framework
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Data Fields
PntSite Class Reference

Inherits PntPage.

Inherited by Site.

Public Member Functions

 __construct ($dir="beheer")
 
 isWindows ()
 
 setErrorHandler ()
 
 getErrorHandler ()
 
 loadSettings ()
 
 importLibraries ()
 
 createObjects ()
 
 initConverter ()
 
 initHttpRequest ()
 
 setDir ($value)
 
 getDir ()
 
 setDomainDir ($value)
 
 getDomainDir ($type=null)
 
 getUiDir ($type, $domainDir, $pntHandler)
 
 getAppName ($domainDir='', $type='', $pntHandler='')
 
 getBaseUrl ()
 
 getImagesDir ()
 
 isFunkyUrls ()
 
 setFunkyAlias ($value)
 
 getConverter ()
 
 getDebugMode ()
 
 handleRequest ()
 
 forwardRequest ($requestData, $information=null)
 
 forwardToHandler ($requestHandler)
 
 tryUseGenericHandlerClass ($forHandler, $requestData, $handler, &$attempted)
 
 sanitize ($requestString)
 
 startSession ()
 
 getGlobalFilters ()
 
 setGlobalFilters (&$filters)
 
 getGlobalFilterFor ($type, $persistent=false)
 
 getGlobalOptionsFilter ($type, $propName)
 
 getTryUseClassTryParams ($className, $dir)
 
 getIncludesDir ()
 
 initScout ()
 
 getScout ()
 
 getContextHref ($footprintId)
 
 guessContextTypeFolder ($type)
 
 getSecurityManager ()
 
 forwardToLoginPage ($requestData, $errorMessage=null)
 
 checkAccessHandler ($handler, $checkType=null, $prop=null)
 
 accessDenied ($handler, $errorMessage)
 
 getMaxTicketDiff ()
 
 getInvalidActionTicketMessage ()
 
 initDatabaseConnection ()
 
 buildUrl ($params, $appName=null)
 
- Public Member Functions inherited from PntPage
 getInfoStyle ()
 
 setInfoStyle ($value)
 
 printHeader ()
 
 printFooter ()
 
 printBodyTagIeExtraPiece ()
 
 includeSkin ($name, $param=null)
 
 printSetTitle ($title=null)
 
 getButton ($caption, $script, $ghost=false, $len=null)
 
 handleRequest ()
 
 getPartId ()
 
 ajaxHandleRequest ()
 
 ajaxPrintHeaders ()
 
 ajaxPrintUpdates ($preFix='')
 
 getAjaxUpdatePartIds ()
 
 getAjaxUpdateSubPartIds ($prefix)
 
 ajaxShouldUpdate ($partId, $partName=null, $extraParam=null)
 
 ajaxPrintPartUpdate ($partName, $partId=null, $extraParam=null)
 
 isRequestAjax ()
 
 ajaxPrintPartAttributes ()
 
 getAjaxLoadingMessage ()
 
 initForHandleRequest ()
 
 checkAccess ()
 
 isLayoutReport ()
 
 printHeaders ()
 
 printHeaderXframeOptions ()
 
 getCharset ()
 
 printBody ()
 
 printMainPart ()
 
 printPart ($partName)
 
 imp_printPart ($args)
 
 getPart ($args, $cache=true)
 
 getPartIncludeTryParams ($partName)
 
 getSpecificPartPrefix ($partName=null)
 
 printPartDebugComment ($partName, $debug)
 
 printInformationPart ()
 
 getFilterPartString ()
 
 getButtonsList ()
 
 addMultiValuePropertyButtons (&$buttons)
 
 getExcludedMultiValuePropButtonKeys ()
 
 getMultiValuePropertyButtonScript ($propName, $edit=false)
 
 getThisPntContext ()
 
 getDetailsHref ($appName, $pntType)
 
 getLinkDirFromNav ($nav, $pntHandler='')
 
 getTargetAppName ($nav, $pntHandler='')
 
 getDetailsLinkPntHandler ()
 
 getNoItemsMessage ()
 
 getRequestDuration ()
 
 getConvert ($obj, $path, $kind=0, $preformatAndTab=0)
 
 getInitConverter ($prop)
 
 addContextButtonTo (&$buttons)
 
 doScouting ()
 
 getFootprintId ()
 
 printFootprintJsLiteral ($quote="'")
 
 getPropertyName ()
 
 printNextActionTicket ()
 
 getAndCreateNextActionTicket ()
 
 printExtraHeaders ()
 
 getImagesDir ()
 
- Public Member Functions inherited from PntRequestHandler
 __construct ($whole, $requestData)
 
 getDir ()
 
 getDomainDir ($type=null)
 
 getBaseUrl ()
 
 getConverter ()
 
 getDebugMode ()
 
 initForHandleRequest ()
 
 startSession ()
 
 getContextHref ($footprintId)
 
 getController ()
 
 getScout ()
 
 getGlobalFilters ()
 
 forwardRequest ($requestData, $information=null)
 
 redirectRequest ($requestData, $information=null, $dir=null)
 
 queryStringFrom ($requestData, $param=null)
 
 getRequestParam ($key)
 
 getReqParam ($key, $asHtml=false)
 
 htOut ($aString)
 
 getRequestHandler ($requestData, $dir=null)
 
 tryUseHandlerClass ($handlerClass, &$attempted)
 
 getHandlersTriedString ($attempted)
 
 __toString ()
 
 toString ()
 
 getLabel ()
 
 getName ()
 
 getThisPntHandlerName ()
 
 getInformation ()
 
 getEventualItemNotFoundMessage ()
 
 setInformation ($value)
 
 getTypeLabel ()
 
 getType ()
 
 checkAlphaNumeric ($value)
 
 getTryUseClassTryParams ($className, $dir)
 
 getIncludesDir ()
 
 tryUseClass ($className, $dir)
 
 useClass ($className, $dir)
 
 getTypeClassDescriptor ()
 
 getRequestedObject ()
 
 setRequestedObject ($value)
 
 getFormTexts ()
 
 getFormTextPaths ()
 
 setFormTexts ($value)
 
 getMarkedItemsCollector ()
 

Data Fields

 $baseUrl
 
 $debugMode = ''
 
 $funkyUrls = false
 
 $funkyAlias = 'index.php?'
 
 $absoluteUrls = false
 
 $xFrameOptions = 'DENY'
 
 $httpRequestThrowsExp = true
 
 $dir
 
 $domainDir
 
 $requestStartTime
 
 $filters
 
 $converter
 
 $sessionStarted = false
 
 $isSiteRunning =true
 
 $name ="site"
 
 $os ="linux"
 
 $dbUser
 
 $dbPwd
 
 $dbAddress
 
 $dbPort
 
 $dbName
 
- Data Fields inherited from PntPage
 $infoStyle
 
 $converters
 
 $parts
 
 $filterPartString
 
 $footprintId
 
- Data Fields inherited from PntRequestHandler
 $whole
 
 $information
 
 $controller
 
 $requestData
 
 $request
 

Additional Inherited Members

- Static Public Member Functions inherited from PntPage
static getInfoStyleOk ()
 
static getInfoStyleError ()
 
static getInfoStyleWarning ()
 

Constructor & Destructor Documentation

__construct (   $dir = "beheer")

Member Function Documentation

accessDenied (   $handler,
  $errorMessage 
)

Forward to Access Denied ErrorPage. Die afterwards

buildUrl (   $params,
  $appName = null 
)
checkAccessHandler (   $handler,
  $checkType = null,
  $prop = null 
)

Check access to a RequestHandler with the SecrurityManager.

Parameters
PntRequestHandler$handlerThe RequestHandler being accessed String $type the type of access, corrsponds to the SecurityManager function to be called
$propPntPropertyDescriptor $prop Teh property being accessed (if any)
Returns
String Error message, or null if access was granted
createObjects ( )

inlcudes, instantiates and confiures some general purpose objects. Most class loading and instattiation is done Dynamically on a need-to-use basis by the RequestHandlers and the files and classes they include. Default implementation does include ValueValidator and StringConverter and instiantiates StringConverter and the context scout (see ::initScout)

forwardRequest (   $requestData,
  $information = null 
)

Include and instantiate a PntRequestHandler and let it handle the request. For compatibility with older versions op phpPeanuts, the default database connection is initialized if that has not already been done.

Parameters
array$requestDatalike $_REQUEST used to decide which PntRequestHandler to include and instantiate, and passed to the PntRequestHandler as the requst data.
string$informationto be passed to the PntRequestHandler, usually overrides the pntInfo parameter if not null (this behavior depends on the actual PntRequestHandler)
forwardToHandler (   $requestHandler)

Let the requestHandler handle the HTTP request. the request handler must already be properly initialized,

Parameters
PntRequestHandler$requestHandler
forwardToLoginPage (   $requestData,
  $errorMessage = null 
)

Forward to the login page.

Parameters
array$requestrequest data to pass to the login page
string$errorMessageHTML, only to be passed if login failed.
getAppName (   $domainDir = '',
  $type = '',
  $pntHandler = '' 
)
Returns
string the application name. This is the application dir without the trailing slash To be overridden if domain folders are not (all) equal to appNames folders
Parameters
string$domainDirwhere the type class is
string$typepntType
string$pntHandlerof the user interface
getBaseUrl ( )

The baseUrl is the the url to the folder that holds all applications folders and the classes folder etc. Normally this is the parent folder of the folder where the current script is running. This method initializes the baseUrl field if it has not been set using

See Also
Gen::getBaseUrl() in ../classes/baseUrlFunc tions.php PRECONDITION: $this->request is initialized If the assumptions of Gen::getBaseUrl are incorrect this method must either be overridden or $this->baseUrl must be set, for example from classes/scriptMakeSettings.php
Returns
String The baseUrl
getContextHref (   $footprintId)

Context Scouting

Parameters
int$footprintIdthe id of the footprint to get the context href from
Returns
String url to context, or null if none
getConverter ( )
Returns
PntStringConverter properly initialized for the language currenly used Default is a clone of the one set by initConverter, which is an instance of StringConverter from the classes folder.
getDebugMode ( )
Returns
string one from '', 'short', 'verbose' if set to equal false, no debug comments are included by printPart if set to 'verbose' printPart includes comments that show all its options. otherwise printPart inlcudes short comments at start and end of each part
getDir ( )

The application folder, where application specific skins are included from, also whithin the classes folder where user interface components are includen from. Is set to Site from the index.php script.

Returns
string relative path with trailing slash
getDomainDir (   $type = null)

folder whithin the classes folder where domain classes are included from. If not set to Site from the index.php script, this defaults to getDir without trailing slash

Returns
string relatice path without trailing slash To be overridden if PntMarkedItemsCollector can not guess some types because of polymorpism
getErrorHandler ( )
Returns
ErrorHandler the current one that is handling errors and exceptions, created by ::setErrorHandler
getGlobalFilterFor (   $type,
  $persistent = false 
)

Returns a clone of the first global filter that applies to the type, with the itemType set

Parameters
string$typethe type name
Returns
PntSqlFilter|NULL
getGlobalFilters ( )
Returns
array of PntSqlFilter to be used in the entire application where applicable These filers are usually stored in te session. SearchPages will try to use the global filters, propertypages and parts will not, they may have to be overridden or the domain model has to be made global filter sensitive. Make sure to include eventual additional filter classes before calling this method
getGlobalOptionsFilter (   $type,
  $propName 
)

Returns the filter to apply to the options of the type

Parameters
string$typethe type name $param $propName the name of the property whose options to filter NB, the property is not situated on $type but having $type as its type!
Returns
PntSqlFilter|NULL
getImagesDir ( )
Returns
string with the relative path to the folder where the browser can retieve images from by HTTP. path components must be rawurlencoded and in the charset used by the webserver to retrieve www files
getIncludesDir ( )
Returns
string path to the folder from which skins are included if no specific skin is found in the application folder. The path may be relative to the folder phpPeanuts was installed in, and in which the application folders and the classes folder reside. Override this to modify default skin inclusion
getInvalidActionTicketMessage ( )
Returns
string the error message to show if the action ticket is invalid.
See Also
PntAction::checkActionTicket
getMaxTicketDiff ( )

Returns the maximum diffence between the pntActionTicket from the request and from the session.

See Also
PntAction::checkActionTicket
Returns
int default is to return 100
getScout ( )

Context Scouting

Returns
PntSessionBasedScout that keeps track of the contexts
getSecurityManager ( )
Returns
The object that takes care of authentication and authorization
getTryUseClassTryParams (   $className,
  $dir 
)
Returns
array of arrays with class names and folder paths used for defaulted class loading by PntRequestHandler::TryUseClass Override this to modify default class loading
getUiDir (   $type,
  $domainDir,
  $pntHandler 
)

Derives a user interface folder (application folder) from domain folder.

Parameters
string$typepntType
string$domainDirwhere the type class is
string$pntHandlerof the user interface
Returns
string User interface directory name with / on the end
guessContextTypeFolder (   $type)

Guess the domain folder for the type

Parameters
string$typelike a class name
handleRequest ( )

Handle a HTTP request. Called from index.php in the application folder after instantiation and setting dir and eventually domainDir.

importLibraries ( )

Includes some general libraries and classes. Most class loading is done Dynamically on a need-to-include basis by the RequestHandlers and the files and classes they include. Default implementation is to include DatabaseConnection, QueryHandler May be overridden on Site

initConverter ( )

Instantiates and initializes the StringConverter and if its dateTimezone is set, sets its through date_default_timezone_set.

initDatabaseConnection ( )

Only used if no database connection has been made before ::forwardRequest. does not support PntPdoDao

initHttpRequest ( )
initScout ( )

Context Scouting Initializes the context scout

isFunkyUrls ( )

returns funkyUrls setting funkyUrls are search engine and user friendly urls. index.php is replaced by $this->funkyAlias, equals and ampersands become forward slashes if $this->funkyAlias does end with a / instead of a ? these are rewritten by the url rewriting feature of the webserver. RequestData then is parsed explicitly by getFunkyRequestData. With Funky Urls all urls (including image src, stylesheets and scripts) must be absolute. You must make these urls yourself, the framework will still output normal urls. (Meant to be used in public sites, where Pages usually are only inheriting some very generic methods from PntPage and PntRequestHandler)

isWindows ( )
loadSettings ( )

Configures some fields on this and maybe on some other objects, like on the DataBaseConnection. Default implentation is to require ../classes/scriptMakeSettings.php

sanitize (   $requestString)

. Properly intiialize a StringConverter and use its ::fromRequestData

setDir (   $value)

The application folder, where application specific skins are included from, also whithin the classes folder the application classes folder where user interface components are includen from. Must be set through the constructor on Site from the index.php script.

Parameters
stringrelative path
setDomainDir (   $value)

Folder whithin the classes folder where domain classes are included from. If not set to Site from the index.php script, this defaults to getDir without trailing slash

Parameters
stringrelatice path without trailing slash
setErrorHandler ( )
setFunkyAlias (   $value)
setGlobalFilters ( $filters)
Parameters
arrayof PntSqlFilter to be used in the entire application where applicable Default implementation is to store these filters in te session. SearchPages will try to use the global filters, propertypages and parts will not, they may have to be overridden or the domain model has to be made global filter sensitive. Make sure to include eventual additional filter classes before calling this method
startSession ( )

Start a session if not already started

tryUseGenericHandlerClass (   $forHandler,
  $requestData,
  $handler,
$attempted 
)

try to include a generic handler class if not yet included. Generic implementation, includes Object<pntHandler> for pages and <pntHandler> for parts. To be overriden for the inclusion of more specific (but not fully specific) handlers if domain objects are polymorpic

Parameters
PntRequestHandler$forHandlercalling this method
array$requestDatalike $_REQUEST
string$handlerpntHandler string (may be empty)
array$attemptedreference to array with results of getTryUseClassTryParams (for debugging)

Field Documentation

$absoluteUrls = false
$baseUrl

string

See Also
::getBaseUrl - may be set directly in the field from scriptMakeSettings.php
$converter
See Also
::getConverter
$dbAddress
$dbName
$dbPort
$dbPwd
$dbUser
$debugMode = ''

string

See Also
::getDebugMode - may be set directly in the field
$dir

var string $tokenSalt to be set in scriptMakeSettings string

See Also
::setDir
$domainDir

string

See Also
::setDomainDir
$filters
See Also
::getGlobalFilters
$funkyAlias = 'index.php?'
$funkyUrls = false

boolean

See Also
isFunkyUrls - may be set directly in the field
$httpRequestThrowsExp = true
$isSiteRunning =true
$name ="site"
$os ="linux"
$requestStartTime
See Also
constructor and PntPage::getRequestDuration
$sessionStarted = false
See Also
::startSession
$xFrameOptions = 'DENY'

string default value for PntPage::printHeaderXframeOptions


The documentation for this class was generated from the following file: