function modform() { $rec = freemed::get_link_rec($_REQUEST['id'], $this->table_name); foreach ($rec as $k => $v) { $_REQUEST[$k] = $v; } $template = CreateObject('org.freemedsoftware.core.FormTemplate', $rec['fr_template']); $controls = $template->GetControls(); $template->LoadData($_REQUEST['id']); foreach ($controls as $k => $v) { // Decide if we have defined the control if (method_exists($this, 'control_' . $v['type'])) { // Set default value //$_REQUEST['variable_'.$v['variable']] $v['default'] = $template->FetchDataElement($v['variable']); // Call the appropriate method $widget = call_user_func(array($this, 'control_' . $v['type']), 'widget', $v); // Push into form $form[$v['name']] = $widget; } } // end foreach controls $GLOBALS['display_buffer'] .= "\n\t\t<form method=\"POST\">\n\t\t<input type=\"hidden\" name=\"module\" value=\"" . prepare($_REQUEST['module']) . "\" />\n\t\t<input type=\"hidden\" name=\"return\" value=\"" . prepare($_REQUEST['return']) . "\" />\n\t\t<input type=\"hidden\" name=\"template\" value=\"" . prepare($rec['fr_template']) . "\" />\n\t\t<input type=\"hidden\" name=\"id\" value=\"" . prepare($_REQUEST['id']) . "\" />\n\t\t<input type=\"hidden\" name=\"patient\" value=\"" . prepare($_REQUEST['patient']) . "\" />\n\t\t<input type=\"hidden\" name=\"action\" value=\"mod\" />\n\n\t\t" . html_form::form_table($form) . "\n\n\t\t<div align=\"center\">\n\t\t<input type=\"submit\" class=\"button\" name=\"__submit\" value=\"" . __("Modify") . "\" />\n\t\t<input type=\"submit\" class=\"button\" name=\"__submit\" value=\"" . __("Cancel") . "\" />\n\t\t</div>\n\t\t</form>\n\t\t"; }