SchemaField |
![]() |
SchemaField - class to represent and manipulate a schema field
Shane P. McCarron <shane@aptest.com>
Copyright 1999-2006 Applied Testing and Technology, Inc. All Rights Reserved.
use Schema;
use SchemaField;
# create a schema object
$schema = new Schema(suiteName);
# get an individual field
$field = $schema->field(fieldName);
# get the prompt for a field
$prompt = $field->prompt();
The SchemaField object is used by Schema objects to access and manipulate their fields. It is also available directly to applications, should they need to access the attributes of a schema field.
$field = new SchemaField(hash);
Creates a new SchemaField object and associates its attributes with the object.
returns a reference to the SchemaField object.
$name = $field->name();
$field->cantSelect();
$field->canSearch();
$default = $field->default();
@descs = $field->descs();
$desc = $field->descOf($value) ;
Returns the associated description if the variable is a list. If value if a reference to an array, then returns a reference to an array of descriptions.
$flags = $field->getFlags();
Returns a value for the FLAGS field of a SCHEMA2 file.
$field->hidden();
If there are hRules defined for the field, highlight the data that matches those rules.
$output = $field->highlight($input) ;
input is a string to highlight.
Output is returned with any matching data highlighted.
If there are hRules defined for the field, mark the data that matches those rules, ready for doHighlight() later.
$output = $field->highlight( input, displayStr );
input is a string to highlight.
if displayStr is specified, then if input matches a rule, display displayStr instead, highlighted. This is used for menu fields.
Returns input (or displayStr, where appropriate) with matching areas bounded by \03 and \04.
$output = $field->doHighlight( value );
value is the string to process.
Returns value, after replacing \03 and \04 (inserted by prepHighlight) with HTML for applying highlighting.
If the field is markup, doHighlight also escapes the markup so the field is displayed "as is".
$status = $field->hRules(pattern [, isCaseSensitive [, isRE]]) ;
pattern is the pattern to highlight.
isCaseSensitive indicates the pattern is case sensitive (defaults to no).
isRE indicates the pattern is a regular expression (defaults to no).
Returns 1 if successful, 0 if it failed for some reason.
$field->inHistory( [ fname ] );
fname - the name of the field.
$field->inTable( [ fname ] );
fname - the name of the field.
$field->isDate() ;
$field->isList();
$field->isRange();
$field->isMarkup();
$field->isText();
$label = $field->label();
$selectable = $field->selectable();
$searchable = $field->searchable();
$field->fixFlags() ;
Returns nothing.
$field->setFlags(flags);
Returns nothing
$size = $field->size(size);
Returns the current size of the field.
$size = $field->sizeAsHtml(limit);
returns a string suitable for use in the appropriate input element.
$type = $field->type();
$prompt = $field->prompt();
@vlist = $field->values();
$style = $field->style();
$visible = $field->visible();
Really a no-op, since this object does not have a database.
$value = $field->WHATEVER();
$value = $field->WHATEVER(newvalue);
Updates the setting of the WHATEVER attribute. Returns the current or new setting.
Copyright © 2000-2006 Applied Testing and Technology, Inc. All rights reserved.