TITAN Library for PHP5  5.1.0
Web Software Development Kit for PHP5
fields Class Reference

Titan Field Handler Class. More...

Public Member Functions

 __construct ($table)
 
 form ($action)
 
 field ($name)
 
 hidden ($field, $value)
 
 hiddens (&$obj)
 
make_pairs (&$arry, $key, $val)
 
 build (&$obj, $field, $desc, $read_only=false, $options=false, $values=false, $default=false)
 
 form_builder_field (&$obj, $field, $read_only=false, $use_def_values=false)
 

Detailed Description

Titan Field Handler Class.

Class: \tl\data\fields

Requires: html class

Author
James E. Bush work@.nosp@m.bush.nosp@m..cc
Version
5.1.0

Constructor & Destructor Documentation

__construct (   $table)

Constructor

Parameters
string$tableThe table to compare

Member Function Documentation

form (   $action)

Open the form

Parameters
string$actionThe form action location
field (   $name)

Mark a field as manually handled

Parameters
string$nameThe field name to mark as manually handled
hidden (   $field,
  $value 
)

Create a hidden field and mark it as handled

Parameters
string$fieldThe hidden field name
mixed$valueThe hidden field value
hiddens ( $obj)

Create hidden fields for all unhandled fields

Parameters
object$objThe object containing default values
& make_pairs ( $arry,
  $key,
  $val 
)

Make an array of key/value pairs pulling a pair from each member of an array of objects

Parameters
array$arryThe source array
string$keyThe property to use as the key
string$valThe property to use as the value

Example:

    //  Get a list to become select input options
    $qq = "select `item_id` as `id`, `description` from `table`";
    $list = $db->get_rows($qq);
    $list = $this->fields->make_pairs($list, 'id', 'description');
build ( $obj,
  $field,
  $desc,
  $read_only = false,
  $options = false,
  $values = false,
  $default = false 
)

Build an HTML field to represent an object property

Parameters
object$objThe object containing the default value
string$fieldThe field name to create
string$descThe field Description
boolean$read_only(optional) Is the field read-only? (default) false
mixed$options(optional) Array of select input options (default) false
mixed$values(optional) Array of select input currently selected values (default) false
mixed$default(optional) Default value (overrides object default value (default) false
form_builder_field ( $obj,
  $field,
  $read_only = false,
  $use_def_values = false 
)

Builds a field by generating data to call build()

Parameters
object$objThe object to use
string$fieldThe field name to build
boolean$read_only(optional) Is the field read-only? (default) false
boolean$use_def_values(optional) Use default values? Or, is the field an enum? (default) false

The documentation for this class was generated from the following file: