示例#1
0
 /**
  * internal, build each field then form
  *
  * @return string compiled form
  */
 protected function build_form()
 {
     html_helper::css('widgets/dataform/assets/dataform.css');
     $data = get_object_vars($this);
     $data['container'] = $this->button_containers();
     $form_type = 'open';
     // See if we need a multipart form
     foreach ($this->fields as $field_obj) {
         if ($field_obj instanceof upload_field) {
             $form_type = 'open_multipart';
             break;
         }
     }
     // Set the form open and close
     if ($this->status_is('show')) {
         $data['form_begin'] = '<div class="form">';
         $data['form_end'] = '</div>';
     } else {
         $data['form_begin'] = form_helper::$form_type($this->process_url, $this->attributes);
         $data['form_end'] = form_helper::close();
     }
     $data['fields'] = $this->fields;
     return rpd::view('dataform', $data);
 }