PHP 클래스 Form_Basic, atk4

저자: Romans ([email protected])
상속: extends View, implements ArrayAccess
파일 보기 프로젝트 열기: atk4/atk4

공개 프로퍼티들

프로퍼티 타입 설명
$app App_Web
$bail_out null | boolean If this is true, we won't load data or submit or validate anything.
$data array Afterwards fields will link to $this->data, so changing $this->data['fld_name'] would actually affect field's value. You should use $this->set() and $this->get() to read/write individual field values. You should use $this->setStaticSource() to load values from hash, BUT - AAAAAAAAAA: this array is no more!!!
$default_controller Class name of default controller
$default_exception Class name of default exception
$errors array Here we will have a list of errors occured in the form, when we tried to submit it. field_name => error
$js_widget JS widget name
$js_widget_arguments JS widget options
$layout View Template of layout if form has one.
$owner View
$search_for_field_spots Normally form fields are inserted using a form template. If you.
$template_chunks array Those templates will be used when rendering form and fields.
$validator Validator object

보호된 프로퍼티들

프로퍼티 타입 설명
$ajax_submits array Contains AJAX instances assigned to buttons.
$conditions array
$get_field null | string If condition was passed to a form through GET, contains a GET field name.
$loaded_from_db boolean true - update() will try updating existing row. false - it would insert new.

공개 메소드들

메소드 설명
addButton ( $label = 'Button', $name = null )
addClass ( $class )
addField ( AbstractView | array | string $type, AbstractView | array | string $options = null, string $caption = null, string $attr = null ) : Form_Field Adds field in form.
addSeparator ( $class = '', $attr = [] )
addSubmit ( $label = 'Save', $name = null )
afterAdd ( $p, $c )
defaultTemplate ( $template = null, $tag = null )
displayError ( $field = null, $msg = null )
error ( string $field, string $text = null ) Adds error message to form field.
get ( $field = null )
getAllFields ( )
grabTemplateChunk ( $name )
hasField ( $name )
importFields ( Model $model, array | string | boolean $fields = UNDEFINED ) Imports model fields in form by using form controller.
init ( ) }}}
isClicked ( $name )
isLoadedFromDB ( )
isSubmitted ( )
lateSubmit ( )
loadData ( )
offsetExists ( $name ) {{{ ArrayAccess support
offsetGet ( $name )
offsetSet ( $name, $val )
offsetUnset ( $name )
onSubmit ( $callback )
render ( )
save ( )
set ( $field_or_array, $value = UNDEFINED ) * temporarily disabled. TODO: will be implemented with abstract datatype function setSource($table,$db_fields=null){ if(is_null($db_fields)){ $db_fields=array(); foreach($this->elements as $key=>$el){ if(!($el instanceof Form_Field))continue; if($el->no_save)continue; $db_fields[]=$key; } } $this->dq = $this->app->db->dsql() ->table($table) ->field('*',$table) ->limit(1); return $this; }
setFieldError ( $field, $name ) * external error management
setLayout ( $template )
showAjaxError ( object $field, string $msg ) Should show error in field. Override this method to change form default alert.
submitted ( )
update ( ) * obsolete in 4.3 - use save()
validate ( $rule )

보호된 메소드들

메소드 설명
getChunks ( )

메소드 상세

addButton() 공개 메소드

public addButton ( $label = 'Button', $name = null )

addClass() 공개 메소드

사용 중단: 4.3.2 Will be removed in 4.4
public addClass ( $class )

addField() 공개 메소드

Adds field in form.
public addField ( AbstractView | array | string $type, AbstractView | array | string $options = null, string $caption = null, string $attr = null ) : Form_Field
$type AbstractView | array | string
$options AbstractView | array | string
$caption string
$attr string Deprecated argument
리턴 Form_Field

addSeparator() 공개 메소드

public addSeparator ( $class = '', $attr = [] )

addSubmit() 공개 메소드

public addSubmit ( $label = 'Save', $name = null )

afterAdd() 공개 메소드

public afterAdd ( $p, $c )

defaultTemplate() 공개 메소드

public defaultTemplate ( $template = null, $tag = null )

displayError() 공개 메소드

public displayError ( $field = null, $msg = null )

error() 공개 메소드

Adds error message to form field.
public error ( string $field, string $text = null )
$field string
$text string

get() 공개 메소드

public get ( $field = null )

getAllFields() 공개 메소드

public getAllFields ( )

getChunks() 보호된 메소드

protected getChunks ( )

grabTemplateChunk() 공개 메소드

public grabTemplateChunk ( $name )

hasField() 공개 메소드

사용 중단: 4.3.2 use getElement() instead
public hasField ( $name )

importFields() 공개 메소드

Imports model fields in form by using form controller.
public importFields ( Model $model, array | string | boolean $fields = UNDEFINED )
$model Model
$fields array | string | boolean

init() 공개 메소드

}}}
public init ( )

