PHP Класс Field_Base, atk4

Наследование: extends AbstractObject
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$actual_field
$allowHTML
$auto_track_element
$caption
$defaultValue
$description
$display ???
$editable
$emptyText
$group
$has_default_value
$hidden
$hint
$listData array | null
$mandatory
$onField Callbacks
$owner Model
$placeholder
$readonly
$searchable
$sortable
$system
$theModel
$type
$visible

Защищенные свойства (Protected)

Свойство Тип Описание
$table

Открытые методы

Метод Описание
__toString ( ) : string If field is accidentally converted to string, provide some descriptive information.
actual ( string $t = UNDEFINED ) : string | $this In most cases $model['field'] would match "field" inside a database. In some cases, however, you would want to use different database field. This can happen when you join multiple tables and 'field' appears in multiple tables.
allowHTML ( boolean $t = UNDEFINED ) : boolean | $this Configures the behavior of Form to disable tag stripping form user input.
caption ( string $t = UNDEFINED ) : string | $this Sets field caption which will be used by forms, grids and other view elements as a label. The caption will be localized through $app->_().
defaultValue ( boolean $t = UNDEFINED ) : boolean | $this Default Value is used inside forms when you present them without loaded data. This does not change how model works, which will simply avoid including unchanged field into insert/update queries.
display ( mixed $t = UNDEFINED ) : mixed | $this Normally views will attempt to pick most suitable way to present field.
editable ( boolean $t = UNDEFINED ) : boolean | $this Set editable to false, if you want to exclude field from forms or other means of editing data. This does not affect the actual model values.
emptyText ( string $t = UNDEFINED ) : string | $this What to display when nothing is selected or entered? This will be displayed on a drop-down when no value is selected: ("Choose .
enum ( array $t ) : array Similar to listData() but accepts array of values instead of hash:.
get ( ) : mixed Get the value of the field of a loaded model. If model is not loaded will return default value instead.
getBooleanValue ( mixed $value ) : integer | null Converts true/false into boolean representation according to the "enum"
getModel ( ) : string Returns current model. This is different than other setters getters, but it's done to keep consistency with the rest of Agile Toolkit.
group ( string $t = UNDEFINED ) : string | $this While you may use visible(), editable() to include or exclude fields from appearing in certain scenarios, you can also define a group which you then can display instead of listing all fields manually inside setModel(). Read more about Actual Fields.
hidden ( boolean $t = UNDEFINED ) : boolean | $this Hide field. Not sure!
hint ( string $t = UNDEFINED ) : string | $this Sets field hint which will be used by forms.
length ( integer $t = UNDEFINED ) : integer | $this This will provide a HTML settings on a field for maximum field size.
listData ( array $t = UNDEFINED ) : array | $this Supplies a list data for multi-value fields (selects, radio buttons, checkbox area, autocomplete). You may also use enum(). This setting is typically used with a static falues (Male / Female), if your field values could be described through a different model, use setModel() or better yet - hasOne().
mandatory ( boolean $t = UNDEFINED ) : boolean | $this Asterisk will be displayed by the form (if field is include in "actual" fields. This property will not affect the direct use of the field inside model. If you would like that your model complains about empty fields, you should edit beforeSave hook.
onField ( callback $c = UNDEFINED ) : string | $this Pass a callback to onField() which is executed with the argument containing a field view, when model is associated with a form.
placeholder ( string $t = UNDEFINED ) : string | $this Sets field placeholder (gray text inside input when it's empty).
readonly ( boolean $t = UNDEFINED ) : boolean | $this Read only setting will affect the way how field is presented by views.
required ( boolean $t = UNDEFINED ) : boolean | $this
sanitize ( mixed $value ) : mixed This is used in Controller_Data_SQL to sanitize the value forwarded to dsql.
searchable ( boolean $t = UNDEFINED ) : boolean | $this Setting searchable(true) will instruct Filter and similar views that it should be possible to perform search by this field.
set ( mixed $value = null ) : Field Sets the value of the field. Identical to $model[$fieldname]=$value.
setModel ( string $t = UNDEFINED ) : string | $this Will execute setModel() on a field. Some fields will change their behaviour with this. The value is a string (either Model_Book or Book) but you might be able to use object also.
setValueList ( array $t ) : array Same as listData().
setterGetter ( string $type, mixed $value = UNDEFINED ) : mixed | $this Implementation of generic setter-getter method which supports "UNDEFINED" constant. This method is used by all other sette-getters.
sortable ( boolean $t = UNDEFINED ) : boolean | $this Will instruct Grid and similar views that the sorting controls must be enabled for this field.
system ( boolean $t = UNDEFINED ) : boolean | $this Marking field as system will cause it to always be loaded, even if it's not requested through Actual Fields. It will also hide the field making it dissapear from Grids and Forms. A good examples of system fields are "id" or "created_dts".
table ( string $t = UNDEFINED ) : string | $this If is set, it contains the correct table that stores this field.
type ( string $t = UNDEFINED ) : string | $this Logical type of model field. This universal type is recognized by view controllers (such as Controller_MVCForm, Controller_MVCGrid to convert into supported field types.
visible ( boolean $t = UNDEFINED ) : boolean | $this Controls field appearance in Grid or similar views.

Описание методов

__toString() публичный Метод

If field is accidentally converted to string, provide some descriptive information.
public __toString ( ) : string
Результат string descriptive

actual() публичный Метод

You can specify actual field when you declare a field within a model: $model->addField('modelfield','dbfield'); If you are unable to use addField (such as using custom field class), you can use actual() modifier: $model->add('filestore/File','modelfield')->actual('dbfield'); Another potential use is if your database structure does not match model convention: $model->hasOne('Book')->actual('IDBOOK');
public actual ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

allowHTML() публичный Метод

By default all tags are stripped, setting this property to true will no longer strip tags.
public allowHTML ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

caption() публичный Метод

Sets field caption which will be used by forms, grids and other view elements as a label. The caption will be localized through $app->_().
public caption ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

defaultValue() публичный Метод

Default Value is used inside forms when you present them without loaded data. This does not change how model works, which will simply avoid including unchanged field into insert/update queries.
public defaultValue ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

display() публичный Метод

For example, type='date' will be presented with DatePicker field in form. You might be using add-ons or might have created your own field class. If you would like to use it to present the field, use display(). If you specify string it will be used by all views, otherwise specify it as associtive array:. $field->display(array('form'=>'line','grid'=>'button'));
public display ( mixed $t = UNDEFINED ) : mixed | $this
$t mixed new value
Результат mixed | $this current value if $t=UNDEFINED

editable() публичный Метод

Set editable to false, if you want to exclude field from forms or other means of editing data. This does not affect the actual model values.
public editable ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

emptyText() публичный Метод

.") if you are using this setting with a text field it will set a placeholder HTML property.
public emptyText ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

enum() публичный Метод

listData(array(1=>'Male', 2=>'Female')); enum(array('male','female')); The value will be stored in database and also displayed to user.
public enum ( array $t ) : array
$t array Array( id => val )
Результат array current value if $t=UNDEFINED

get() публичный Метод

Get the value of the field of a loaded model. If model is not loaded will return default value instead.
public get ( ) : mixed
Результат mixed current value of a field

getBooleanValue() публичный Метод

Converts true/false into boolean representation according to the "enum"
public getBooleanValue ( mixed $value ) : integer | null
$value mixed
Результат integer | null

getModel() публичный Метод

Returns current model. This is different than other setters getters, but it's done to keep consistency with the rest of Agile Toolkit.
public getModel ( ) : string
Результат string current associated model Class

group() публичный Метод

While you may use visible(), editable() to include or exclude fields from appearing in certain scenarios, you can also define a group which you then can display instead of listing all fields manually inside setModel(). Read more about Actual Fields.
public group ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

hidden() публичный Метод

Hide field. Not sure!
public hidden ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

hint() публичный Метод

Sets field hint which will be used by forms.
public hint ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

length() публичный Метод

The length of a field will not be enforced by this setting.
public length ( integer $t = UNDEFINED ) : integer | $this
$t integer new value
Результат integer | $this current value if $t=UNDEFINED

listData() публичный Метод

Supplies a list data for multi-value fields (selects, radio buttons, checkbox area, autocomplete). You may also use enum(). This setting is typically used with a static falues (Male / Female), if your field values could be described through a different model, use setModel() or better yet - hasOne().
public listData ( array $t = UNDEFINED ) : array | $this
$t array Array( id => val )
Результат array | $this current value if $t=UNDEFINED

mandatory() публичный Метод

Asterisk will be displayed by the form (if field is include in "actual" fields. This property will not affect the direct use of the field inside model. If you would like that your model complains about empty fields, you should edit beforeSave hook.
public mandatory ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

onField() публичный Метод

Pass a callback to onField() which is executed with the argument containing a field view, when model is associated with a form.
public onField ( callback $c = UNDEFINED ) : string | $this
$c callback new value
Результат string | $this current value if $t=UNDEFINED

placeholder() публичный Метод

Sets field placeholder (gray text inside input when it's empty).
public placeholder ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

readonly() публичный Метод

While model field is still writable directly, the Form will not try to change the value of this field.
public readonly ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

required() публичный Метод

Устаревший: 4.3.0 use mandatory() instead
public required ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

sanitize() публичный Метод

This is used in Controller_Data_SQL to sanitize the value forwarded to dsql.
public sanitize ( mixed $value ) : mixed
$value mixed
Результат mixed

searchable() публичный Метод

Setting searchable(true) will instruct Filter and similar views that it should be possible to perform search by this field.
public searchable ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

set() публичный Метод

Sets the value of the field. Identical to $model[$fieldname]=$value.
public set ( mixed $value = null ) : Field
$value mixed new value
Результат Field $this

setModel() публичный Метод

I suggest to use $model->hasOne($model) instead of setModel($model)
public setModel ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

setValueList() публичный Метод

Same as listData().
public setValueList ( array $t ) : array
$t array Array( id => val )
Результат array current value if $t=UNDEFINED

setterGetter() публичный Метод

Implementation of generic setter-getter method which supports "UNDEFINED" constant. This method is used by all other sette-getters.
public setterGetter ( string $type, mixed $value = UNDEFINED ) : mixed | $this
$type string Corresponds to the name of property of a field
$value mixed New value for a property.
Результат mixed | $this new or current pperty (if value is UNDEFINED)

sortable() публичный Метод

Will instruct Grid and similar views that the sorting controls must be enabled for this field.
public sortable ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

system() публичный Метод

Marking field as system will cause it to always be loaded, even if it's not requested through Actual Fields. It will also hide the field making it dissapear from Grids and Forms. A good examples of system fields are "id" or "created_dts".
public system ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

table() публичный Метод

Used in join environment.
public table ( string $t = UNDEFINED ) : string | $this
$t string
Результат string | $this

type() публичный Метод

Logical type of model field. This universal type is recognized by view controllers (such as Controller_MVCForm, Controller_MVCGrid to convert into supported field types.
public type ( string $t = UNDEFINED ) : string | $this
$t string new value
Результат string | $this current value if $t=UNDEFINED

visible() публичный Метод

Controls field appearance in Grid or similar views.
public visible ( boolean $t = UNDEFINED ) : boolean | $this
$t boolean new value
Результат boolean | $this current value if $t=UNDEFINED

Описание свойств

$actual_field публичное свойство

public $actual_field

$allowHTML публичное свойство

public $allowHTML

$auto_track_element публичное свойство

public $auto_track_element

$caption публичное свойство

public $caption

$defaultValue публичное свойство

public $defaultValue

$description публичное свойство

public $description

$display публичное свойство

???
public $display

$editable публичное свойство

public $editable

$emptyText публичное свойство

public $emptyText

$group публичное свойство

public $group

$has_default_value публичное свойство

public $has_default_value

$hidden публичное свойство

public $hidden

$hint публичное свойство

public $hint

$listData публичное свойство

public array|null $listData
Результат array | null

$mandatory публичное свойство

public $mandatory

$onField публичное свойство

Callbacks
public $onField

$owner публичное свойство

public Model $owner
Результат Model

$placeholder публичное свойство

public $placeholder

$readonly публичное свойство

public $readonly

$searchable публичное свойство

public $searchable

$sortable публичное свойство

public $sortable

$system публичное свойство

public $system

$table защищенное свойство

protected $table

$theModel публичное свойство

public $theModel

$type публичное свойство

public $type

$visible публичное свойство

public $visible