Class: AlphaView
Source Location: /view/AlphaView.inc
Class AlphaView
Class Overview
The master rendering view class for the Alpha Framework.
Located in /view/AlphaView.inc [line 66]
Author(s):
- John Collins <dev@alphaframework.org>
Information Tags:
Version: | $Id: AlphaView.inc 1453 2011-12-04 15:12:54Z johnc $ |
Copyright: | Copyright (c) 2011, 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. |
Since: | 1.0 |
License: | The BSD License |
|
Properties
|
Methods
|
Method Summary
static
string
|
displayPageHead() |
Method to render the page header HTML content |
static
AlphaView
|
getInstance() |
Static method which returns a AlphaView object or a custom child view for the BO specified if one exists |
static
string
|
renderDeleteForm() |
Method to render a hidden form for posting the OID of an object to be deleted |
static
string
|
renderErrorPage() |
Renders a HTML error page with the supplied error code (typlically a HTTP code) and a message |
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. |
AlphaView |
__construct() |
Constructor for the AlphaView. As this is protected, use the AlphaView::getInstance method from a public scope. |
void |
adminView() |
Renders the admin view for the business object screen to standard output |
void |
createView() |
Renders the default create view to standard output |
void |
detailedView() |
Displays a detailed view of the object (read-only) to standard output |
void |
editView() |
Renders a form to enable object editing to standard output |
void |
listView() |
Renders the list view to standard output |
void |
loadTemplate() |
Loads a .phtml template for the BO specified if one exists. Lower level custom templates take precedence. |
string |
renderAllFields() |
Renders all fields for the current BO in edit/create/view mode |
string |
renderDefaultField() |
Method to render the default field HTML when type is not known |
void |
setBO() |
Simple setter for the view business object |
Properties
The business object that will be rendered
API Tags:
Information Tags:
Methods
static string displayErrorMessage(
string
$message
)
|
|
Renders the HTML for an error (e.g. save failed) message
Parameters:
API Tags:
Information Tags:
Method to render the page footer HTML
Parameters:
API Tags:
Information Tags:
static string displayPageHead(
AlphaController
$controller, [bool
$renderMenu = true], [bool
$renderStatus = true]
)
|
|
Method to render the page header HTML content
Parameters:
AlphaController |
$controller: |
|
bool |
$renderMenu: |
Set to false to hide the default menu (default value is true) |
bool |
$renderStatus: |
Set to false to hide the status message from the session (if any, default value is true) |
API Tags:
Information Tags:
Since: | 1.0 |
Throws: | IllegalArguementException |
static string displayUpdateMessage(
string
$message
)
|
|
Renders the HTML for an update (e.g. successful save) message
Parameters:
API Tags:
Information Tags:
Static method which returns a AlphaView object or a custom child view for the BO specified if one exists
Parameters:
AlphaDAO |
$BO: |
The main business object that this view is going to render |
boolean |
$returnParent: |
Flag to enforce the return of this object instead of a child (defaults to false) |
API Tags:
Return: | Returns a AlphaView object, or a child view object from the /view directory if one exists for this BO |
Access: | public |
Information Tags:
static string renderDeleteForm(
)
|
|
Method to render a hidden form for posting the OID of an object to be deleted
API Tags:
Information Tags:
static string renderDEnumField(
string
$name, string
$label, string
$mode, array
$options, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default DEnum HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
array |
$options: |
The DEnum options |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
static string renderDoubleField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default Double HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
static string renderEnumField(
string
$name, string
$label, string
$mode, array
$options, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default Enum HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
array |
$options: |
The Enum options |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
static string renderErrorPage(
string
$code, string
$message
)
|
|
Renders a HTML error page with the supplied error code (typlically a HTTP code) and a message
Parameters:
string |
$code: |
|
string |
$message: |
|
API Tags:
Information Tags:
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.
API Tags:
Information Tags:
Constructor for the AlphaView. As this is protected, use the AlphaView::getInstance method from a public scope.
Parameters:
API Tags:
Information Tags:
Throws: | IllegalArguementException |
Since: | 1.0 |
Redefined in descendants as:
void adminView(
[array
$fields = array()]
)
|
|
Renders the admin view for the business object screen to standard output
Parameters:
array |
$fields: |
Hash array of HTML fields to pass to the template |
API Tags:
Information Tags:
void createView(
[array
$fields = array()]
)
|
|
Renders the default create view to standard output
Parameters:
array |
$fields: |
Hash array of HTML fields to pass to the template |
API Tags:
Information Tags:
Redefined in descendants as:
void detailedView(
[array
$fields = array()]
)
|
|
Displays a detailed view of the object (read-only) to standard output
Parameters:
array |
$fields: |
Hash array of HTML fields to pass to the template |
API Tags:
Information Tags:
Redefined in descendants as:
void editView(
[array
$fields = array()]
)
|
|
Renders a form to enable object editing to standard output
Parameters:
array |
$fields: |
Hash array of HTML fields to pass to the template |
API Tags:
Information Tags:
Redefined in descendants as:
Gets the BO attached to this view (if any)
API Tags:
Information Tags:
void listView(
[array
$fields = array()]
)
|
|
Renders the list view to standard output
Parameters:
array |
$fields: |
Hash array of HTML fields to pass to the template |
API Tags:
Information Tags:
Redefined in descendants as:
void loadTemplate(
AlphaDAO
$BO, string
$mode, array
$fields
)
|
|
Loads a .phtml template for the BO specified if one exists. Lower level custom templates take precedence.
Parameters:
AlphaDAO |
$BO: |
|
string |
$mode: |
|
array |
$fields: |
|
API Tags:
Information Tags:
Since: | 1.0 |
Throws: | IllegalArguementException |
string renderAllFields(
string
$mode, [array
$filterFields = array()], [array
$readOnlyFields = array()]
)
|
|
Renders all fields for the current BO in edit/create/view mode
Parameters:
string |
$mode: |
(view|edit|create) |
array |
$filterFields: |
Optional list of field names to exclude from rendering |
array |
$readOnlyFields: |
Optional list of fields to render in a readonly fashion when rendering in create or edit mode |
API Tags:
Information Tags:
string renderBooleanField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default Boolean HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
string renderDefaultField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default field HTML when type is not known
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
string renderIntegerField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true]
)
|
|
Method to render the default Integer HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
string renderRelationField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true], [bool
$expanded = false], [bool
$buttons = true]
)
|
|
render the default Relation HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
bool |
$expanded: |
Render the related fields in expanded format or not (optional) |
bool |
$buttons: |
Render buttons for expanding/contacting the related fields (optional) |
API Tags:
Information Tags:
string renderTextField(
string
$name, string
$label, string
$mode, [string
$value = ''], [bool
$tableTags = true]
)
|
|
render the default Text HTML
Parameters:
string |
$name: |
The field name |
string |
$label: |
The label to apply to the field |
string |
$mode: |
The field mode (create/edit/view) |
string |
$value: |
The field value (optional) |
bool |
$tableTags: |
Include table tags and label (optional) |
API Tags:
Information Tags:
Simple setter for the view business object
Parameters:
API Tags:
Information Tags:
Throws: | IllegalArguementException |
Since: | 1.0 |
|
|