Overview

Packages

  • alpha::controller
  • alpha::controller::front
  • alpha::exceptions
  • alpha::model
  • alpha::model::types
  • alpha::tasks
  • alpha::tests
  • alpha::util
  • alpha::util::cache
  • alpha::util::codehighlight
  • alpha::util::convertors
  • alpha::util::feeds
  • alpha::util::filters
  • alpha::util::graphs
  • alpha::util::helpers
  • alpha::util::metrics
  • alpha::view
  • alpha::view::renderers
  • alpha::view::widgets

Classes

  • AlphaView
  • ArticleCommentView
  • ArticleView
  • DEnumView
  • PersonView
  • SequenceView
  • ViewState
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated

Class AlphaView

The master rendering view class for the Alpha Framework.

Direct known subclasses

ArticleCommentView, ArticleView, DEnumView, PersonView, SequenceView
Package: alpha::view
Copyright: Copyright (c) 2013, John Collins (founder of Alpha Framework). All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

* Redistributions of source code must retain the above
  copyright notice, this list of conditions and the
  following disclaimer.
* Redistributions in binary form must reproduce the above
  copyright notice, this list of conditions and the
  following disclaimer in the documentation and/or other
  materials provided with the distribution.
* Neither the name of the Alpha Framework nor the names
  of its contributors may be used to endorse or promote
  products derived from this software without specific
  prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

License: The BSD License
Author: John Collins <dev@alphaframework.org>
Version: $Id: AlphaView.inc 1664 2013-09-03 22:07:49Z alphadevx $
Since: 1.0
Located at view/AlphaView.inc
Methods summary
protected
# __construct( AlphaDAO $BO )

Constructor for the AlphaView. As this is protected, use the AlphaView::getInstance method from a public scope.

Constructor for the AlphaView. As this is protected, use the AlphaView::getInstance method from a public scope.

Parameters

$BO
AlphaDAO
$BO

Throws

IllegalArguementException

Since

1.0
public static AlphaView
# getInstance( AlphaDAO $BO, boolean $returnParent = false )

Static method which returns a AlphaView object or a custom child view for the BO specified if one exists

Static method which returns a AlphaView object or a custom child view for the BO specified if one exists

Parameters

$BO
AlphaDAO
$BO The main business object that this view is going to render
$returnParent
boolean
$returnParent Flag to enforce the return of this object instead of a child (defaults to false)

Returns

AlphaView
Returns a AlphaView object, or a child view object from the /view directory if one exists for this BO

Since

1.0
public
# setBO( AlphaDAO $BO )

Simple setter for the view business object

Simple setter for the view business object

Parameters

$BO
AlphaDAO
$BO

Throws

IllegalArguementException

Since

1.0
public AlphaDAO
# getBO( )

Gets the BO attached to this view (if any)

Gets the BO attached to this view (if any)

Returns

AlphaDAO

Since

1.0
public
# createView( array $fields = array() )

Renders the default create view to standard output

Renders the default create view to standard output

Parameters

$fields
array
$fields Hash array of fields to pass to the template

Since

1.0
public
# editView( array $fields = array() )

Renders a form to enable object editing to standard output

Renders a form to enable object editing to standard output

Parameters

$fields
array
$fields Hash array of fields to pass to the template

Since

1.0
public
# listView( array $fields = array() )

Renders the list view to standard output

Renders the list view to standard output

Parameters

$fields
array
$fields Hash array of fields to pass to the template

Since

1.0
public
# detailedView( array $fields = array() )

Displays a detailed view of the object (read-only) to standard output

Displays a detailed view of the object (read-only) to standard output

Parameters

$fields
array
$fields Hash array of fields to pass to the template

Since

1.0
public
# adminView( array $fields = array() )

Renders the admin view for the business object screen to standard output

Renders the admin view for the business object screen to standard output

Parameters

$fields
array
$fields Hash array of fields to pass to the template

Since

1.0
public static string
# displayPageHead( AlphaController $controller )

Method to render the page header content

Method to render the page header content

Parameters

$controller
AlphaController
$controller

Returns

string

Throws

IllegalArguementException

Since

1.0
public static string
# displayPageFoot( AlphaController $controller )

Method to render the page footer content

Method to render the page footer content

Parameters

$controller
AlphaController
$controller

Returns

string

Since

1.0
public static string
# displayUpdateMessage( string $message )

Renders the content for an update (e.g. successful save) message

Renders the content for an update (e.g. successful save) message

Parameters

$message
string
$message

Returns

string

Since

1.0
public static string
# displayErrorMessage( string $message )

Renders the content for an error (e.g. save failed) message

Renders the content for an error (e.g. save failed) message

Parameters

$message
string
$message

Returns

string

Since

1.0
public static string
# renderErrorPage( string $code, string $message )

