dmBridge PHP API
DMGenericTemplateHelper Class Reference
Inheritance diagram for DMGenericTemplateHelper:

Public Member Functions

Protected Member Functions


Detailed Description

A class consisting of helper methods to assist in creating web page templates. The methods in this class are not specific to any particular view and should work in all views.

This class was called Draw in dmBridge 1.x.

Author:
Alex Dolski <alex.dolski@unlv.edu> http://www.opensource.org/licenses/mit-license.php

Definition at line 19 of file DMGenericTemplateHelper.php.


Constructor & Destructor Documentation

DMGenericTemplateHelper::__construct ( DMAbstractView view,
DMSession session = null 
)
Parameters:
DMAbstractViewview
DMSessionsession

Reimplemented from DMAbstractTemplateHelper.

Definition at line 69 of file DMGenericTemplateHelper.php.


Member Function Documentation

DMGenericTemplateHelper::__call ( method,
args 
)

Assists in calling methods in template helpers and template helper modules. Not to be used publicly.

Parameters:
stringmethod Method name
arrayargs Method arguments

Definition at line 86 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::addBodyScriptCode ( code,
type = "text/javascript",
weight = 0 
)

Appends a script to the <body> script buffer, which can be accessed (e.g. for printing onto the page) via getHtmlBodyScriptTags().

getHtmlBodyScriptTags() will output script in the order they were added. Scripts should therefore be added in dependency order, e.g. library scripts should be added before scripts which depend on them.

Parameters:
stringsrc The publicly-accessible URI of the script. Should be an absolute URI path, if a local script.
stringtype
stringmedia
intweight
See also:
addHeadScriptTag()
removeBodyScriptTag()

Definition at line 125 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::addBodyScriptTag ( src,
type = "text/javascript",
weight = 0 
)

Appends a script to the <body> script buffer, which can be accessed (e.g. for printing onto the page) via getHtmlBodyScriptTags().

getHtmlBodyScriptTags() will output script in the order they were added. Scripts should therefore be added in dependency order, e.g. library scripts should be added before scripts which depend on them.

Parameters:
stringsrc The publicly-accessible URI of the script. Should be an absolute URI path, if a local script.
stringtype
stringmedia
intweight Integer from -99 to 99. Higher weights will be output before lower weights. Default is 0.
See also:
addHeadScriptTag()
removeBodyScriptTag()

Definition at line 152 of file DMGenericTemplateHelper.php.

Referenced by DMSearchTemplateHelper::helperWillRender().

DMGenericTemplateHelper::addHeadScriptTag ( src,
type = "text/javascript" 
)

Appends a script to the <head> script buffer, which can be accessed (e.g. for printing onto the page) via getHeadScripts().

getHeadScripts() will output script in the order they were added. Scripts should therefore be added in dependency order, e.g. library scripts should be added before scripts which depend on them.

Parameters:
stringsrc The publicly-accessible URI of the script. Should be an absolute URI path, if a local script.
stringtype
stringmedia
See also:
addBodyScriptTag()
removeHeadScriptTag()

Definition at line 314 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::addMetaTag ( content,
name,
http_equiv = null 
)

Appends a <meta> tag to the HTML <head> element. In general, only essential tags should be added.

If a tag with the same name or http-equiv value already exist, it will be overwritten.

Parameters:
stringcontent
stringname
stringhttp_equiv
See also:
removeMetaTag()

Definition at line 439 of file DMGenericTemplateHelper.php.

Referenced by __construct().

DMGenericTemplateHelper::addStylesheetTag ( href,
type = "text/css",
media = "screen" 
)

Appends a stylesheet to the HTML <head> element in a <link> tag.

If a stylesheet with a "href" identical to an existing stylesheet is added, it will overwrite the existing stylesheet.

Parameters:
stringhref The publicly-accessible URI of the stylesheet. Should be an absolute URI path, if a local stylesheet.
stringtype
stringmedia
See also:
removeStylesheet()

Definition at line 552 of file DMGenericTemplateHelper.php.

Referenced by DMSearchTemplateHelper::helperWillRender().

DMGenericTemplateHelper::getFeedURL ( format) [protected]
Parameters:
stringformat 'atom' or some other supported representation
Returns:
string

Definition at line 845 of file DMGenericTemplateHelper.php.

Referenced by getHtmlAtomFeedURL().

DMGenericTemplateHelper::getHtmlAtomFeedURL ( )

Returns the HTML-escaped absolute URL to the Atom feed corresponding to the current view.

Returns:
string
Since:
0.1

Definition at line 104 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlBodyScriptTags ( array $  exclude_filenames = array())
Parameters:
arrayexclude_filenames Array of filenames to exclude from the output.
Returns:
string Series of HTML <script> elements.
See also:
addBodyScriptTag()
addHeadScriptTag()

Definition at line 183 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlCollectionsAsPulldown ( )

Returns an HTML <select> menu with links to all other authorized collections.

Returns:
string
Since:
0.4

Definition at line 229 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlFormattedFlash ( )

Returns and erases the flash message from the user's session.

The flash is returned as an <p> element with classes dmFlash and one of dmSuccess, dmFailure, or dmNeutral. Do not use this method to check for the presence of a flash message; use DMSession::getFlash() instead.

Returns:
string The flash message, in a classed <p> element.
Since:
0.1

Definition at line 280 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlHeadScriptTags ( array $  exclude_filenames = array())
Parameters:
arrayexclude_filenames Array of filenames to exclude from the output.
Returns:
string Series of HTML <script> elements.
See also:
addHeadScriptTag()
removeHeadScriptTag()

Definition at line 341 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlLoginForm ( )

Renders the login form.

Returns:
HTML string
Since:
2.0

Definition at line 405 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlLoginPageLink ( login_text = "Login",
logout_text = "Logout" 
)

Conditionally returns a login or logout anchor tag depending on whether or not the user is logged in.

Parameters:
stringlogin_text
stringlogout_text
Returns:
HTML anchor tag pointing to the relative URI to the login params
See also:
loginURL()
logoutURL()
Since:
0.1

Definition at line 386 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlMetaTags ( )
Returns:
string Series of HTML <meta> elements.

Definition at line 463 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlRecentlyViewedObjectsAsList ( limit = 5,
thumbs = false 
)

Returns a hyperlinked ordered list of recently viewed objects, in descending chronological order.

Parameters:
intlimit The maximum number of recently viewed objects to display.
Booleanthumbs Whether or not to append thumbnails as <img> tags.
Returns:
string (X)HTML ordered list element
Since:
2.0

Definition at line 510 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlStylesheetTags ( )
Returns:
string Series of HTML <link> elements.

Definition at line 577 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlTagsAsCloud ( tag_limit = 20,
num_classes = 10,
randomize = true 
)

Generates a string of CONTENTdm(R) field vocabulary as styleable (X)HTML anchor tags.

Each anchor element has a class of "dmTag." If no tags exist, an empty string will be returned.

Parameters:
inttag_limit
intnum_classes
Booleanrandomize Whether to return the tags in random order or in order by count
Returns:
string HTML anchor tags

Definition at line 618 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlTermLinkedToSearch ( text_to_link,
DMObjectQuery query 
)
Parameters:
stringtext_to_link
DMObjectQueryquery
Returns:
string HTML anchor tag
Since:
0.1

Definition at line 665 of file DMGenericTemplateHelper.php.

Referenced by DMResultsTemplateHelper::getHtmlLinkedSuggestion().

DMGenericTemplateHelper::getHtmlVocabularyAsCloud ( array $  field_nicks,
tag_limit = 20,
num_classes = 10,
sample_size = 512,
randomize = true 
)

Generates a string of CONTENTdm(R) field vocabulary as styleable HTML anchor tags.

Each anchor element has a class of "dmTag dmTagX" where X may be a number from 1 to $num_classes.

Parameters:
DMCollectioncollection
arrayfield_nicks Array of field nicknames (not DMDCElement objects)
inttag_limit
intnum_classes Each tag will be returned with a class of dmTagX where X is an integer between 1 and $num_classes.
sample_sizeAn integer between 10 and 1024. A larger sample size is nice, but slower.
Booleanrandomize Whether to return the tags in random order or in order by count
Returns:
string HTML anchor tags
Since:
0.1

Definition at line 692 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlVocabularyAsList ( DMDCElement field,
linked = true 
)

Returns an alphabetized list of controlled terms in a given collection's field, specified by $field.

Parameters:
DMDCElementfield
Booleanlinked If true, links each term to an "exact" search for objects in $field's collection having a field nick value matching the term.
Returns:
string Set of HTML list elements
Since:
0.1

Definition at line 790 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::getHtmlVocabularyForSelect ( DMDCElement field)

Returns an alphabetized list of controlled terms in a given collection's field, specified by $field, as HTML <option> elements.

Parameters:
DMDCElementfield
Returns:
string HTML <option> elements
Since:
0.4

Definition at line 831 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::removeBodyScriptTag ( src)

Removes the script with the given src value.

Parameters:
stringsrc
Returns:
boolean True if the script was removed; false if the script was not found.
See also:
addBodyScriptTag()
removeHeadScriptTag()

Definition at line 211 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::removeHeadScriptTag ( src)

Removes the stylesheet with the given src value.

Use with caution as this may break certain functionality.

Parameters:
stringsrc
Returns:
boolean True if the script was removed; false if the script was not found.
See also:
addHeadScriptTag()

Definition at line 364 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::removeMetaTag ( name = null,
http_equiv = null 
)

Removes the meta tag with the given name or http-equiv value.

Parameters:
stringname Optional name
stringhttp_equiv Optional http-equiv
Returns:
boolean True if the tag was removed; false if the tag was not found.
See also:
addMetaTag()

Definition at line 487 of file DMGenericTemplateHelper.php.

DMGenericTemplateHelper::removeStylesheetTag ( href)

Removes the stylesheet with the given href value.

Use with caution as this may break certain functionality.

Parameters:
stringhref
Returns:
boolean True if the stylesheet was removed; false if the stylesheet was not found.
See also:
addStylesheet()

Definition at line 596 of file DMGenericTemplateHelper.php.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables