Comments: on this page. Click to read or post your own.

Class TableField

Description

TableField behaves in the same manner as TableListField, however allows the addition of fields and editing of attributes specified, and filtering results.

Caution: If you insert DropdownFields in the fieldTypes-array, make sure they have an empty first option. Otherwise the saving can't determine if a new row should really be saved.

Caution: TableField relies on {@FormResponse} to reload the field after it is saved. A TableField-instance should never be saved twice without reloading, because otherwise it can't determine if a field is new (=create) or existing (=update), and will produce duplicates.

  • todo: We should refactor this to support a single FieldSet instead of evaluated Strings for building FormFields

Located in /sapphire/forms/TableField.php (line 29)

Object
   |
   --ViewableData
      |
      --RequestHandlingData
         |
         --FormField
            |
            --TableListField
               |
               --TableField
Variable Summary
$extraData $extraData
mixed $fieldList
$fieldTypes $fieldTypes
mixed $filterField
mixed $filterValue
mixed $permissions
$requiredFields $requiredFields
mixed $showAddRow
mixed $sourceClass
mixed $sourceJoin
mixed $sourceSort
mixed $tempForm
$template $template
Method Summary
TableField __construct ( $name,  $sourceClass, [ $fieldList = null],  $fieldTypes, [ $filterField = null], [ $sourceFilter = null], [ $editExisting = true], [ $sourceSort = null], [ $sourceJoin = null])
String delete ()
void FieldHolder ()
array FieldList ()
array FieldSet ()
FieldSet FieldSetForRow ()
array getExtraData ()
void getField ( $fieldName, [ $combinedFieldName = null])
int ItemCount ()
void jsValidation ()
void php ( $data)
void saveData ( $dataObjects, [ $ExistingValues = true])
void saveInto ( $record)
void setExtraData ($extraData $extraData)
void setRequiredFields ( $fields)
void setTransformationConditions ( $conditions)
void sortData ( $data, [ $recordID = null])
void SubmittedFieldSet ( &$sourceItems)
void validate ( $validator)
Variables
$extraData $extraData (line 69)
  • var: array Any extra data that need to be included, e.g. to retain has-many relations. Format: array('FieldName' => 'Value')
  • access: protected
mixed $fieldList (line 35)
  • access: protected

Redefinition of:
TableListField::$fieldList
$fieldTypes $fieldTypes (line 54)
  • var: FieldSet Caution: Use {@setExtraData()} instead of manually adding HiddenFields if you want to preset relations or other default data.
  • access: protected
mixed $filterField = null (line 41)

A "Field = Value" filter can be specified by setting $this->filterField and $this->filterValue. This has the advantage of auto-populating

new records

  • access: protected
mixed $filterValue = null (line 47)

A "Field = Value" filter can be specified by setting $this->filterField and $this->filterValue. This has the advantage of auto-populating

new records

  • access: protected
mixed $permissions = array(
"edit",
"delete",
"add",
//"export",
)
(line 76)

Influence output without having to subclass the template.

  • access: protected

Redefinition of:
TableListField::$permissions
$requiredFields $requiredFields = null (line 90)
  • var: array Required fields as a numerical array. Please use an instance of Validator on the including form.
  • access: protected
mixed $showAddRow = true (line 100)

Shows a row of empty fields for adding a new record (turned on by default).

Please use TableField::$permissions to control if the "add"-functionality incl. button is shown at all.

  • access: public
mixed $sourceClass (line 31)
  • access: protected

Redefinition of:
TableListField::$sourceClass
mixed $sourceFilter (line 33)
  • access: protected

Redefinition of:
TableListField::$sourceFilter
mixed $sourceJoin (line 58)
  • access: protected

Redefinition of:
TableListField::$sourceJoin
mixed $sourceSort (line 56)
  • access: protected

Redefinition of:
TableListField::$sourceSort
mixed $tempForm (line 71)
  • access: protected
$template $template = "TableField" (line 63)
  • var: string Template-Overrides
  • access: protected

Redefinition of:
TableListField::$template
mixed $transformationConditions = array() (line 83)
  • access: public