Renders an error page with the supplied error code (typlically a HTTP code) and a message

Renders an error page with the supplied error code (typlically a HTTP code) and a message

Parameters

$code
string
$code
$message
string
$message

Returns

string

Since

1.0
public static string
# renderDeleteForm( )

Method to render a hidden HTML form for posting the OID of an object to be deleted

Method to render a hidden HTML form for posting the OID of an object to be deleted

Returns

string

Since

1.0
public static string
# renderSecurityFields( )

Method to render a HTML form with two hidden, hashed (MD5) form fields to be used as a check to ensure that a post to the controller is being sent from the same server as hosting it.

Method to render a HTML form with two hidden, hashed (MD5) form fields to be used as a check to ensure that a post to the controller is being sent from the same server as hosting it.

Returns

string

Since

1.0
public string
# renderIntegerField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true )

Method to render the default Integer HTML

Method to render the default Integer HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderDoubleField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true )

Method to render the default Double HTML

Method to render the default Double HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderBooleanField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true )

Method to render the default Boolean HTML

Method to render the default Boolean HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderEnumField( string $name, string $label, string $mode, array $options, string $value = '', boolean $tableTags = true )

Method to render the default Enum HTML

Method to render the default Enum HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$options
array
$options The Enum options
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderDEnumField( string $name, string $label, string $mode, array $options, string $value = '', boolean $tableTags = true )

Method to render the default DEnum HTML

Method to render the default DEnum HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$options
array
$options The DEnum options
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderDefaultField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true )

Method to render the default field HTML when type is not known

Method to render the default field HTML when type is not known

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderTextField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true )

render the default Text HTML

render the default Text HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)

Returns

string

Since

1.0
public string
# renderRelationField( string $name, string $label, string $mode, string $value = '', boolean $tableTags = true, boolean $expanded = false, boolean $buttons = true )

render the default Relation HTML

render the default Relation HTML

Parameters

$name
string
$name The field name
$label
string
$label The label to apply to the field
$mode
string
$mode The field mode (create/edit/view)
$value
string
$value The field value (optional)
$tableTags
boolean
$tableTags Include table tags and label (optional)
$expanded
boolean
$expanded Render the related fields in expanded format or not (optional)
$buttons
boolean
$buttons Render buttons for expanding/contacting the related fields (optional)

Returns

string

Since

1.0
public string
# renderAllFields( string $mode, array $filterFields = array(), array $readOnlyFields = array() )

Renders all fields for the current BO in edit/create/view mode

Renders all fields for the current BO in edit/create/view mode

Parameters

$mode
string
$mode (view|edit|create)
$filterFields
array
$filterFields Optional list of field names to exclude from rendering
$readOnlyFields
array
$readOnlyFields Optional list of fields to render in a readonly fashion when rendering in create or edit mode

Returns

string

Since

1.0
public static
# loadTemplate( AlphaDAO $BO, string $mode, array $fields )

Loads a template for the BO specified if one exists. Lower level custom templates take precedence.

Loads a template for the BO specified if one exists. Lower level custom templates take precedence.

Parameters

$BO
AlphaDAO
$BO
$mode
string
$mode
$fields
array
$fields

Throws

IllegalArguementException

Since

1.0
public static
# loadTemplateFragment( string $type, string $fileName, array $fields )

Loads a template fragment from the renderers/[type]/fragments/[filename.ext] location.

Loads a template fragment from the renderers/[type]/fragments/[filename.ext] location.

Parameters

$type
string
$type Currently only html supported, later json and xml.
$fileName
string
$fileName The name of the fragment file
$fields
array
$fields A hash array of field values to pass to the template fragment.

Throws

IllegalArguementException

Since

1.2
public
# setProvider( string $ProviderClassName )

Enables you to set an explicit type of AlphaRendererProviderInterface implementation to use for rendering the business object attached to this view. Note that this has no affect on static methods of the AlphaView class, which always instantiate a new AlphaRendererProviderInterface provider each time they're called.

Enables you to set an explicit type of AlphaRendererProviderInterface implementation to use for rendering the business object attached to this view. Note that this has no affect on static methods of the AlphaView class, which always instantiate a new AlphaRendererProviderInterface provider each time they're called.

Parameters

$ProviderClassName
string
$ProviderClassName The name of the AlphaRendererProviderInterface implementation to use in this view object

Throws

IllegalArguementException

Since

1.2
Properties summary
protected AlphaDAO $BO
#

The business object that will be rendered

The business object that will be rendered

Since

1.0
protected AlphaRendererProviderInterface $provider
#

The rendering provider that will be used to render the business object

The rendering provider that will be used to render the business object

Since

1.2
private static Logger $logger null
#

Trace logger

Trace logger

Since

1.0
Alpha Framework ${alpha.version.new} API Documentation API documentation generated by ApiGen 2.8.0