ZenMagick 0.9.8


org.zenmagick.store.mvc.tools.ZMToolboxMacro
\store\mvc\tools\ZMToolboxMacro.php at line 34

Class ZMToolboxMacro

ZMObject
└─ZMToolboxTool
└─ZMToolboxMacro

public class ZMToolboxMacro
extends ZMToolboxTool

Macro utilities.

Author:
DerManoMann
Version:
$Id: ZMToolboxMacro.php 2694 2009-12-03 22:32:18Z dermanomann $

Fields inherited from org.zenmagick.toolbox.ZMToolboxTool
request_, toolbox_
Fields inherited from org.zenmagick.core.ZMObject
properties_
Method Summary
protected string

buildAttributeValueLabel(ZMProduct product, ZMAttributeValue value, boolean enableImage)

Format an attribute value label.

string

buildCrumbtrail(ZMCrumbtrail crumbtrail, string sep)

Helper to format a given ZMCrumbtrail.

array

buildQuantityDiscounts(ZMProduct product, boolean tax)

Build quantity discounts details.

string

categoryTree(array categories, boolean showProductCount, boolean useCategoryPage, boolean activeParent, boolean root, array path)

Build a nested unordered list from the given categories.

string

formatAddress(ZMAddress address, boolean html, boolean echo)

Format an address according to the countries address format.

array

officeOnlyEmailFooter(string name, string email, ZMSession session)

Format additional email content for internal copies.

string

phpinfo(mixed what, boolean echo, what What)

phpinfo wrapper.

array

productAttributes(ZMProduct product)

Generate HTML for product attributes.

protected array

productCheckboxAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a CHECKBOX attribute.

string

productPrice(ZMProduct product, boolean tax, boolean echo)

Format the product price incl.

protected array

productRadioAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a RADIO attribute.

protected array

productReadonlyAttribute(ZMAttribute attribute, ZMProduct product)

Generate HTML for a READONLY attribute.

protected array

productSelectAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a SELECT attribute.

protected array

productTextAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a TEXT attribute.

protected array

productUploadAttribute(ZMProduct product, ZMAttribute attribute, mixed uploadIndex)

Generate HTML for a FILE attribute.

string

showBanner(ZMBanner banner, boolean echo, boolean updateStats)

Display the given banner.

Methods inherited from org.zenmagick.toolbox.ZMToolboxTool
getRequest, getToolbox, setRequest, setToolbox
Methods inherited from org.zenmagick.core.ZMObject
attachMethod, get, getAttachedMethods, getPropertyNames, set, singleton

Method Detail

\store\mvc\tools\ZMToolboxMacro.php at line 519

buildAttributeValueLabel

protected string buildAttributeValueLabel(ZMProduct product, ZMAttributeValue value, boolean enableImage)

Format an attribute value label.

Parameters:
product - The product.
value - The attribute value.
enableImage - Optional flag to enable/disable images; default is true.
Returns:
A fully HTML formatted attribute value label.

\store\mvc\tools\ZMToolboxMacro.php at line 194

buildCrumbtrail

public string buildCrumbtrail(ZMCrumbtrail crumbtrail, string sep)

Helper to format a given ZMCrumbtrail.

Parameters:
crumbtrail - A ZMCrumbtrail instance.
sep - A separator string.
Returns:
A fully HTML formatted crumbtrail.

\store\mvc\tools\ZMToolboxMacro.php at line 583

buildQuantityDiscounts

public array buildQuantityDiscounts(ZMProduct product, boolean tax)

Build quantity discounts details.

Parameters:
product - The product.
tax - Optional flag to display prices with/without tax (see ZMOffers for details; default is true.
Returns:
Discount details.
Todo:
The applied price logic should not be in here!

\store\mvc\tools\ZMToolboxMacro.php at line 232

categoryTree

public string categoryTree(array categories, boolean showProductCount, boolean useCategoryPage, boolean activeParent, boolean root, array path)

Build a nested unordered list from the given categories.

Supports show category count and use category page.

Links in the active path (<a>) will have a class named act, empty categories will have a class empty. Note that both can occur at the same time.

Uses output buffering for increased performance.

Please note that the last three parameter are used internally and should not bet set.

Parameters:
categories - An array of ZMCategory instances.
showProductCount - If true, show the product count per category; default is false.
useCategoryPage - If true, create links for empty categories; default is false.
activeParent - If true, the parent category is considered in the current category path; default is false.
root - Flag to indicate the start of the recursion (not required to set, as defaults to true); default is true.
path - The active category path; default is null.
Returns:
The given categories as nested unordered list.

\store\mvc\tools\ZMToolboxMacro.php at line 83

formatAddress

public string formatAddress(ZMAddress address, boolean html, boolean echo)

Format an address according to the countries address format.

The following values are available for display:

If address is null, the localized version of N/A will be returned.

Parameters:
address - The address to format.
html - If true, format as HTML, otherwise plain text.
echo - If true, the URI will be echo'ed as well as returned.
Returns:
A fully formatted address that, depending on the html flag, is either HTML or ASCII formatted.

\store\mvc\tools\ZMToolboxMacro.php at line 284

officeOnlyEmailFooter

public array officeOnlyEmailFooter(string name, string email, ZMSession session)

Format additional email content for internal copies.

Parameters:
name - The sender name.
email - The sender email.
session - The current session.
Returns:
Hash of extra information.

\store\mvc\tools\ZMToolboxMacro.php at line 43

phpinfo

public string phpinfo(mixed what, boolean echo, what What)

phpinfo wrapper.

Parameters:
What - to display (see phpinfo manual for more); default is 1.
echo - If true, the info will be echo'ed as well as returned.
Returns:
The phpinfo output minus a few formatting things that break validation.

\store\mvc\tools\ZMToolboxMacro.php at line 326

productAttributes

public array productAttributes(ZMProduct product)

Generate HTML for product attributes.

Usage sample:

<?php $attributes = $macro->productAttributes($product); ?>
<?php foreach ($attributes as $attribute) { ?>
    <?php foreach ($attribute['html'] as $option) { ?>
        <p><?php echo $option ?></p>
    <?php } ?>
<?php } ?>

Parameters:
product - A ZMProduct instance.
Returns:
An array containing HTML formatted attributes.

\store\mvc\tools\ZMToolboxMacro.php at line 393

productCheckboxAttribute

protected array productCheckboxAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a CHECKBOX attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 546

productPrice

public string productPrice(ZMProduct product, boolean tax, boolean echo)

Format the product price incl. offer, special and other stuff.

Parameters:
product - The product.
tax - Optional flag to display prices with/without tax (see ZMOffers for details; default is true.
echo - If true, the formatted price HTML will be echo'ed as well as returned.
Returns:
The fully HTML formatted price.

\store\mvc\tools\ZMToolboxMacro.php at line 366

productRadioAttribute

protected array productRadioAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a RADIO attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 474

productReadonlyAttribute

protected array productReadonlyAttribute(ZMAttribute attribute, ZMProduct product)

Generate HTML for a READONLY attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 494

productSelectAttribute

protected array productSelectAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a SELECT attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 420

productTextAttribute

protected array productTextAttribute(ZMProduct product, ZMAttribute attribute)

Generate HTML for a TEXT attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 446

productUploadAttribute

protected array productUploadAttribute(ZMProduct product, ZMAttribute attribute, mixed uploadIndex)

Generate HTML for a FILE attribute.

Parameters:
product - The product.
attribute - The attribute.
Returns:
Attribute info plus HTML to render this attribute.

\store\mvc\tools\ZMToolboxMacro.php at line 157

showBanner

public string showBanner(ZMBanner banner, boolean echo, boolean updateStats)

Display the given banner.

Parameters:
banner - A ZMBanner instance.
updateStats - If true, the banner stats will get updated (click count).
echo - If true, the URI will be echo'ed as well as returned.
Returns:
The HTML formatted banner.

ZenMagick 0.9.8