Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
require_once(INCLUDE_DIR . 'class.topic.php');
require_once(INCLUDE_DIR . 'class.dynamic_forms.php');
class DynamicFormsAjaxAPI extends AjaxController {
function getForm($form_id) {
$form = DynamicFormSection::lookup($form_id);
if (!$form) return;
foreach ($form->getFields() as $field) {
$field->render();
}
}
function getFormsForHelpTopic($topic_id, $client=false) {
$topic = Topic::lookup($topic_id);
foreach (DynamicFormset::lookup($topic->ht['formset_id'])->getForms() as $form) {
$set=$form;
$form=$form->getForm();
if ($client)
include(CLIENTINC_DIR . 'templates/dynamic-form.tmpl.php');
else
include(STAFFINC_DIR . 'templates/dynamic-form.tmpl.php');
}
}
function getClientFormsForHelpTopic($topic_id) {
return $this->getFormsForHelpTopic($topic_id, true);
}
function getFieldConfiguration($field_id) {
$field = DynamicFormField::lookup($field_id);
include(STAFFINC_DIR . 'templates/dynamic-field-config.tmpl.php');
}
function saveFieldConfiguration($field_id) {
$field = DynamicFormField::lookup($field_id);
if (!$field->setConfiguration())
include(STAFFINC_DIR . 'templates/dynamic-field-config.tmpl.php');
else
$field->save();
}
}
?>