ZenMagick 0.9.10


org.zenmagick.mvc.view\ZMView
mvc\view\ZMView.php at line 30

Class ZMView

ZMObject
└─ZMView

public abstract class ZMView
extends ZMObject

Base implementation of the ZMView interface.

Author:
DerManoMann

Constant Summary
final static str

RESOURCE

final static str

TEMPLATE

Fields inherited from org.zenmagick.core\ZMObject
properties_
Method Summary
void

__construct()

Create new instance.

abstract string

asUrl(mixed request, string filename, string type, request The)

Resolve the given (relative) templates filename into a url.

abstract boolean

exists(mixed request, string filename, string type, request The)

Check if the given templates file exists.

abstract string

fetch(mixed request, string template, request The)

Fetch/generate the contents of the given template.

string

generate(ZMRequest request)

Shortcut to generate the contents for the currenty set template.

string

getContentType()

Get the content type for this view.

string

getEncoding()

Get the content encoding.

string

getTemplate()

Get the template name.

mixed

getVar(string name)

Get a variable.

array

getVars()

Get all available variables in this view.

string

getViewId()

Get the view id.

abstract ZMViewUtils

getViewUtils()

Get view utils.

boolean

isValid(ZMRequest request)

Check if this view is valid.

abstract string

path(string filename, string type)

Resolve the given templates filename to a fully qualified filename.

void

setTemplate(string template)

Set the template name.

void

setVar(string name, mixed value)

Make a variable (value) available under the given name.

void

setVars(array vars)

Set multiple variables.

void

setViewId(string viewId)

Set the view id.

Methods inherited from org.zenmagick.core\ZMObject
__construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton

Constant Detail

mvc\view\ZMView.php at line 32

RESOURCE

public final static str RESOURCE = 'resource'

mvc\view\ZMView.php at line 31

TEMPLATE

public final static str TEMPLATE = 'template'

Method Detail

mvc\view\ZMView.php at line 41

__construct

public void __construct()

Create new instance.


mvc\view\ZMView.php at line 210

asUrl

public abstract string asUrl(mixed request, string filename, string type, request The)

Resolve the given (relative) templates filename into a url.

Parameters:
The - current request.
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
A url.

mvc\view\ZMView.php at line 199

exists

public abstract boolean exists(mixed request, string filename, string type, request The)

Check if the given templates file exists.

Parameters:
The - current request.
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
true if the file exists, false if not.

mvc\view\ZMView.php at line 188

fetch

public abstract string fetch(mixed request, string template, request The)

Fetch/generate the contents of the given template.

Parameters:
The - current request.
template - The template name.
Returns:
The contents.

mvc\view\ZMView.php at line 119

generate

public string generate(ZMRequest request)

Shortcut to generate the contents for the currenty set template.

The template extension is taken from the 'zenmagick.mvc.templates.ext'

Parameters:
request - The current request.
Returns:
The contents.

mvc\view\ZMView.php at line 166

getContentType

public string getContentType()

Get the content type for this view.

Return the value of the setting zenmagick.mvc.html.contentType or text/html as default.

Returns:
The content type or null.

mvc\view\ZMView.php at line 177

getEncoding

public string getEncoding()

Get the content encoding.

Return the value of the setting zenmagick.mvc.html.charset or UTF-8 as default.

Returns:
The content encoding.

mvc\view\ZMView.php at line 146

getTemplate

public string getTemplate()

Get the template name.

Returns:
The template name.

mvc\view\ZMView.php at line 72

getVar

public mixed getVar(string name)

Get a variable.

Parameters:
name - The variable name.
Returns:
The value or null

mvc\view\ZMView.php at line 94

getVars

public array getVars()

Get all available variables in this view.

Returns:
A name/value map.

mvc\view\ZMView.php at line 128

getViewId

public string getViewId()

Get the view id.

Returns:
The view id.

mvc\view\ZMView.php at line 227

getViewUtils

public abstract ZMViewUtils getViewUtils()

Get view utils.

Returns:
An instance of ZMViewUtils or null.

mvc\view\ZMView.php at line 106

isValid

public boolean isValid(ZMRequest request)

Check if this view is valid.

This is optional and it is up to the specific subclass to implement as appropriate.

Parameters:
request - The current request.
Returns:
true if the view is valid.

mvc\view\ZMView.php at line 220

path

public abstract string path(string filename, string type)

Resolve the given templates filename to a fully qualified filename.

Parameters:
filename - The filename, relative to the template path.
type - The lookup type; valid values are ZMView::TEMPLATE and ZMView::RESOURCE; default is ZMVIew::TEMPLATE.
Returns:
A fully qualified filename or null.

mvc\view\ZMView.php at line 155

setTemplate

public void setTemplate(string template)

Set the template name.

Parameters:
template - The new template name.

mvc\view\ZMView.php at line 62

setVar

public void setVar(string name, mixed value)

Make a variable (value) available under the given name.

Parameters:
name - The variable name.
value - The value.

mvc\view\ZMView.php at line 85

setVars

public void setVars(array vars)

Set multiple variables.

Parameters:
vars - A map of name/value pairs.

mvc\view\ZMView.php at line 137

setViewId

public void setViewId(string viewId)

Set the view id.

Parameters:
viewId - The new view id.

ZenMagick 0.9.10