Overview

Packages

  • awl
    • AuthPlugin
    • AwlDatabase
    • Browser
    • classEditor
    • DataEntry
    • DataUpdate
    • EMail
    • iCalendar
    • MenuSet
    • PgQuery
    • Session
    • Translation
    • User
    • Utilities
    • Validation
    • vCalendar
    • vComponent
    • XMLDocument
    • XMLElement
  • None

Classes

  • EntryField
  • EntryForm
  • Overview
  • Package
  • Class

Class EntryField

Individual fields used for data entry / viewing.

This object is not really intended to be used directly. The more normal interface is to instantiate an EntryForm and then issue calls to DataEntryLine() and other EntryForm methods.

Understanding the operation of this class (and possibly auditing the source code, particularly EntryField::Render) will however convey valuable understanding of some of the more esoteric features.

Package: awl\DataEntry
Copyright: Catalyst IT Ltd, Morphoss Ltd http://www.morphoss.com/
License: GNU GPL v2
Author: Andrew McMillan andrew@mcmillan.net.nz
Located at DataEntry.php
Methods summary
public
# EntryField( text $intype, text $inname, text $attributes = "", text $current_value = "" )

Initialise an EntryField, used for data entry.

Initialise an EntryField, used for data entry.

The following types of fields are possible:

  • select - Will display a select list of the keys/values in $attributes where the key starts with an underscore. The key will have the '_' removed before being used as the key in the list. All the $attributes with keys not beginning with '_' will be used in the normal manner as HTML attributes within the <select ...> tag.
  • lookup - Will display a select list of values from the database. If $attributes defines a '_sql' attibute then that will be used to make the list, otherwise the database values will be from the 'codes' table as in "SELECT code_id, code_value FROM codes WHERE code_type = '_type' ORDER BY code_seq, code_id" using the value of $attributes['_type'] as the code_type.
  • date - Will be a text field, expecting a date value which might be javascript validated at some point in the future.
  • checkbox - Will display a checkbox for an on-off value.
  • textarea - Will display an HTML textarea.
  • file - Will display a file browse / enter field.
  • button - Will display a button field.
  • password - Password entry. This will display entered data as asterisks.

The $attributes array is useful to set specific HTML attributes within the HTML tag used for the entry field however $attribute keys named starting with an underscore ('') affect the field operation rather than the HTML. For the 'select' field type, these are simply used as the keys / values for the selection (with the '' removed), but other cases are more complex:

  • _help - While this will be ignored by the EntryField::Render() method the _help should be assigned (or will be assigned the same value as the 'title' attribute) and will (depending on the data-entry line format in force) be displayed as help for the field by the EntryForm::DataEntryLine() method.
  • _sql - When used in a 'lookup' field this controls the SQL to return keys/values for the list. The actual SQL should return two columns, the first will be used for the key and the second for the displayed value.
  • _type - When used in a 'lookup' field this defines the codes type used.
  • _null - When used in a 'lookup' field this will control the description for an option using a '' key value which will precede the list of values from the database.
  • _zero - When used in a 'lookup' field this will control the description for an option using a '0' key value which will precede the list of values from the database.
  • _label - When used in a 'radio' or 'checkbox' field this will wrap the field with an HTML label tag as
  • -

Parameters

$intype

The type of field: select | lookup | date | checkbox | textarea | file | button | password (anything else is dealt with as "text")

$inname
The name of the field.
$attributes

An associative array of extra attributes to be applied to the field. Optional, but generally important. Some $attribute keys have special meaning, while others are simply added as HTML attributes to the field.

$current_value

The current value to use to initialise the field. Optional.

public text
# Render( )

Render an EntryField into HTML

Render an EntryField into HTML

Returns

text
An HTML fragment for the data-entry field.

See

EntryField::EntryField(), EntryForm::DataEntryLine()
public
# new_lookup( array $attributes )

Function called indirectly when a new EntryField of type 'lookup' is created.

Function called indirectly when a new EntryField of type 'lookup' is created.

Parameters

$attributes

The attributes array that was passed in to the new EntryField() constructor.

public static string
# BuildOptionList( string $qry, string $current = '', array $location = 'options', $parameters = false )

Build an option list from the query.

Build an option list from the query.

Parameters

$qry
$current Default selection of drop down box (optional)
$current
$location for debugging purposes
$location
$parameters an array further parameters, including 'maxwidth' => 20 to set a maximum width
$parameters

Returns

string
Select box HTML
Properties summary
public string $fname

The name of the field

The name of the field

#
public string $ftype

The type of entry field

The type of entry field

#
public string $current

The current value

The current value

#
public string $attributes

An array of key value pairs

An array of key value pairs

#
public string $rendered

Once it actually is...

Once it actually is...

#
API documentation generated by ApiGen