Xataface  2.0alpha2
Xataface Application Framework
 All Data Structures Namespaces Files Functions Variables Groups Pages
group.php
Go to the documentation of this file.
1 <?php
2 import('Dataface/FormTool/table.php');
7 
8  function &buildWidget(&$record, &$field, &$form, $formFieldName, $new=false){
9  $formTool =& Dataface_FormTool::getInstance();
10  $factory =& Dataface_FormTool::factory();
11  if ( isset( $field['fields'] ) ){
12  $els = array();
13  foreach ( array_keys( $field['fields'] ) as $field_key){
14  $els[] = $formTool->buildWidget($record, $field['fields'][$field_key],$factory, $field['fields'][$field_key]['name']);
15  }
16  $el =& $factory->addGroup($els, $field['name'], $field['widget']['label']);
17  } else{
18  $el =& $factory->addElement('text', $field['name'], $widget['label']);
19  }
20  if ( !@$field['widget']['layout'] ) $field['widget']['layout'] = 'table';
21  if ( !@$field['widget']['layout'] ) $field['widget']['columns'] = 1;
22  if ( !@$field['widget']['separator'] ) $field['widget']['separator'] = '<br />';
23  $el->setFieldDef($field);
24  return $el;
25  }
26 }