isClicked() 공개 메소드

public isClicked ( $name )

isLoadedFromDB() 공개 메소드

public isLoadedFromDB ( )

isSubmitted() 공개 메소드

public isSubmitted ( )

lateSubmit() 공개 메소드

public lateSubmit ( )

loadData() 공개 메소드

public loadData ( )

offsetExists() 공개 메소드

{{{ ArrayAccess support
public offsetExists ( $name )

offsetGet() 공개 메소드

public offsetGet ( $name )

offsetSet() 공개 메소드

public offsetSet ( $name, $val )

offsetUnset() 공개 메소드

public offsetUnset ( $name )

onSubmit() 공개 메소드

public onSubmit ( $callback )

render() 공개 메소드

public render ( )

save() 공개 메소드

public save ( )

set() 공개 메소드

* temporarily disabled. TODO: will be implemented with abstract datatype function setSource($table,$db_fields=null){ if(is_null($db_fields)){ $db_fields=array(); foreach($this->elements as $key=>$el){ if(!($el instanceof Form_Field))continue; if($el->no_save)continue; $db_fields[]=$key; } } $this->dq = $this->app->db->dsql() ->table($table) ->field('*',$table) ->limit(1); return $this; }
public set ( $field_or_array, $value = UNDEFINED )

setFieldError() 공개 메소드

* external error management
public setFieldError ( $field, $name )

setLayout() 공개 메소드

public setLayout ( $template )

showAjaxError() 공개 메소드

Should show error in field. Override this method to change form default alert.
public showAjaxError ( object $field, string $msg )
$field object Field instance that caused error
$msg string message to show

submitted() 공개 메소드

public submitted ( )

update() 공개 메소드

* obsolete in 4.3 - use save()
public update ( )

validate() 공개 메소드

public validate ( $rule )

프로퍼티 상세

$ajax_submits 보호되어 있는 프로퍼티

Contains AJAX instances assigned to buttons.
protected array $ajax_submits
리턴 array

$app 공개적으로 프로퍼티

public App_Web $app
리턴 App_Web

$bail_out 공개적으로 프로퍼티

If this is true, we won't load data or submit or validate anything.
public null|bool $bail_out
리턴 null | boolean

$conditions 보호되어 있는 프로퍼티

protected array $conditions
리턴 array

$data 공개적으로 프로퍼티

Afterwards fields will link to $this->data, so changing $this->data['fld_name'] would actually affect field's value. You should use $this->set() and $this->get() to read/write individual field values. You should use $this->setStaticSource() to load values from hash, BUT - AAAAAAAAAA: this array is no more!!!
public array $data
리턴 array

$default_controller 공개적으로 프로퍼티

Class name of default controller
public $default_controller

$default_exception 공개적으로 프로퍼티

Class name of default exception
public $default_exception

$errors 공개적으로 프로퍼티

Here we will have a list of errors occured in the form, when we tried to submit it. field_name => error
public array $errors
리턴 array

$get_field 보호되어 있는 프로퍼티

If condition was passed to a form through GET, contains a GET field name.
protected null|string $get_field
리턴 null | string

$js_widget 공개적으로 프로퍼티

JS widget name
public $js_widget

$js_widget_arguments 공개적으로 프로퍼티

JS widget options
public $js_widget_arguments

$layout 공개적으로 프로퍼티

Template of layout if form has one.
public View $layout
리턴 View

$loaded_from_db 보호되어 있는 프로퍼티

true - update() will try updating existing row. false - it would insert new.
protected bool $loaded_from_db
리턴 boolean

$owner 공개적으로 프로퍼티

public View $owner
리턴 View

$search_for_field_spots 공개적으로 프로퍼티

Normally form fields are inserted using a form template. If you.
public $search_for_field_spots

$template_chunks 공개적으로 프로퍼티

Those templates will be used when rendering form and fields.
public array $template_chunks
리턴 array

$validator 공개적으로 프로퍼티

Validator object
public $validator