Example #1
0
 function mod()
 {
     $rec = freemed::get_link_rec($_REQUEST['id'], $this->table_name);
     $template = CreateObject('org.freemedsoftware.core.FormTemplate', $rec['fr_template']);
     $information = $template->GetInformation();
     $controls = $template->GetControls();
     // Only update timestamp on master record
     $fr_query = $GLOBALS['sql']->update_query($this->table_name, array('fr_timestamp' => SQL__NOW), array('id' => $_REQUEST['id']));
     $fr_result = $GLOBALS['sql']->query($fr_query);
     // Get id for association
     $fid = $_REQUEST['id'];
     foreach ($controls as $k => $v) {
         // Decide if we have defined the control
         if (method_exists($this, 'control_' . $v['type'])) {
             // Call the appropriate method
             $value = call_user_func(array($this, 'control_' . $v['type']), 'serialize', $v);
             // Build UPDATE query
             $query = "UPDATE form_record SET fr_value = '" . addslashes($value) . "' WHERE fr_id='" . addslashes($fid) . "' AND fr_uuid='" . $v['uuid'] . "'";
             $result = $GLOBALS['sql']->query($query);
         }
     }
     // end foreach controls
     // Return to where we came from:
     if ($_REQUEST['return'] == 'manage') {
         $GLOBALS['refresh'] = "manage.php?id=" . urlencode($_REQUEST['patient']);
     } else {
         $GLOBALS['refresh'] = "module_loader.php?module=" . urlencode(get_class($this));
     }
 }