DEnumView extends View
The rendering class for the DEnum class.
Tags
Table of Contents
- $record : ActiveRecord
- The business object that will be rendered.
- $logger : Logger
- Trace logger.
- $provider : RendererProviderInterface
- The rendering provider that will be used to render the active record.
- adminView() : string
- Renders the admin view for the business object screen.
- createView() : string
- Renders the default create view.
- detailedView() : string
- Renders a detailed view of the object (read-only).
- displayErrorMessage() : string
- Renders the content for an error (e.g. save failed) message.
- displayPageFoot() : string
- Method to render the page footer content.
- displayPageHead() : string
- Method to render the page header content.
- displayPageLinks() : string
- Method for rendering the pagination links.
- displayUpdateMessage() : string
- Renders the content for an update (e.g. successful save) message.
- editView() : string
- Custom edit view.
- getInstance() : View
- Static method which returns a View object or a custom child view for the Record specified if one exists.
- getProvider() : RendererProviderInterface
- Get the current view renderer provider.
- getRecord() : ActiveRecord
- Gets the Record attached to this view (if any).
- listView() : string
- Custom list view.
- loadTemplate() : string
- Loads a template for the Record specified if one exists. Lower level custom templates take precedence.
- loadTemplateFragment() : string
- Loads a template fragment from the Renderer/[type]/Fragments/[filename.ext] location.
- renderAllFields() : string
- Renders all fields for the current Record in edit/create/view mode.
- renderBooleanField() : string
- Method to render the default Boolean HTML.
- renderDefaultField() : string
- Method to render the default field HTML when type is not known.
- renderDeleteForm() : string
- Method to render a hidden HTML form for posting the ID of an object to be deleted.
- renderDEnumField() : string
- Method to render the default DEnum HTML.
- renderDoubleField() : string
- Method to render the default Double HTML.
- renderEnumField() : string
- Method to render the default Enum HTML.
- renderErrorPage() : string
- Renders an error page with the supplied error code (typlically a HTTP code) and a message.
- renderIntegerField() : string
- Method to render the default Integer HTML.
- renderRelationField() : string
- render the default Relation HTML.
- renderSecurityFields() : string
- 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.
- renderTextField() : string
- render the default Text HTML.
- setProvider() : mixed
- Enables you to set an explicit type of RendererProviderInterface implementation to use for rendering the records attached to this view.
- setRecord() : mixed
- Simple setter for the view business object.
- __construct() : mixed
- Constructor for the View. As this is protected, use the View::getInstance method from a public scope.
Properties
$record
The business object that will be rendered.
protected
ActiveRecord
$record
Tags
$logger
Trace logger.
private
static Logger
$logger
= null
Tags
$provider
The rendering provider that will be used to render the active record.
private
static RendererProviderInterface
$provider
Tags
Methods
adminView()
Renders the admin view for the business object screen.
public
adminView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
Hash array of fields to pass to the template
Tags
Return values
string —createView()
Renders the default create view.
public
createView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
Hash array of fields to pass to the template
Tags
Return values
string —detailedView()
Renders a detailed view of the object (read-only).
public
detailedView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
Hash array of fields to pass to the template
Tags
Return values
string —displayErrorMessage()
Renders the content for an error (e.g. save failed) message.
public
static displayErrorMessage(string $message) : string
Parameters
- $message : string
Tags
Return values
string —displayPageFoot()
Method to render the page footer content.
public
static displayPageFoot(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
string —displayPageHead()
Method to render the page header content.
public
static displayPageHead(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
string —displayPageLinks()
Method for rendering the pagination links.
public
static displayPageLinks(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
string —displayUpdateMessage()
Renders the content for an update (e.g. successful save) message.
public
static displayUpdateMessage(string $message) : string
Parameters
- $message : string
Tags
Return values
string —editView()
Custom edit view.
public
editView([mixed $fields = array() ]) : string
Parameters
- $fields : mixed = array()
-
Hash array of fields to pass to the template
Tags
Return values
string —getInstance()
Static method which returns a View object or a custom child view for the Record specified if one exists.
public
static getInstance(ActiveRecord $record[, bool $returnParent = false ][, string $acceptHeader = null ]) : View
Parameters
- $record : ActiveRecord
-
The main business object that this view is going to render
- $returnParent : bool = false
-
Flag to enforce the return of this object instead of a child (defaults to false)
- $acceptHeader : string = null
-
Optionally pass the HTTP Accept header to select the correct renderer provider.
Tags
Return values
View —Returns a View object, or a child view object if one exists for this record
getProvider()
Get the current view renderer provider.
public
static getProvider() : RendererProviderInterface
Tags
Return values
RendererProviderInterface —getRecord()
Gets the Record attached to this view (if any).
public
getRecord() : ActiveRecord
Tags
Return values
ActiveRecord —listView()
Custom list view.
public
listView([mixed $fields = array() ]) : string
Parameters
- $fields : mixed = array()
-
Hash array of fields to pass to the template
Tags
Return values
string —loadTemplate()
Loads a template for the Record specified if one exists. Lower level custom templates take precedence.
public
static loadTemplate(ActiveRecord $record, string $mode[, array<string|int, mixed> $fields = array() ]) : string
Parameters
- $record : ActiveRecord
- $mode : string
- $fields : array<string|int, mixed> = array()
Tags
Return values
string —loadTemplateFragment()
Loads a template fragment from the Renderer/[type]/Fragments/[filename.ext] location.
public
static loadTemplateFragment(string $type, string $fileName[, array<string|int, mixed> $fields = array() ]) : string
Parameters
- $type : string
-
Currently only html supported, later json and xml.
- $fileName : string
-
The name of the fragment file
- $fields : array<string|int, mixed> = array()
-
A hash array of field values to pass to the template fragment.
Tags
Return values
string —renderAllFields()
Renders all fields for the current Record in edit/create/view mode.
public
renderAllFields(string $mode[, array<string|int, mixed> $filterFields = array() ][, array<string|int, mixed> $readOnlyFields = array() ]) : string
Parameters
- $mode : string
-
(view|edit|create)
- $filterFields : array<string|int, mixed> = array()
-
Optional list of field names to exclude from rendering
- $readOnlyFields : array<string|int, mixed> = array()
-
Optional list of fields to render in a readonly fashion when rendering in create or edit mode
Tags
Return values
string —renderBooleanField()
Method to render the default Boolean HTML.
public
renderBooleanField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderDefaultField()
Method to render the default field HTML when type is not known.
public
renderDefaultField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderDeleteForm()
Method to render a hidden HTML form for posting the ID of an object to be deleted.
public
static renderDeleteForm(string $URI) : string
Parameters
- $URI : string
-
The URI that the form will point to
Tags
Return values
string —renderDEnumField()
Method to render the default DEnum HTML.
public
renderDEnumField(string $name, string $label, string $mode, array<string|int, mixed> $options[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $options : array<string|int, mixed>
-
The DEnum options
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderDoubleField()
Method to render the default Double HTML.
public
renderDoubleField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderEnumField()
Method to render the default Enum HTML.
public
renderEnumField(string $name, string $label, string $mode, array<string|int, mixed> $options[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $options : array<string|int, mixed>
-
The Enum options
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderErrorPage()
Renders an error page with the supplied error code (typlically a HTTP code) and a message.
public
static renderErrorPage(string $code, string $message) : string
Parameters
- $code : string
- $message : string
Tags
Return values
string —renderIntegerField()
Method to render the default Integer HTML.
public
renderIntegerField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —renderRelationField()
render the default Relation HTML.
public
renderRelationField(string $name, string $label, string $mode[, string $value = '' ][, bool $expanded = false ][, bool $buttons = true ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
- $expanded : bool = false
-
Render the related fields in expanded format or not (optional)
- $buttons : bool = true
-
Render buttons for expanding/contacting the related fields (optional)
Tags
Return values
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.
public
static renderSecurityFields() : string
Tags
Return values
string —renderTextField()
render the default Text HTML.
public
renderTextField(string $name, string $label, string $mode[, string $value = '' ]) : string
Parameters
- $name : string
-
The field name
- $label : string
-
The label to apply to the field
- $mode : string
-
The field mode (create/edit/view)
- $value : string = ''
-
The field value (optional)
Tags
Return values
string —setProvider()
Enables you to set an explicit type of RendererProviderInterface implementation to use for rendering the records attached to this view.
public
static setProvider(string $ProviderClassName[, string $acceptHeader = null ]) : mixed
Parameters
- $ProviderClassName : string
-
The name of the RendererProviderInterface implementation to use in this view object
- $acceptHeader : string = null
-
Optional pass the HTTP Accept header to select the correct renderer provider.
Tags
Return values
mixed —setRecord()
Simple setter for the view business object.
public
setRecord(ActiveRecord $record) : mixed
Parameters
- $record : ActiveRecord
Tags
Return values
mixed —__construct()
Constructor for the View. As this is protected, use the View::getInstance method from a public scope.
protected
__construct(ActiveRecord $record[, string $acceptHeader = null ]) : mixed
Parameters
- $record : ActiveRecord
-
The main business object that this view is going to render
- $acceptHeader : string = null
-
Optionally pass the HTTP Accept header to select the correct renderer provider.