예제 #1
0
 function saveFieldConfiguration($field_id)
 {
     $field = DynamicFormField::lookup($field_id);
     if (!$field->setConfiguration()) {
         include STAFFINC_DIR . 'templates/dynamic-field-config.tmpl.php';
     } else {
         $field->save();
     }
 }
예제 #2
0
 function getField()
 {
     if (!isset($this->field)) {
         $f = DynamicFormField::lookup($this->get('field_id'));
         $this->field = $f->getImpl($f);
         $this->field->setAnswer($this);
     }
     return $this->field;
 }
예제 #3
0
 function upload($id)
 {
     if (!($field = DynamicFormField::lookup($id))) {
         Http::response(400, 'No such field');
     }
     $impl = $field->getImpl();
     if (!$impl instanceof FileUploadField) {
         Http::response(400, 'Upload to a non file-field');
     }
     return JsonDataEncoder::encode(array('id' => $impl->ajaxUpload()));
 }