PHP 클래스 Field_Base, atk4

상속: extends AbstractObject
파일 보기 프로젝트 열기: atk4/atk4

공개 프로퍼티들

프로퍼티 타입 설명
$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

보호된 프로퍼티들

프로퍼티 타입 설명
$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