Inherited Variables

Inherited from TableListField

TableListField::$actions
TableListField::$cachedSourceItems
TableListField::$clickAction
TableListField::$csvFieldEscape
TableListField::$csvFieldFormatting
TableListField::$csvHasHeader
TableListField::$csvSeparator
TableListField::$customCsvQuery
TableListField::$customQuery
TableListField::$customSourceItems
TableListField::$defaultAction
TableListField::$exportButtonLabel
TableListField::$extraLinkParams
TableListField::$fieldCasting
TableListField::$fieldFormatting
TableListField::$fieldListCsv
TableListField::$groupByField
TableListField::$highlightConditions
TableListField::$IsReadOnly
TableListField::$Markable
TableListField::$MarkableTitle
TableListField::$methodName
TableListField::$pageSize
TableListField::$readOnly
TableListField::$showPagination
TableListField::$summaryFieldList
TableListField::$summaryTitle
TableListField::$totalCount
TableListField::$url_handlers
TableListField::$__cachedQuery

Inherited from FormField

FormField::$containerFieldSet
FormField::$description
FormField::$disabled
FormField::$dontEscape
FormField::$extraClass
FormField::$extraClasses
FormField::$form
FormField::$leftTitle
FormField::$message
FormField::$messageType
FormField::$name
FormField::$readonly
FormField::$rightTitle
FormField::$tabIndex
FormField::$title
FormField::$value

Inherited from RequestHandlingData

RequestHandlingData::$allowed_actions
RequestHandlingData::$request

Inherited from ViewableData

ViewableData::$casting
ViewableData::$castingHelperPair_cache
ViewableData::$customisedObj
ViewableData::$failover
ViewableData::$iteratorPos
ViewableData::$iteratorTotalItems
ViewableData::$namedAs
ViewableData::$parent
ViewableData::$_natural_cache
ViewableData::$_object_cache
ViewableData::$_xml_cache

Inherited from Object

Object::$builtInMethods
Object::$class
Object::$classConstructed
Object::$extensions
Object::$extension_instances
Object::$extraMethods
Object::$extraStatics
Object::$statics
Object::$static_cached
Methods
Constructor __construct (line 102)
TableField __construct ( $name,  $sourceClass, [ $fieldList = null],  $fieldTypes, [ $filterField = null], [ $sourceFilter = null], [ $editExisting = true], [ $sourceSort = null], [ $sourceJoin = null])
  • $name
  • $sourceClass
  • $fieldList
  • $fieldTypes
  • $filterField
  • $sourceFilter
  • $editExisting
  • $sourceSort
  • $sourceJoin

Redefinition of:
TableListField::__construct()
delete (line 489)
String delete ()

Redefinition of:
TableListField::delete()
FieldHolder (line 475)

Sets the template to be rendered with

void FieldHolder ()

Redefinition of:
TableListField::FieldHolder()
FieldList (line 263)
array FieldList ()

Redefinition of:
TableListField::FieldList()
FieldSet (line 204)

Get all fields for each row contained in the TableField.

Does not include the empty row.

array FieldSet ()
FieldSetForRow (line 297)

Get all fields in a single row.

FieldSet FieldSetForRow ()
getExtraData (line 468)
array getExtraData ()
getField (line 338)

Needed for Form->callfieldmethod.

  • access: public
void getField ( $fieldName, [ $combinedFieldName = null])
  • $fieldName
  • $combinedFieldName

Redefinition of:
ViewableData::getField()
Get a field by it's name. This should be overloaded in child classes.
Headings (line 126)

Displays the headings on the template

DataObjectSet Headings ()

Redefinition of:
TableListField::Headings()
ItemCount (line 145)

Calculates the number of columns needed for colspans used in template

int ItemCount ()
Items (line 175)

Displays the items from sourceItems using the encapsulation object

DataObjectSet Items ()

Redefinition of:
TableListField::Items()
jsValidation (line 511)

Validation

void jsValidation ()

Redefinition of:
FormField::jsValidation()
javascript handler Functions for each field type by default formfield doesnt have a validation function
performDisabledTransformation (line 329)
void performDisabledTransformation ()

Redefinition of:
FormField::performDisabledTransformation()
Return a disabled version of this field
performReadonlyTransformation (line 323)
void performReadonlyTransformation ()

Redefinition of:
TableListField::performReadonlyTransformation()
php (line 548)
void php ( $data)
  • $data
saveData (line 356)

Called on save, it creates the appropriate objects and writes them to the database.

void saveData ( $dataObjects, [ $ExistingValues = true])
  • $dataObjects
  • $ExistingValues
saveInto (line 270)

Saves the Dataobjects contained in the field

void saveInto ( $record)

Redefinition of:
FormField::saveInto()
Method to save this form field into the given data object.
setExtraData (line 461)
void setExtraData ($extraData $extraData)
  • $extraData $extraData: array
setRequiredFields (line 603)
void setRequiredFields ( $fields)
  • $fields
setTransformationConditions (line 502)
void setTransformationConditions ( $conditions)
  • $conditions
sortData (line 433)

organises the data in the appropriate manner for saving

void sortData ( $data, [ $recordID = null])
  • $data
  • $recordID
sourceID (line 482)
Int sourceID ()

Redefinition of:
TableListField::sourceID()
sourceItems (line 154)

Returns the databased saved items, from DataObjects

DataObjectSet sourceItems ()

Redefinition of:
TableListField::sourceItems()
SubmittedFieldSet (line 224)
void SubmittedFieldSet ( &$sourceItems)
  • &$sourceItems
validate (line 563)
void validate ( $validator)
  • $validator

Redefinition of:
FormField::validate()
Validation Functions for each field type by default formfield doesnt have a validation function

Inherited Methods

Inherited From TableListField

TableListField::__construct()
TableListField::Actions()
TableListField::addSummary()
TableListField::ajax_refresh()
TableListField::BaseLink()
TableListField::Can()
TableListField::colFunction_avg()
TableListField::colFunction_sum()
TableListField::CurrentLink()
TableListField::delete()
TableListField::export()
TableListField::ExportLink()
TableListField::FieldHolder()
TableListField::FieldList()
TableListField::filterString()
TableListField::FirstItem()
TableListField::FirstLink()
TableListField::getCastedValue()
TableListField::getCsvQuery()
TableListField::getCsvSeparator()
TableListField::getExtraLinkParams()
TableListField::getPermissions()
TableListField::getQuery()
TableListField::GroupedItems()
TableListField::handleItem()
TableListField::HasGroupedItems()
TableListField::HasSummary()
TableListField::Headings()
TableListField::index()
TableListField::isFieldSortable()
TableListField::Items()
TableListField::LastItem()
TableListField::LastLink()
TableListField::ListStart()
TableListField::Name()
TableListField::NamePlural()
TableListField::NameSingular()
TableListField::NextLink()
TableListField::PageSize()
TableListField::performReadonlyTransformation()
TableListField::permissions_for_object()
TableListField::PrevLink()
TableListField::printall()
TableListField::PrintLink()
TableListField::removeCsvHeader()
TableListField::removeSummary()
TableListField::setClick_AjaxLoad()
TableListField::setClick_PopupLoad()
TableListField::setCSVFieldFormatting()
TableListField::setCsvSeparator()
TableListField::setCustomCsvQuery()
TableListField::setCustomQuery()
TableListField::setCustomSourceItems()
TableListField::setExtraLinkParams()
TableListField::setFieldCasting()
TableListField::setFieldFormatting()
TableListField::setFieldListCsv()
TableListField::setHighlightConditions()
TableListField::setPageSize()
TableListField::setPermissions()
TableListField::setShowPagination()
TableListField::setTemplate()
TableListField::ShowPagination()
TableListField::sourceClass()
TableListField::sourceFilter()
TableListField::sourceID()
TableListField::sourceItems()
TableListField::SummaryFields()
TableListField::SummaryTitle()
TableListField::Title()
TableListField::TotalCount()
TableListField::Utility()

Inherited From FormField

