Andrew's Web Libraries (AWL)
Loading...
Searching...
No Matches
EditorField Class Reference

Public Member Functions

 __construct ( $field, $sql="", $lookup_sql="")
 
 Set ($value)
 
 SetSql ( $sql)
 
 SetLookup ( $lookup_sql)
 
 SetOptionList ( $options, $current=null, $parameters=null)
 
 GetTarget ()
 
 AddAttribute ( $k, $v)
 
 RenderLabel ( $wrapme)
 
 RenderAttributes ()
 

Public Attributes

 $Field
 
 $Sql
 
 $Value
 
 $Attributes
 
 $LookupSql
 
 $OptionList
 

Detailed Description

Definition at line 19 of file classEditor.php.

Constructor & Destructor Documentation

◆ __construct()

EditorField::__construct (   $field,
  $sql = "",
  $lookup_sql = "" 
)

Creates an EditorField for use in the Editor, possibly initialising the SQL for calculating it's value, and lookup_sql for use in drop-down lists.

Parameters
unknown$field
string$sql
string$lookup_sql

Definition at line 36 of file classEditor.php.

Member Function Documentation

◆ AddAttribute()

EditorField::AddAttribute (   $k,
  $v 
)

Add some kind of attribute to this field, such as a 'class' => 'fancyinputthingy'

Parameters
string$kThe attribute name
string$vThe attribute value

Definition at line 116 of file classEditor.php.

◆ GetTarget()

EditorField::GetTarget ( )

Definition at line 105 of file classEditor.php.

◆ RenderAttributes()

EditorField::RenderAttributes ( )

Render the array of attributes for inclusion in the input tag.

Returns
string

Definition at line 140 of file classEditor.php.

◆ RenderLabel()

EditorField::RenderLabel (   $wrapme)

Render a LABEL around something. In particular it is useful to render a label around checkbox fields to include their labels and make them clickable.

The label value itself must be in the '_label' attribute, and the field must also have an 'id' attribute.

Parameters
string$wrapmeThe rendered field to be wrapped
Returns
string

Definition at line 128 of file classEditor.php.

◆ Set()

EditorField::Set (   $value)

Definition at line 44 of file classEditor.php.

◆ SetLookup()

EditorField::SetLookup (   $lookup_sql)

Set the lookup SQL to use to populate a SELECT for this field.

Parameters
string$lookup_sql

Definition at line 60 of file classEditor.php.

◆ SetOptionList()

EditorField::SetOptionList (   $options,
  $current = null,
  $parameters = null 
)

Set the SELECT values explicitly, if they are not available in SQL.

For example:

SetOptionList(array('M' => 'Male', 'F' => 'Female', 'O' => 'Other'), 'F', array('maxwidth' => 6, 'translate' => true));

This would present Male/Female/Other drop-down, when in another language the values would be translated (if available), e.g. in German as Männlich/Weiblich/Andere, except that in this case Männli/Weibli/Andere, since the values would be truncated to maxwidth.

Parameters
array$optionsAn array of key => value pairs
string$currentThe currently selected key
string$parametersAn array of parameters (maxwidth & translate are the only valid parameters)

Definition at line 79 of file classEditor.php.

◆ SetSql()

EditorField::SetSql (   $sql)

Set the SQL used for this field, if it is more than just a field name.

Parameters
unknown$sql

Definition at line 52 of file classEditor.php.

Member Data Documentation

◆ $Attributes

EditorField::$Attributes

Definition at line 24 of file classEditor.php.

◆ $Field

EditorField::$Field

Definition at line 21 of file classEditor.php.

◆ $LookupSql

EditorField::$LookupSql

Definition at line 25 of file classEditor.php.

◆ $OptionList

EditorField::$OptionList

Definition at line 26 of file classEditor.php.

◆ $Sql

EditorField::$Sql

Definition at line 22 of file classEditor.php.

◆ $Value

EditorField::$Value

Definition at line 23 of file classEditor.php.


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