ArticleView
extends View
in package
The rendering class for the Article class.
Tags
Table of Contents
Properties
- $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.
Methods
- adminView() : string
- Renders the admin view for the Article, with create button pointed to the ArticleController.
- createView() : string
- Renders the default create view.
- detailedView() : string
- Renders the detail view for the Article, with edit button pointed to the ArticleController.
- 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
- Renders a form to enable article editing with attachments options.
- getInstance() : mixed
- 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
- Renders the list view (adds the dateAdded field for the list template).
- 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.
- markdownView() : string
- Method to generate the markdown HTML render of the article content.
- 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() : void
- Enables you to set an explicit type of RendererProviderInterface implementation to use for rendering the records attached to this view.
- setRecord() : void
- 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.
- afterCreateView() : string
- Adds a note to the create article screen.
- renderFileUploadSection() : string
- Renders the HTML for the file upload section.
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 Article, with create button pointed to the ArticleController.
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
stringcreateView()
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
stringdetailedView()
Renders the detail view for the Article, with edit button pointed to the ArticleController.
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
stringdisplayErrorMessage()
Renders the content for an error (e.g. save failed) message.
public
static displayErrorMessage(string $message) : string
Parameters
- $message : string
Tags
Return values
stringdisplayPageFoot()
Method to render the page footer content.
public
static displayPageFoot(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
stringdisplayPageHead()
Method to render the page header content.
public
static displayPageHead(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
stringdisplayPageLinks()
Method for rendering the pagination links.
public
static displayPageLinks(Controller $controller) : string
Parameters
- $controller : Controller
Tags
Return values
stringdisplayUpdateMessage()
Renders the content for an update (e.g. successful save) message.
public
static displayUpdateMessage(string $message) : string
Parameters
- $message : string
Tags
Return values
stringeditView()
Renders a form to enable article editing with attachments options.
public
editView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
hash array of HTML fields to pass to the template
Tags
Return values
stringgetInstance()
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 ]) : mixed
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
getProvider()
Get the current view renderer provider.
public
static getProvider() : RendererProviderInterface
Tags
Return values
RendererProviderInterfacegetRecord()
Gets the Record attached to this view (if any).
public
getRecord() : ActiveRecord
Tags
Return values
ActiveRecordlistView()
Renders the list view (adds the dateAdded field for the list template).
public
listView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
hash array of HTML fields to pass to the template
Tags
Return values
stringloadTemplate()
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
stringloadTemplateFragment()
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
stringmarkdownView()
Method to generate the markdown HTML render of the article content.
public
markdownView([array<string|int, mixed> $fields = array() ]) : string
Parameters
- $fields : array<string|int, mixed> = array()
-
Hash array of HTML fields to pass to the template.
Tags
Return values
stringrenderAllFields()
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
stringrenderBooleanField()
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
stringrenderDefaultField()
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
stringrenderDeleteForm()
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
stringrenderDEnumField()
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
stringrenderDoubleField()
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
stringrenderEnumField()
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
stringrenderErrorPage()
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
stringrenderIntegerField()
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
stringrenderRelationField()
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
stringrenderSecurityFields()
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
stringrenderTextField()
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
stringsetProvider()
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 ]) : void
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
setRecord()
Simple setter for the view business object.
public
setRecord(ActiveRecord $record) : void
Parameters
- $record : ActiveRecord
Tags
__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.
Tags
afterCreateView()
Adds a note to the create article screen.
protected
afterCreateView() : string
Tags
Return values
stringrenderFileUploadSection()
Renders the HTML for the file upload section.
protected
renderFileUploadSection() : string