$options_list = $_REQUEST['option']; $count = 0; foreach ($options_list as $option) { if ($option == "") { $count++; continue; } $options_csv .= trim($option); $count++; if ($count != count($options_list)) { $options_csv .= "/"; } } } else { if (isset($_REQUEST['range_lower'])) { $range_lower = trim($_REQUEST['range_lower']); $range_upper = trim($_REQUEST['range_upper']); $unit = trim($_REQUEST['unit']); $options_csv = $range_lower . ":" . $range_upper . ":" . $unit; } } $updated_entry = new CustomField(); $updated_entry->id = $field_id; $updated_entry->fieldName = $field_name; $updated_entry->fieldOptions = $options_csv; if ($del == "Delete") { CustomField::deleteById($updated_entry, $lab_config_id, $type); FieldOrdering::deleteFieldOrderEntry($lab_config_id, 1); } else { CustomField::updateById($updated_entry, $lab_config_id, $type, $offset); }
if ($lab_config->dob != $use_dob) { $lab_config->updateDob($use_dob); } if ($lab_config->pname != $use_pname) { $lab_config->updatePname($use_pname); } if ($lab_config->ageLimit != $ageLimit) { $lab_config->updateAgeLimit($ageLimit); } $lab_config->updateDateFormat($_REQUEST['dformat']); $lab_config->updateDailyNumReset($_REQUEST['dnum_reset']); $lab_config->updateDoctor($use_doctor); //$lab_config->updateHidePatientName($show_pname); // 1. delete existing entry from the field order table FieldOrdering::deleteFieldOrderEntry($lab_config->id, 1); FieldOrdering::deleteFieldOrderEntry($lab_config->id, 2); // 2. Enter a new row for the same lab config and form /* $field_ordering = new FieldOrdering(); // default values $field_ordering->form_id = 1; $field_ordering->id = $_SESSION['lab_config_id']; */ /* $field_ordering->field1 = -1; $field_ordering->field2 = -1; $field_ordering->field3 = -1; $field_ordering->field4 = -1; $field_ordering->field5 = -1; $field_ordering->field6 = -1; $field_ordering->field7 = -1; $field_ordering->field8 = -1; $field_ordering->field9 = -1;
if($value == "4") $field_ordering->field4 = str_replace("_"," ",$key); if($value == "5") $field_ordering->field5 = str_replace("_"," ",$key); if($value == "6") $field_ordering->field6 = str_replace("_"," ",$key); if($value == "7") $field_ordering->field7 = str_replace("_"," ",$key); if($value == "8") $field_ordering->field8 = str_replace("_"," ",$key); if($value == "9") $field_ordering->field9 = str_replace("_"," ",$key); if($value == "10") $field_ordering->field10 = str_replace("_"," ",$key); if($value == "11") $field_ordering->field11 = str_replace("_"," ",$key); if($value == "12") $field_ordering->field12 = str_replace("_"," ",$key); if($value == "13") $field_ordering->field13 = str_replace("_"," ",$key); if($value == "14") $field_ordering->field14 = str_replace("_"," ",$key); if($value == "15") $field_ordering->field15 = str_replace("_"," ",$key); if($value == "16") $field_ordering->field16 = str_replace("_"," ",$key); } */ FieldOrdering::deleteFieldOrderEntry($field_ordering->id, $field_ordering->form_id); FieldOrdering::add_fieldOrdering($field_ordering);
public static function getByFormId($lab_config_id, $form_id) { $saved_db = DbUtil::switchToLabConfig($lab_config_id); //$query_config = "SELECT * FROM field_ordering WHERE lab_config_id = $lab_config_id AND form_id=$form_id LIMIT 1"; $query_config = "SELECT * FROM field_order WHERE lab_config_id = {$lab_config_id} AND form_id={$form_id} LIMIT 1"; //echo $query_config; $record = query_associative_one($query_config); DbUtil::switchRestore($saved_db); return FieldOrdering::getObject($record); }
public static function install_first_order($lab_config, $formId) { $field_ordering_for_curent_lab = FieldOrdering::getByFormId($_SESSION['lab_config_id'], $formId); if ($field_ordering_for_curent_lab == null) { // insert the order for the first time // 1. Get the current lab config info from the LabConfig Class //$lab_config = LabConfig::getById($_SESSION['lab_config_id']); //$custom_field_list_patients = get_lab_config_patient_custom_fields($lab_config->id); // 2. Parse the object and populate the new fieldOrder Object //$fieldOrdering_new = new FieldOrdering(); $field_ordering = new FieldOrdering(); // default values $field_ordering->form_id = $formId; $field_ordering->id = $_SESSION['lab_config_id']; $count = 1; $field_order = ""; if ($formId == 1) { // pid if (isset($lab_config->pid) && $lab_config->pid > 0) { //$field_ordering->{field.$count} = "Patient ID"; $field_order = "Patient ID"; $count++; } //p_addl if (isset($lab_config->patientAddl) && $lab_config->patientAddl > 0) { //$field_ordering->{field.$count} = "Patient Addl ID"; $field_order = $field_order . "," . "Patient Addl ID"; $count++; } //dnum if (isset($lab_config->dailyNum) && $lab_config->dailyNum > 0) { $field_ordering->{field . $count} = "Daily Number"; $field_order = $field_order . "," . "Daily Number"; $count++; } //pname if (isset($lab_config->pname) && $lab_config->pname > 0) { //$field_ordering->{field.$count} = "Patient Name"; $field_order = $field_order . "," . "Patient Name"; $count++; } //sex if (isset($lab_config->sex) && $lab_config->sex > 0) { //$field_ordering->{field.$count} = "Sex"; $field_order = $field_order . "," . "Sex"; $count++; } //age if (isset($lab_config->age) && $lab_config->age > 0) { //$field_ordering->{field.$count} = "Age"; $field_order = $field_order . "," . "Age"; $count++; } //dob if (isset($lab_config->dob) && $lab_config->dob > 0) { //$field_ordering->{field.$count} = "Date of Birth"; $field_order = $field_order . "," . "Date of Birth"; $count++; } $custom_field_list_patients = get_lab_config_patient_custom_fields($lab_config->id); foreach ($custom_field_list_patients as $value) { //$field_ordering->{field.$count} = $value->fieldName; $field_order = $field_order . "," . $value->fieldName; $count++; } } else { if ($formId == 2) { // specimen field $field_order = "Specimen ID"; //s_addl if (isset($lab_config->specimenAddl) && $lab_config->specimenAddl > 0) { $field_order = $field_order . "," . "Specimen Additional ID"; $count++; } //COMM if (isset($lab_config->comm) && $lab_config->comm > 0) { $field_order = $field_order . "," . "Comments"; $count++; } //rdate if (isset($lab_config->rdate) && $lab_config->rdate > 0) { $field_order = $field_order . "," . "Lab Reciept Date"; $count++; } //refout if (isset($lab_config->refout) && $lab_config->refout > 0) { $field_order = $field_order . "," . "Referred Out"; $count++; } //doctor if (isset($lab_config->doctor) && $lab_config->doctor > 0) { $field_order = $field_order . "," . "Physician"; $count++; } $custom_field_list_specimen = get_lab_config_specimen_custom_fields($lab_config->id); foreach ($custom_field_list_specimen as $value) { //$field_ordering->{field.$count} = $value->fieldName; $field_order = $field_order . "," . $value->fieldName; $count++; } } } /* //agelimit if(isset($lab_config->agelimit) && $lab_config->agelimit > 0){ $field_ordering->{field.$count} = "Age Limit"; $count++; } */ // 3. Insert the newly created order $field_ordering->form_field_inOrder = $field_order; FieldOrdering::add_fieldOrdering($field_ordering); $field_ordering_for_curent_lab = $field_ordering; } return $field_ordering_for_curent_lab; }