FormField::__construct()
FormField::addExtraClass()
FormField::attrName()
FormField::attrTitle()
FormField::attrValue()
FormField::createTag()
FormField::dataValue()
FormField::debug()
FormField::describe()
FormField::extraClass()
FormField::Field()
FormField::FieldHolder()
FormField::forTemplate()
FormField::getForm()
FormField::getTabIndex()
FormField::getTabIndexHTML()
FormField::hasClass()
FormField::hasData()
FormField::id()
FormField::isComposite()
FormField::isDisabled()
FormField::isReadonly()
FormField::jsValidation()
FormField::LeftTitle()
FormField::Link()
FormField::Message()
FormField::MessageType()
FormField::Name()
FormField::name_to_label()
FormField::performDisabledTransformation()
FormField::performReadonlyTransformation()
FormField::removeExtraClass()
FormField::Required()
FormField::RightTitle()
FormField::rootFieldSet()
FormField::saveInto()
FormField::setContainerFieldSet()
FormField::setDisabled()
FormField::setError()
FormField::setForm()
FormField::setLeftTitle()
FormField::setName()
FormField::setReadonly()
FormField::setRightTitle()
FormField::setTabIndex()
FormField::setTitle()
FormField::setValue()
FormField::SmallFieldHolder()
FormField::Title()
FormField::transform()
FormField::Type()
FormField::validate()
FormField::Value()

Inherited From RequestHandlingData

RequestHandlingData::checkAccessAction()
RequestHandlingData::getRequest()
RequestHandlingData::handleRequest()
RequestHandlingData::httpError()

Inherited From ViewableData

ViewableData::ATT_val()
ViewableData::BaseHref()
ViewableData::buildCastingHelperCache()
ViewableData::cachedCall()
ViewableData::castingHelper()
ViewableData::castingHelperPair()
ViewableData::castingObjectCreator()
ViewableData::castingObjectCreatorPair()
ViewableData::CSSClasses()
ViewableData::CurrentMember()
ViewableData::CurrentPage()
ViewableData::customise()
ViewableData::Debug()
ViewableData::defineMethods()
ViewableData::escapeTypeForField()
ViewableData::Even()
ViewableData::EvenOdd()
ViewableData::First()
ViewableData::FirstLast()
ViewableData::getField()
ViewableData::getIterator()
ViewableData::getXMLValues()
ViewableData::hasField()
ViewableData::HasPerm()
ViewableData::hasValue()
ViewableData::i18nLocale()
ViewableData::IsAjax()
ViewableData::iteratorProperties()
ViewableData::JS_val()
ViewableData::Last()
ViewableData::Me()
ViewableData::Middle()
ViewableData::MiddleString()
ViewableData::obj()
ViewableData::Odd()
ViewableData::Pos()
ViewableData::RAW_val()
ViewableData::renderWith()
ViewableData::SecurityID()
ViewableData::setCustomisedObj()
ViewableData::setField()
ViewableData::SQL_val()
ViewableData::ThemeDir()
ViewableData::Top()
ViewableData::TotalItems()
ViewableData::val()
ViewableData::XML_val()
ViewableData::__get()
ViewableData::__isset()
ViewableData::__set()

Inherited From Object

Object::__construct()
Object::addMethodsFrom()
Object::addStaticVars()
Object::addWrapperMethod()
Object::add_extension()
Object::allMethodNames()
Object::buildMethodList()
Object::cacheToFile()
Object::cacheToFileWithArgs()
Object::create()
Object::createMethod()
Object::defineMethods()
Object::exists()
Object::extend()
Object::extInstance()
Object::getCustomClass()
Object::hasExtension()
Object::hasMethod()
Object::invokeWithExtensions()
Object::is_a()
Object::loadCache()
Object::parentClass()
Object::sanitiseCachename()
Object::saveCache()
Object::set_stat()
Object::set_uninherited()
Object::stat()
Object::strong_create()
Object::uninherited()
Object::useCustomClass()
Object::__call()
Object::__toString()
blog comments powered by Disqus

Documentation generated on Sun, 19 Oct 2008 06:46:30 +1300 by phpDocumentor 1.3.2