PHPonTrax
[ class tree: PHPonTrax ] [ index: PHPonTrax ] [ all elements ]

Class: Helpers

Source Location: /vendor/trax/action_view/helpers.php

Class Overview


Basic helper functions


Variables

Methods


Child classes:

ExtHelpers
Extend Helpers class to test protected methods
AssetTagHelper
Utility to help build HTML/XML link tags for public assets
DateHelper
Utility to help build HTML pulldown menus for date and time
JavaScriptHelper
FormTagHelper
UrlHelper
FormHelper
ActiveRecordHelper

Class Details

[line 36]
Basic helper functions

A collection of methods used to generate basic HTML/XML.




[ Top ]


Class Variables

$attribute_name =

[line 54]



Tags:


Type:   mixed


[ Top ]

$auto_index =

[line 42]



Tags:

usedby:  FormHelper::add_default_name_and_id()
usedby:  Helpers::__construct()
access:  public
todo:  Document this variable

Type:   boolean


[ Top ]

$controller_name =

[line 72]

Current controller name

Local copy of $GLOBALS['current_controller_name']




Tags:

usedby:  Helpers::__construct()
access:  public

Type:   string


[ Top ]

$controller_object =

[line 64]

Current controller object

Local copy of $GLOBALS['current_controller_object']
NB: object() faults if this does not contain a valid instance of ActionController.




Tags:


Type:   ActionController


[ Top ]

$controller_path =

[line 80]

Current controller path

Local copy of $GLOBALS['current_controller_path']




Tags:

usedby:  UrlHelper::url_for()
usedby:  Helpers::__construct()
access:  public

Type:   string


[ Top ]

$object_name =

[line 49]



Tags:


Type:   string


[ Top ]



Class Methods


constructor __construct [line 95]

Helpers __construct( [string $object_name = null], [string $attribute_name = null])

Construct a Helpers object



Tags:



Overridden in child classes as:

ExtHelpers::__construct()
AssetTagHelper::__construct()
DateHelper::__construct()
Constructor
JavaScriptHelper::__construct()
FormHelper::__construct()

Parameters:

string   $object_name   Name of ActiveRecord subclass
string   $attribute_name   Attribute of ActiveRecord subclass

[ Top ]

method boolean_attribute [line 221]

void boolean_attribute( string[] &$options, string $attribute)

Convert an attribute to proper XML boolean form



Tags:

return:  Contents of $options have been converted
usedby:  Helpers::convert_options()
access:  protected


Overridden in child classes as:

ExtHelpers::boolean_attribute()

Parameters:

string[]   $options  
string   $attribute  

[ Top ]

method cdata_section [line 241]

string cdata_section( string $content)

Wrap CDATA begin and end tags around argument

Returns a CDATA section for the given content. CDATA sections are used to escape blocks of text containing characters which would otherwise be recognized as markup. CDATA sections begin with the string <![CDATA[ and end with (and may not contain) the string ]]>.




Tags:

return:  Wrapped argument


Parameters:

string   $content   Content to wrap

[ Top ]

method content_tag [line 293]

string content_tag( string $name, string $content, [string[] $options = array()])

Generate an open/close pair of tags with optional attributes and content between

  • Example: content_tag("p", "Hello world!");
    Returns: <p>Hello world!</p>\n
  • Example: content_tag("div", content_tag("p", "Hello world!"), array("class" => "strong"));
    Returns: <div class="strong"><p>Hello world!</p></div>\n




Tags:



Overridden in child classes as:

ActiveRecordHelper::content_tag()

Parameters:

string   $name   Tag to wrap around $content
string   $content   Text to put between tags
string[]   $options   Tag attributes to apply, specified as array('attr1' => 'value1'[, 'attr2' => 'value2']...)

[ Top ]

method convert_options [line 207]

string[] convert_options( [string[] $options = array()])

Convert selected attributes to proper XML boolean form



Tags:

return:  Input argument with selected attributes converted to proper XML boolean form
access:  protected
uses:  Helpers::boolean_attribute()


Overridden in child classes as:

ExtHelpers::convert_options()

Parameters:

string[]   $options  

[ Top ]

method object [line 169]

mixed object( [string $object_name = null])

Given the name of an ActiveRecord subclass, find an instance

Finds the AR instance from the ActionController instance. Assumes that if a $object_name is defined either as the argument or an instance variable, then there must be a controller object instance which points to a single instance of the ActiveRecord. FIXME: Handle errors better.




Tags:



Overridden in child classes as:

ExtHelpers::object()

Parameters:

string   $object_name   Name of an ActiveRecord subclass or null

[ Top ]

method tag [line 265]

string tag( string $name, [string[] $options = array()], [mixed $open = false], boolean $open )

Generate an HTML or XML tag with optional attributes and self-ending

  • Example: tag("br");
    Returns: <br />\n
  • Example: tag("div", array("class" => "warning"), true);
    Returns: <div class="warning">\n




Tags:



Overridden in child classes as:

ActiveRecordHelper::tag()

Parameters:

string   $name   Tag name
string[]   $options   Tag attributes to apply, specified as array('attr1' => 'value1'[, 'attr2' => 'value2']...)
boolean   $open   
  • true => make opening tag (end with '>')
  • false => make self-terminating tag (end with ' \>')

[ Top ]

method tag_options [line 185]

string tag_options( string[] $options)

Convert array of tag attribute names and values to string



Tags:

usedby:  Helpers::content_tag()
usedby:  Helpers::tag()
access:  protected


Parameters:

string[]   $options  

[ Top ]

method to_content_tag [line 305]

void to_content_tag( mixed $tag_name, [mixed $options = array()])



Tags:



[ Top ]

method value [line 137]

void value( )

Get value of current attribute in the current ActiveRecord object

If there is a value in $_REQUEST[][], return it. Otherwise fetch the value from the database.




Tags:



Overridden in child classes as:

DateHelper::value()
Get attribute value from $_REQUEST if there, otherwise from database
ExDateHelper::value()

[ Top ]


Documentation generated on Thu, 04 May 2006 19:47:44 -0600 by phpDocumentor 1.3.0RC4