ZenMagick 0.9.10


zenmagick.store.shared.mvc.tools\ZMToolboxMacro
mvc\toolbox\ZMToolboxMacro.php at line 33

Class ZMToolboxMacro

ZMObject
└─ZMToolboxTool
└─ZMToolboxMacro

public class ZMToolboxMacro
extends ZMToolboxTool

Macro utilities.

Author:
DerManoMann

Fields inherited from org.zenmagick.mvc.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)

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(int what, 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)

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 updateStats)

Display the given banner.

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

Method Detail

mvc\toolbox\ZMToolboxMacro.php at line 513

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.

mvc\toolbox\ZMToolboxMacro.php at line 186

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.

mvc\toolbox\ZMToolboxMacro.php at line 575

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!

mvc\toolbox\ZMToolboxMacro.php at line 225

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.

mvc\toolbox\ZMToolboxMacro.php at line 79

formatAddress

public string formatAddress(ZMAddress address, boolean html)

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.
Returns:
A fully formatted address that, depending on the html flag, is either HTML or ASCII formatted.

mvc\toolbox\ZMToolboxMacro.php at line 276

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.

mvc\toolbox\ZMToolboxMacro.php at line 41

phpinfo

public string phpinfo(int what, what What)

phpinfo wrapper.

Parameters:
What - to display (see phpinfo manual for more); default is 1.
Returns:
The phpinfo output minus a few formatting things that break validation.

mvc\toolbox\ZMToolboxMacro.php at line 318

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.

mvc\toolbox\ZMToolboxMacro.php at line 387

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.

mvc\toolbox\ZMToolboxMacro.php at line 539

productPrice

public string productPrice(ZMProduct product, boolean tax)

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.
Returns:
The fully HTML formatted price.

mvc\toolbox\ZMToolboxMacro.php at line 360

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.

mvc\toolbox\ZMToolboxMacro.php at line 468

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.

mvc\toolbox\ZMToolboxMacro.php at line 488

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.

mvc\toolbox\ZMToolboxMacro.php at line 414

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.

mvc\toolbox\ZMToolboxMacro.php at line 440

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.

mvc\toolbox\ZMToolboxMacro.php at line 150

showBanner

public string showBanner(ZMBanner banner, boolean updateStats)

Display the given banner.

Parameters:
banner - A ZMBanner instance.
updateStats - If true, the banner stats will get updated (click count).
Returns:
The HTML formatted banner.

ZenMagick 0.9.10