ZenMagick 0.9.6


org.zenmagick.rp.toolbox.defaults.ZMToolboxUtils

Class ZMToolboxUtils

ZMObject
|
+--ZMToolboxUtils

public class ZMToolboxUtils
extends ZMObject

Generic utilities.

Author:
DerManoMann
Version:
$Id: ZMToolboxUtils.php 2117 2009-03-29 23:34:14Z dermanomann $

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

cssFile(string filename, array attr)

Add the given CSS file to the final contents.

string

encodeXML(string s)

Encode XML control characters.

string

formatMoney(float amount, boolean convert, boolean echo)

Format the given amount according to the current currency.

string

getTitle(string page, boolean echo)

Simple title generator based on the page name.

void

jsBottom(string filename)

Add the given JS file to the end of the final contents (before the closing element).

void

jsNow(string filename)

Add the given JS file now.

void

jsTop(string filename)

Add the given JS file to the header section of the final contents.

Methods inherited from org.zenmagick.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Method Detail

cssFile

public void cssFile(string filename, array attr)

Add the given CSS file to the final contents.

The underlying code (ZMTemplateManager) will ensure that each CSS file is included once only.

Parameters:
filename - A relative CSS filename.
attr - Optional attribute map.

encodeXML

public string encodeXML(string s)

Encode XML control characters.

Parameters:
s - The input string.
Returns:
The encoded string.

formatMoney

public string formatMoney(float amount, boolean convert, boolean echo)

Format the given amount according to the current currency.

Parameters:
amount - The amount.
convert - If true, consider $amount to be in default currency and * convert before formatting.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
The formatted amount.

getTitle

public string getTitle(string page, boolean echo)

Simple title generator based on the page name.

Parameters:
page - The page name; default is null for the current page.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A reasonable page title.

jsBottom

public void jsBottom(string filename)

Add the given JS file to the end of the final contents (before the closing element).

The underlying code (ZMTemplateManager) will ensure that each JS file is included once only.

Also, if the same JS file is requested for both top and bottom, it will be included at the top only. The same applies to calling jsNow() on a file that has been already included or is marked for inclusion at the bottom.

Parameters:
filename - A relative JavaScript filename.

jsNow

public void jsNow(string filename)

Add the given JS file now.

Parameters:
filename - A relative JavaScript filename.

jsTop

public void jsTop(string filename)

Add the given JS file to the header section of the final contents.

The underlying code (ZMTemplateManager) will ensure that each JS file is included once only.

Parameters:
filename - A relative JavaScript filename.

ZenMagick 0.9.6