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

Inherited by PntAction, and PntPage.

Public Member Functions

 __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

 $whole
 
 $information
 
 $controller
 
 $requestData
 
 $request
 

Constructor & Destructor Documentation

__construct (   $whole,
  $requestData 
)
Parameters
PntRequestHandler$wholefrom which this will be a part
array$requestDatalime $_REQUEST (Does not add this to the parts cache of $whole)

Member Function Documentation

__toString ( )
Returns
String representation for debugging purposes
checkAlphaNumeric (   $value)

ALLWAYS call this method before including a class by name from a request parameter, unless you use this-> useClass or this-> tryUseClass

Parameters
String$valuethe value to check
Returns
the value that was passed or trigger an error if not alphanumeric _ and - are allowed because of formKey paths
forwardRequest (   $requestData,
  $information = null 
)

Include and instantiate a PntRequestHandler and let it handle the request

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)
getBaseUrl ( )
Returns
string With absloute url that maps to the folder where whpPeanuts was installed in, and in which the application folders and the classes folder reside
getContextHref (   $footprintId)

Context Scouting

Parameters
int$footprintIdthe id of the footprint to get the context href from
Returns
String absolute url to context, or null if none
getController ( )
Returns
PntSite the front controller. Can also be obtained by $this->controller directly
getConverter ( )
Returns
PntStringConverter properly initialized for the language currenly used Default is an instance of StringConverter from the classes folder.
getDebugMode ( )
Returns
string one from '', 'short', 'verbose'
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 relatice 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
getEventualItemNotFoundMessage ( )
Returns
string html message in case the requested object was not found
getFormTextPaths ( )

Returns array with paths for getFormTexts.

Returns
Array of String
getFormTexts ( )

Initializes and gets the document objects used by PntObjectSaveAction, PntObjectDetailsPage and PntObjectDetailsPart to convert, validate and communicate request data, meta data (type, path) and validation errors

Returns
Array of PntXmlNavValue
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
getHandlersTriedString (   $attempted)
Returns
string with html describing the attempted class names and folders
Parameters
array$attemptedthat was filled by ::tryUseHandlerClass
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. delegates to $this->whole so that it can be overridden on Site
getInformation ( )
Returns
HTML String information for the end user
getLabel ( )
Returns
string the label from which this can be recognized by the user
getMarkedItemsCollector ( )

PntMarkedItemsCollector helper object for collecting items that where marked by the user

getName ( )

Used for skin inclusion. Also used in the label. If you do not like the label, override ::getLabel, not ::getName

Returns
string
getReqParam (   $key,
  $asHtml = false 
)
Returns
value of request parameter as if magic_quotes_gpc is OFF and sanitized from html tags
Parameters
boolean$asHtmlas html (html_entities)
getRequestedObject ( )
Returns
mixed the (array of) PntObject that is/are shown and/or modified by this requesthandler. Default implementation is, if it is not cached, to try to load it from the database using the value of the id parameter from the request. Returns a new object if none.
Exceptions
PntError
getRequestHandler (   $requestData,
  $dir = null 
)
Returns
PntRequestHandler appropriate to handle a request. First a class named <pntType><pntHandler> is tried. If it can not be included, Object<pntHandler> will be used. If pntHandler param is missing in $requestData a default will be used, see implementation fo this method. A special case is if pntHandler=(MtoN)PropertyPage: then <pntType>Property<pntProperty>Page is tried first,
Parameters
array$requestDataassociative, of string like $_REQUEST, used to decide which class to include and instantiate, and passed to the PntRequestHandler as the request data.
string$dirappears to be ignored. $this->getDir() will be used. For each class name inclusion is first tried from $this->getDir(), If the class is not found, a class from the classes root folder is tried
Exceptions
PntValidationExceptionis no class could be included
getRequestParam (   $key)
Returns
value of request parameter as if magic_quotes_gpc is OFF, validated or eventually sanitized with respect to character encoding or null if the parameter does not exist or sanitation failed.
Parameters
string$namekey in $_REQUEST (without cookies)
See Also
HttpValidator and pnt.web.PntHttpValidator
getScout ( )

Context Scouting

Returns
PntSessionBasedScout that keeps track of the contexts
getThisPntHandlerName ( )
Returns
the pntHandler by which this can be re-included in a new request
getTryUseClassTryParams (   $className,
  $dir 
)
Returns
array of arrays with class names and folder paths used for defaulted class loading by PntRequestHandler::TryUseClass delegates to $this->whole so that it can be overridden on Site
getType ( )
Returns
string the type of the requested object Default implementation: value of pntType from the request
getTypeClassDescriptor ( )
Returns
PntClassDescriptor the descriptor of the class of the requested object, or null if none. Includes the class from the domain folder.
getTypeLabel ( )
Returns
string the label of the type of the requested object Default implementation: the label from the ClassDescriptor of the type of the requested object Which defaults to the result of the static method getClassLabel on the type of the requested object Which defaults to the type of the requested object (pntType)
htOut (   $aString)

htOut Outputs (prints) a string converting it to html (htmlEntities) The controllers StringConverter is used so its character set setting will be used

initForHandleRequest ( )

Initialize this for handling a HTTP request Default implementation is to include the requested object class and start the session. Most RequestHandlers override this to do context scouting and load the requested object(s).

queryStringFrom (   $requestData,
  $param = null 
)
Returns
string http query string
Parameters
array$requestDataassociative, of string, possibly nested, like $_REQUEST
string$paramto be used for creating nested multiple values: [<key>]=
redirectRequest (   $requestData,
  $information = null,
  $dir = null 
)

Redirect the request to a different server, page or handler This only works if NOTHING has been printed yet!!

Parameters
Arrayor String $requestData if Array redirects to handler in same application. otherwise redirects to the url it assumes is in $requestData
String$informationinformation to be passed as a request parameter this will replace eventual information parameter from $requestData but not inf the information param is in the funky part of a funky url
String$dirdirectory to redirect to. If null $this->getDir() will be used.
setFormTexts (   $value)

Sets array with paths for getFormTexts.

Parameters
Arrayof String $value
setInformation (   $value)

Overrides the information from the pntIfo request parameter

Parameters
StringHTML information for the end user
setRequestedObject (   $value)

Sets that is/are shown and/or modified by this requesthandler.

Parameters
mixed$valuethe (array of) PntObject
startSession ( )

Start a session if not already started

toString ( )
tryUseClass (   $className,
  $dir 
)

If the class does not exist, try to include it

Parameters
string$classNamename of the class
$dirapplication folder path For each class name inclusion is first tried from $this->getDir(), If the class is not found, a class from the classes root folder is tried. However, this behavior may be overridden on Site::getTryUseClassTryParams
Returns
boolean wheather a class file was included. Also true if the class already existed.
tryUseHandlerClass (   $handlerClass,
$attempted 
)

If the class does not exist, try to include a PntRequestHanlder. For each class name inclusion is first tried from $this->getDir(), If the class is not found, a class from the classes root folder is tried

Parameters
string$handlerClassname of the class
array$attemptedto add info to about the class names and folders that where tried
Returns
boolean wheather a class file was included. Also true if the class already existed.
useClass (   $className,
  $dir 
)

If the class does not exist, try to include it If it could not be included, trigger a warning.

Parameters
string$classNamename of the class
$dirapplication folder path For each class name inclusion is first tried from $this->getDir(), If the class is not found, a class from the classes root folder is tried. However, this behavior may be overridden on Site::getTryUseClassTryParams
Returns
boolean wheather a class file was included. Also true if the class already existed.
Exceptions
PntValidationExceptionif no class included

Field Documentation

$controller
$information

HTML String information for the end user

$request
$requestData
$whole

PntRequestHandler $whole from which this is be a part


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